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

[GR-43010] Using Groovy classes under native-image results in UnsupportedFeatureError #5522

Open
linghengqian opened this issue Nov 29, 2022 · 3 comments
Assignees

Comments

@linghengqian
Copy link

linghengqian commented Nov 29, 2022

Describe the issue
A clear and concise description of the issue. We recommend using the latest snapshot builds to replicate the issue as bugs are constantly being fixed in the master branch

  • Using Groovy classes under native-image results in UnsupportedFeatureError .

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. [e.g.: git clone --depth 1 https://git.myrepo.com/projectone ]
  2. [e.g.: mvn clean package]
git clone [email protected]:linghengqian/groovy-unsupport-graalvm-test.git
sdk use java 22.3.r11-grl
gu install native-image
sudo apt-get install build-essential libz-dev zlib1g-dev -y
./gradlew clean nativeTest

Describe GraalVM and your environment:

  • GraalVM version (latest snapshot builds can be found here), or commit id if built from source: [e.g. EE 19.3, CE 20.0, CE 20.1.0-dev-20200304_0848] CE 22.3.0
  • JDK major version: [e.g.:8] 11
  • OS: [e.g. macOS Catalina] Linux Ubuntu 22.04
  • Architecture: [e.g.: AMD64] AMD64

More details
Consider adding the --native-image-info and --verbose flags when building your native image and paste output below.

Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.

  • I have followed the steps below to generate GraalVM reachability metadata directly through Native Build Tools Standard Mode.
./gradlew -Pagent clean test
./gradlew metadataCopy --task test
> Task :nativeTest FAILED
JUnit Platform on Native Image - report
----------------------------------------

com.lingh.GroovyTest > assertEvaluateForArray() FAILED

com.lingh.GroovyTest > assertEvaluateForRange() FAILED

com.lingh.GroovyTest > assertEvaluateForLiteral() FAILED

com.lingh.GroovyTest > assertEvaluateForExpressionIsNull() SUCCESSFUL

com.lingh.GroovyTest > assertEvaluateForLong() FAILED

com.lingh.GroovyTest > assertEvaluateForNull() FAILED

com.lingh.GroovyTest > assertEvaluateForComplex() FAILED

com.lingh.GroovyTest > assertEvaluateForCalculate() FAILED

com.lingh.GroovyTest > assertEvaluateForExpressionPlaceHolder() FAILED

com.lingh.GroovyTest > assertHandlePlaceHolder() SUCCESSFUL

com.lingh.GroovyTest > assertEvaluateClosure() FAILED

com.lingh.GroovyTest > assertEvaluateForSimpleString() FAILED


Failures (10):
  JUnit Jupiter:GroovyTest:assertEvaluateForArray()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForArray', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForRange()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForRange', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForLiteral()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForLiteral', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForLong()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForLong', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForNull()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForNull', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForComplex()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForComplex', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForCalculate()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForCalculate', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForExpressionPlaceHolder()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForExpressionPlaceHolder', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateClosure()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateClosure', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]
  JUnit Jupiter:GroovyTest:assertEvaluateForSimpleString()
    MethodSource [className = 'com.lingh.GroovyTest', methodName = 'assertEvaluateForSimpleString', methodParameterTypes = '']
    => com.oracle.svm.core.jdk.UnsupportedFeatureError: No classes have been predefined during the image build to load from bytecodes at runtime.
       org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:89)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.throwNoBytecodeClasses(PredefinedClassesSupport.java:76)
       org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:130)
       [email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:294)
       [email protected]/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       groovy.lang.GroovyClassLoader.access$400(GroovyClassLoader.java:89)
       groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:690)
       groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:707)
       groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:712)
       org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:806)
       [...]

Test run finished after 49 ms
[         2 containers found      ]
[         0 containers skipped    ]
[         2 containers started    ]
[         0 containers aborted    ]
[         2 containers successful ]
[         0 containers failed     ]
[        12 tests found           ]
[         0 tests skipped         ]
[        12 tests started         ]
[         0 tests aborted         ]
[         2 tests successful      ]
[        10 tests failed          ]


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nativeTest'.
> Process 'command '/home/linghengqian/TwinklingLiftWorks/git/public/groovy-unsupport-graalvm-test/build/native/nativeTestCompile/groovy-unsupport-graalvm-test-tests'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 39s
8 actionable tasks: 8 executed
  • Of course I know about truffle espresso, but even with espresso I don't seem to be able to use groovyshell properly, I don't know if there is an example of this. For javascript and java, it behaves fine under graalvm native image via truffle.
@linghengqian linghengqian changed the title Using Groovy classes under native-image results in AnalysisError$ParsingError Using Groovy classes under native-image results in UnsupportedFeatureError Nov 29, 2022
@oubidar-Abderrahim
Copy link
Member

Hi, thank you for reporting this, we'll take a look into it shortly

@linghengqian
Copy link
Author

@oubidar-Abderrahim
Copy link
Member

Thank you, this issue is now tracked internally on GR 43010

@oubidar-Abderrahim oubidar-Abderrahim removed their assignment Jan 17, 2024
@wirthi wirthi changed the title Using Groovy classes under native-image results in UnsupportedFeatureError [GR-43010] Using Groovy classes under native-image results in UnsupportedFeatureError Apr 29, 2024
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

3 participants