Last active
April 19, 2019 20:49
-
-
Save cstancu/e5158a91c3e1181ea34ac8dec6509fb5 to your computer and use it in GitHub Desktop.
--report-unsupported-elements-at-runtime test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# compile java | |
javac Main.java DeletedClass.java | |
# run java | |
java Main | |
# compile substitution | |
javac -cp ${GRAALVM_HOME}/jre/lib/svm/builder/svm.jar:. Target_DeletedClass.java | |
# build native image | |
native-image --report-unsupported-elements-at-runtime -H:+ReportExceptionStackTraces Main | |
# run native image | |
./main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DeletedClass { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./build.sh | |
+ javac Main.java DeletedClass.java | |
+ java Main | |
obj instanceof SubClass FALSE | |
+ javac -cp ${GRAALVM_HOME}/jre/lib/svm/builder/svm.jar:. Target_DeletedClass.java | |
+ native-image --report-unsupported-elements-at-runtime -H:+ReportExceptionStackTraces Main | |
Build on Server(pid: 517, port: 40259) | |
[main:517] classlist: 226.55 ms | |
[main:517] (cap): 596.85 ms | |
[main:517] setup: 923.70 ms | |
[main:517] (typeflow): 1,708.39 ms | |
[main:517] (objects): 730.42 ms | |
[main:517] (features): 95.30 ms | |
[main:517] analysis: 2,581.61 ms | |
[main:517] universe: 105.98 ms | |
[main:517] (parse): 207.21 ms | |
[main:517] (inline): 430.74 ms | |
[main:517] (compile): 1,817.72 ms | |
[main:517] compile: 2,585.22 ms | |
[main:517] image: 228.62 ms | |
[main:517] write: 55.85 ms | |
[main:517] [total]: 6,750.16 ms | |
+ ./main | |
obj instanceof SubClass FALSE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
Object obj = new Object(); | |
if(obj instanceof SubClass) { | |
System.out.println(" obj instanceof SubClass TRUE"); | |
} else { | |
System.out.println(" obj instanceof SubClass FALSE"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SubClass extends DeletedClass { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.oracle.svm.core.annotate.Delete; | |
import com.oracle.svm.core.annotate.TargetClass; | |
@Delete | |
@TargetClass(DeletedClass.class) | |
public final class Target_DeletedClass { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment