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

UnresolvedElementException: Discovered unresolved method during parsing: char[].clone() #877

Closed
starksm64 opened this issue Dec 21, 2018 · 3 comments
Assignees
Labels

Comments

@starksm64
Copy link

@starksm64 starksm64 commented Dec 21, 2018

I have run across an unexpected UnresolvedElementException for char[].clone() while testing native-image generation. I have distilled this down to a trivial example using the 3 attached java classes found in the Archive.zip attachement:
HelloClone.java
IHello.java
RawMsg.java

Scotts-iMacPro:getting-started-secure-native starksm$ $GRAALVM_HOME/bin/native-image --verbose HelloClone
Build on Server(pid: 4025, port: 52179)
SendBuildRequest [
-task=com.oracle.svm.hosted.NativeImageGeneratorRunner
-imagecp
/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/svm/builder/svm.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/svm/builder/objectfile.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/svm/builder/pointsto.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/jvmci/graal.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/jvmci/graal-management.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/jvmci/jvmci-api.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/jvmci/jvmci-hotspot.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/boot/graaljs-scriptengine.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/boot/graal-sdk.jar:/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/svm/library-support.jar:/Users/starksm/Dev/JBoss/Protean/quickstarts/getting-started-secure-native
-H:Path=/Users/starksm/Dev/JBoss/Protean/quickstarts/getting-started-secure-native
-H:CLibraryPath=/Users/starksm/Dev/JBoss/Protean/graalvm-ce-1.0.0-rc10/Contents/Home/jre/lib/svm/clibraries/darwin-amd64
-H:Class=HelloClone
-H:Name=helloclone
]
[helloclone:4025]    classlist:     157.88 ms
[helloclone:4025]        (cap):     638.25 ms
[helloclone:4025]        setup:     902.50 ms
[helloclone:4025]     analysis:   1,391.89 ms
error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: char[].clone(). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: char[].clone(). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
Trace: 
	at parsing IHello.createHello(IHello.java:3)
Call path from entry point to IHello.createHello(char[]): 
	at IHello.createHello(IHello.java:3)
	at HelloClone.main(HelloClone.java:5)
	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:164)
	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

Error: Processing image build request failed

Note that if I try to simplify this to simply the following:

public class HelloClone2 {
	public static void main(String[] args) {
		String msg = "Hello world clone";
		String hello = new String(msg.toCharArray().clone());
		System.out.println(hello);
	}
}

Then the native-image generation succeeds.

Archive.zip

@cstancu cstancu self-assigned this Dec 21, 2018
@bobmcwhirter

This comment has been minimized.

Copy link
Contributor

@bobmcwhirter bobmcwhirter commented Aug 5, 2019

@starksm64 Can you confirm if this is still an issue?

Building your Archive.zip with my JDK11-ish Substrate from HEAD, stuff seems to work.

[helloclone:27909]    classlist:   1,590.11 ms
[helloclone:27909]        (cap):   1,406.26 ms
[helloclone:27909]        setup:   2,890.43 ms
[helloclone:27909]   (typeflow):   6,354.30 ms
[helloclone:27909]    (objects):   7,467.19 ms
[helloclone:27909]   (features):     389.92 ms
[helloclone:27909]     analysis:  14,480.72 ms
[helloclone:27909]     (clinit):     248.60 ms
[helloclone:27909]     universe:     612.81 ms
[helloclone:27909]      (parse):   1,145.20 ms
[helloclone:27909]     (inline):   4,156.04 ms
[helloclone:27909]    (compile):  11,641.86 ms
[helloclone:27909]      compile:  17,740.75 ms
[helloclone:27909]        image:   2,711.86 ms
[helloclone:27909]        write:     442.62 ms
[helloclone:27909]      [total]:  40,654.58 ms
$ ./helloclone
Hello world clone
@cstancu

This comment has been minimized.

Copy link
Member

@cstancu cstancu commented Aug 8, 2019

@bobmcwhirter thanks for double-checking. I'll go ahead and close this. @starksm64 please reopen if this is still an issue.

@dmlloyd

This comment has been minimized.

Copy link
Contributor

@dmlloyd dmlloyd commented Nov 1, 2019

It looks like this is not completely fixed; see quarkusio/quarkus#5113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.