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

Lambda serialization fails on 17 iteration

XMLWordPrintable

      Fails started from JDK8b115

      Minimized test:
      --------------------------------------------------------------------------------
      public class MiniTest {

          public static void main(String[] args) throws IOException {
              for(int i = 0; i < 17; i++) {
                  ser();
              }
          }

          public static void ser() throws IOException {
              try (ByteOutputStream bos = new ByteOutputStream(); ObjectOutputStream ostream = new ObjectOutputStream(bos)) {
                  ostream.writeObject((FuncInt) () -> {});
              }
          }
      }

      @FunctionalInterface
      interface FuncInt extends Serializable {

          void m();
      }
      --------------------------------------------------------------------------------

      Output:
      --------------------------------------------------------------------------------
      Exception in thread "main" java.lang.NoClassDefFoundError: javasoft/sqe/tests/api/java/lang/invoke/SerializedLambda/serial/MiniTest$$Lambda$1/804564176
      at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:1075)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1136)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
      at javasoft.sqe.tests.api.java.lang.invoke.SerializedLambda.serial.MiniTest.ser(MiniTest.java:25)
      at javasoft.sqe.tests.api.java.lang.invoke.SerializedLambda.serial.MiniTest.main(MiniTest.java:19)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: java.lang.ClassNotFoundException: javasoft.sqe.tests.api.java.lang.invoke.SerializedLambda.serial.MiniTest$$Lambda$1.804564176
      at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 13 more
      --------------------------------------------------------------------------------

            rfield Robert Field (Inactive)
            evotchen Elena Votchennikova (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: