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

exception thrown for calling class.getInstance on java.util.Collections$CheckedRandomAccessList

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      macOS:

      macOS Big Sur
      Version 11.2.3 (20D91)
      Processor 2.3 GHz Dual-Core Intel Core i5
      Memory 8 GB 2133 MHz LPDDR3

      J9(11.0.11):

      Exception in thread "main" java.lang.Error: unexpected exception
      at AbstractTest.exceptionThrown(AbstractTest.java:10)
      at java.desktop/java.beans.Encoder.getValue(Unknown Source)
      at java.desktop/java.beans.Encoder.get(Unknown Source)
      at java.desktop/java.beans.PersistenceDelegate.writeObject(Unknown Source)
      at java.desktop/java.beans.Encoder.writeObject(Unknown Source)
      at java.desktop/java.beans.XMLEncoder.writeObject(Unknown Source)
      at java.desktop/java.beans.Encoder.writeExpression(Unknown Source)
      at java.desktop/java.beans.XMLEncoder.writeExpression(Unknown Source)
      at java.desktop/java.beans.PersistenceDelegate.writeObject(Unknown Source)
      at java.desktop/java.beans.Encoder.writeObject(Unknown Source)
      at java.desktop/java.beans.XMLEncoder.writeObject(Unknown Source)
      at java.desktop/java.beans.Encoder.writeObject1(Unknown Source)
      at java.desktop/java.beans.Encoder.cloneStatement(Unknown Source)
      at java.desktop/java.beans.Encoder.writeStatement(Unknown Source)
      at java.desktop/java.beans.XMLEncoder.writeStatement(Unknown Source)
      at java.desktop/java.beans.XMLEncoder.writeObject(Unknown Source)
      at AbstractTest.writeObject(AbstractTest.java:45)
      at AbstractTest.testObject(AbstractTest.java:36)
      at AbstractTest.test(AbstractTest.java:30)
      at JTest1.main(JTest1.java:8)
      Caused by: java.lang.IllegalAccessException: Class sun/reflect/misc/Trampoline illegally accessing "package private" class java/util/Collections$CheckedRandomAccessList
      at java.base/java.lang.J9VMInternals.newInstanceImpl(Native Method)
      at java.base/java.lang.Class.newInstance(Unknown Source)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      at sun.reflect.misc.Trampoline.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.base/java.lang.reflect.Method.invoke(Unknown Source)
      at java.base/sun.reflect.misc.MethodUtil.invoke(Unknown Source)
      at java.desktop/java.beans.Statement.invokeInternal(Unknown Source)
      at java.desktop/java.beans.Statement$2.run(Unknown Source)
      at java.base/java.security.AccessController.doPrivileged(Unknown Source)
      at java.desktop/java.beans.Statement.invoke(Unknown Source)
      at java.desktop/java.beans.Expression.getValue(Unknown Source)
      ... 19 more

      hotspot(10.0.2 ,11.0.10):

      Exception in thread "main" java.lang.Error: unexpected exception
      at AbstractTest.exceptionThrown(AbstractTest.java:10)
      at java.desktop/java.beans.Encoder.getValue(Encoder.java:108)
      at java.desktop/java.beans.Encoder.get(Encoder.java:252)
      at java.desktop/java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:112)
      at java.desktop/java.beans.Encoder.writeObject(Encoder.java:74)
      at java.desktop/java.beans.XMLEncoder.writeObject(XMLEncoder.java:326)
      at java.desktop/java.beans.Encoder.writeExpression(Encoder.java:330)
      at java.desktop/java.beans.XMLEncoder.writeExpression(XMLEncoder.java:454)
      at java.desktop/java.beans.PersistenceDelegate.writeObject(PersistenceDelegate.java:115)
      at java.desktop/java.beans.Encoder.writeObject(Encoder.java:74)
      at java.desktop/java.beans.XMLEncoder.writeObject(XMLEncoder.java:326)
      at java.desktop/java.beans.Encoder.writeObject1(Encoder.java:258)
      at java.desktop/java.beans.Encoder.cloneStatement(Encoder.java:271)
      at java.desktop/java.beans.Encoder.writeStatement(Encoder.java:301)
      at java.desktop/java.beans.XMLEncoder.writeStatement(XMLEncoder.java:399)
      at java.desktop/java.beans.XMLEncoder.writeObject(XMLEncoder.java:329)
      at AbstractTest.writeObject(AbstractTest.java:45)
      at AbstractTest.testObject(AbstractTest.java:36)
      at AbstractTest.test(AbstractTest.java:30)
      at JTest1.main(JTest1.java:8)
      Caused by: java.lang.InstantiationException: java.util.Collections$CheckedRandomAccessList
      at java.base/java.lang.Class.newInstance(Class.java:547)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at java.base/sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:260)
      at java.desktop/java.beans.Statement.invokeInternal(Statement.java:304)
      at java.desktop/java.beans.Statement.access$000(Statement.java:60)
      at java.desktop/java.beans.Statement$2.run(Statement.java:187)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.desktop/java.beans.Statement.invoke(Statement.java:184)
      at java.desktop/java.beans.Expression.getValue(Expression.java:155)
      at java.desktop/java.beans.Encoder.getValue(Encoder.java:105)
      ... 18 more
      Caused by: java.lang.NoSuchMethodException: java.util.Collections$CheckedRandomAccessList.<init>()
      at java.base/java.lang.Class.getConstructor0(Class.java:3302)
      at java.base/java.lang.Class.newInstance(Class.java:532)
      ... 35 more

      A DESCRIPTION OF THE PROBLEM :
      Given a test case, we found that the execution results of this test case on different JVMs and different versions are quite different, the simplified test case can be found in the attachment. In summary, J9(1.8.0_292) and hotspot(8u275b01) are executed normally, while others threw different exceptions. We first speculated that it was a J9 problem, but the developers of J9 gave us a reasonable explanation, for more information: https://github.com/eclipse-openj9/openj9/issues/13082. Hope it helps.

      REGRESSION : Last worked in version 8

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Follow the commands in readme.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Run normally
      ACTUAL -
      NoSuchMethodException

      ---------- BEGIN SOURCE ----------
      Can be found in the attachment.
      https://drive.google.com/file/d/1QtchZYS32_99HvhX_s8cCewEGypluTTt/view?usp=sharing
      ---------- END SOURCE ----------

      FREQUENCY : always


            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: