Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported method java.lang.Class.getConstantPool() is reachable #3125

Closed
aldettinger opened this issue Jan 14, 2021 · 8 comments
Closed

Unsupported method java.lang.Class.getConstantPool() is reachable #3125

aldettinger opened this issue Jan 14, 2021 · 8 comments
Assignees

Comments

@aldettinger
Copy link

Describe the issue
Static code analysis including RMap<Object,Object> org.redisson.api.RedissonClient.getMap(String name) reports Unsupported method java.lang.Class.getConstantPool() is reachable

Steps to reproduce the issue

  1. git clone https://github.com/aldettinger/graalvm-get-property-reproducer.git
  2. mvn clean package

Describe GraalVM and your environment:
GraalVM Version 20.3.0 (Java Version 11.0.9+10-jvmci-20.3-b06) on RHEL 7.9

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.3.0 (Java Version 11.0.9+10-jvmci-20.3-b06)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /home/agallice/dev/graalvm/graalvm-ce-java11-20.3.0/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-run-time=io.netty.channel.DefaultChannelId,io.netty.util.NetUtil,io.netty.channel.socket.InternetProtocolFamily,io.netty.resolver.HostsFileEntriesResolver,io.netty.resolver.dns.DnsNameResolver,io.netty.resolver.dns.DnsServerAddressStreamProviders,io.netty.resolver.dns.PreferredAddressTypeComparator\$1,io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider,io.netty.resolver.dns.DnsServerAddressStreamProviders\$DefaultProviderHolder --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http --no-server -H:-UseServiceLoaderFeature -H:+StackTrace graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]    classlist:   3,029.96 ms,  0.94 GB
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]        (cap):     528.88 ms,  0.94 GB
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]        setup:   1,782.22 ms,  0.94 GB
15:17:36,449 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]     (clinit):     631.04 ms,  2.69 GB
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]   (typeflow):  17,894.07 ms,  2.69 GB
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]    (objects):  19,477.28 ms,  2.69 GB
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]   (features):     570.11 ms,  2.69 GB
[graalvm-get-property-reproducer-1.0.0-SNAPSHOT-runner:21079]     analysis:  40,663.73 ms,  2.69 GB
Error: Unsupported features in 4 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2088)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2088)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:342)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getRawExecutableTypeAnnotations(System.java:2106)
Call path from entry point to java.lang.System$2.getRawExecutableTypeAnnotations(Executable): 
	at java.lang.System$2.getRawExecutableTypeAnnotations(System.java:2106)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:337)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getRawClassTypeAnnotations(System.java:2103)
Call path from entry point to java.lang.System$2.getRawClassTypeAnnotations(Class): 
	at java.lang.System$2.getRawClassTypeAnnotations(System.java:2103)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:334)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(Unknown Source)
Call path from entry point to java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(ClassLoader, String, byte[], int, int, ProtectionDomain): 
	at java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(Unknown Source)
	at com.oracle.svm.reflect.ClassLoader$ByteBuddyAccessor$AhdDhnpo_defineClass_b7244845934446fa0b5e56d11e3ee1d6fc541dfd_260.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

com.oracle.svm.core.util.UserError$UserException: Unsupported features in 4 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2088)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2088)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:342)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getRawExecutableTypeAnnotations(System.java:2106)
Call path from entry point to java.lang.System$2.getRawExecutableTypeAnnotations(Executable): 
	at java.lang.System$2.getRawExecutableTypeAnnotations(System.java:2106)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:337)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getRawClassTypeAnnotations(System.java:2103)
Call path from entry point to java.lang.System$2.getRawClassTypeAnnotations(Class): 
	at java.lang.System$2.getRawClassTypeAnnotations(System.java:2103)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:334)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(Unknown Source)
Call path from entry point to java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(ClassLoader, String, byte[], int, int, ProtectionDomain): 
	at java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(Unknown Source)
	at com.oracle.svm.reflect.ClassLoader$ByteBuddyAccessor$AhdDhnpo_defineClass_b7244845934446fa0b5e56d11e3ee1d6fc541dfd_260.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

	at com.oracle.svm.core.util.UserError.abort(UserError.java:82)
	at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:217)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:768)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:558)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:471)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 4 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getConstantPool() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getConstantPool(System.java:2088)
Call path from entry point to java.lang.System$2.getConstantPool(Class): 
	at java.lang.System$2.getConstantPool(System.java:2088)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:342)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getExecutableTypeAnnotationBytes(Executable) is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getRawExecutableTypeAnnotations(System.java:2106)
Call path from entry point to java.lang.System$2.getRawExecutableTypeAnnotations(Executable): 
	at java.lang.System$2.getRawExecutableTypeAnnotations(System.java:2106)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:337)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getRawTypeAnnotations() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.System$2.getRawClassTypeAnnotations(System.java:2103)
Call path from entry point to java.lang.System$2.getRawClassTypeAnnotations(Class): 
	at java.lang.System$2.getRawClassTypeAnnotations(System.java:2103)
	at sun.reflect.annotation.TypeAnnotationParser.parseAllTypeAnnotations(TypeAnnotationParser.java:334)
	at sun.reflect.annotation.TypeAnnotationParser.fetchBounds(TypeAnnotationParser.java:318)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:263)
	at sun.reflect.annotation.TypeAnnotationParser.parseAnnotatedBounds(TypeAnnotationParser.java:256)
	at sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getAnnotatedBounds(TypeVariableImpl.java:218)
	at com.oracle.svm.reflect.TypeVariable_getAnnotatedBounds_88ea462da2b17ea45028db307519aaeeec9a4036_202.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
	at parsing java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(Unknown Source)
Call path from entry point to java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(ClassLoader, String, byte[], int, int, ProtectionDomain): 
	at java.lang.ClassLoader$ByteBuddyAccessor$AhdDhnpo.defineClass(Unknown Source)
	at com.oracle.svm.reflect.ClassLoader$ByteBuddyAccessor$AhdDhnpo_defineClass_b7244845934446fa0b5e56d11e3ee1d6fc541dfd_260.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:566)
	at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
	at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

	at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765)
	... 8 more
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

Any idea to find the culprit ? Are we searching a call to System.getProperty(String, String) ? or TypeVariable.getAnnotatedBounds() ?

@munishchouhan
Copy link
Contributor

@aldettinger Please pass --report-unsupported-elements-at-runtime flag in your build arguments for native-image

@munishchouhan munishchouhan self-assigned this Jan 18, 2021
@aldettinger
Copy link
Author

thanks for having a look @mcraj017. Setting --report-unsupported-elements-at-runtime, still an issue is reported:

Error: Classes that should be initialized at run time got initialized during image building:
 io.netty.util.NetUtil the class was requested to be initialized at run time (from the command line). To see why io.netty.util.NetUtil got initialized use --trace-class-initialization=io.netty.util.NetUtil

And then setting --trace-class-initialization=io.netty.util.NetUtil does not provide more logs.

Are there any tips to find the piece of code that make the static analysis fail in such a situation ?

@aldettinger
Copy link
Author

aldettinger commented Jan 21, 2021

I was able to go beyond this issue by substituting RedissonLiveObjectService.createProxy(...) and Introspectior.getFieldsWithAnnotation(...) where byte buddy is used.

It would be nice to have a way to find the culprits quicker in such a situation. Maybe there is a way for native-image to exhibits stack traces mentioning RedissonLiveObjectService.createProxy(...) and Introspectior.getFieldsWithAnnotation(...) in such a situation ?

@munishchouhan
Copy link
Contributor

@aldettinger please share the full error stack

@aldettinger
Copy link
Author

@mcraj017 The full error stack is present in the first note.
This stack trace could be reproduced with this project.
At this commit, it reproduces with redisson that uses byte buddy under the hood.
And at that commit, I've shrinked it to reproduce with byte buddy only.

@munishchouhan
Copy link
Contributor

@aldettinger I am able to build the image using --report-unsupported-elements-at-runtime and solution from quarkusio/quarkus#6123

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy-jackson</artifactId>
    </dependency>

instead of

    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-resteasy</artifactId>
    </dependency>

@aldettinger
Copy link
Author

@mcraj017 thanks for taking a look. The resteasy-jackson issue is not related to the original bytebuddy issue. As such, the original stack trace from the first note can be reproduced even when the quarkus-resteasy has been replaced with quarkus-resteasy-jackson.

The original byte buddy issue is a static analysis issue only, as such using --report-unsupported-elements-at-runtime only ignore the static analysis issue. As stated previously, I was able to go beyond this issue by substituting RedissonLiveObjectService.createProxy(...) and Introspectior.getFieldsWithAnnotation(...) where byte buddy is used.

From there, I'm wondering whether the main value for the community would be to have a way to better diagnose such situations. Is it possible to have a better stack trace ? Is there an existing option that can provide more information ? What do you think ?

@munishchouhan
Copy link
Contributor

@aldettinger Native-Image is an early adopter technology and we are making it better with every new release. --report-unsupported-elements-at-runtime options will be depreciated in future releases when native-image is compatible with all the JVM features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants