Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8335804

[premain] ArchiveInvokeDynamic causes BootstrapMethodError

XMLWordPrintable

      $ cat PDTest.java
      class PDTest {
          public static void main(String args[]) throws Exception {
              if (args.length > 0) {
                  System.out.println(PDTest.class.getProtectionDomain());
              }
          }
      }
      $ javac PDTest.java
      $ jar cvf PDTest.jar PDTest.class

      $ rm -fv PD.cds
      $ java -XX:CacheDataStore=PD.cds -cp PDTest.jar PDTest
      [... archive is dumped ...]
      $ java -XX:CacheDataStore=PD.cds -cp PDTest.jar PDTest
      ... no errors ...
      $ java -XX:CacheDataStore=PD.cds -cp PDTest.jar PDTest 1
      Exception in thread "main" java.lang.BootstrapMethodError: bootstrap method initialization exception
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:191)
      at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:316)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:278)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:268)
      at java.base/java.security.Security.<clinit>(Security.java:83)
      at java.base/sun.security.util.SecurityProperties.getOverridableProperty(SecurityProperties.java:57)
      at java.base/sun.security.util.SecurityProperties.privilegedGetOverridable(SecurityProperties.java:48)
      at java.base/sun.security.util.SecurityProperties.includedInExceptions(SecurityProperties.java:72)
      at java.base/sun.security.util.SecurityProperties.<clinit>(SecurityProperties.java:36)
      at java.base/sun.security.util.FilePermCompat.<clinit>(FilePermCompat.java:43)
      at java.base/java.io.FilePermission.init(FilePermission.java:319)
      at java.base/java.io.FilePermission.<init>(FilePermission.java:490)
      at java.base/sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:222)
      at java.base/sun.security.util.LazyCodeSourcePermissionCollection.ensureAdded(LazyCodeSourcePermissionCollection.java:69)
      at java.base/sun.security.util.LazyCodeSourcePermissionCollection.toString(LazyCodeSourcePermissionCollection.java:115)
      at java.base/java.lang.String.valueOf(String.java:4556)
      at java.base/java.lang.StringBuilder.append(StringBuilder.java:173)
      at java.base/java.security.ProtectionDomain.toString(ProtectionDomain.java:434)
      at java.base/java.lang.String.valueOf(String.java:4556)
      at java.base/java.io.PrintStream.println(PrintStream.java:1189)
      at PDTest.main(PDTest.java:17)
      Caused by: java.lang.invoke.LambdaConversionException: Exception instantiating lambda object
      at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:245)
      at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:341)
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:170)
      ... 20 more
      Caused by: java.lang.invoke.WrongMethodTypeException: handle's method type ()Object but found ()Object
      at java.base/java.lang.invoke.Invokers.newWrongMethodTypeException(Invokers.java:521)
      at java.base/java.lang.invoke.Invokers.checkExactType(Invokers.java:530)
      at java.base/java.lang.invoke.InnerClassLambdaMetafactory.buildCallSite(InnerClassLambdaMetafactory.java:237)
      ... 22 more

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: