@@ -77,7 +77,36 @@ object LinkerImpl {
77
77
" scala." ,
78
78
" org.scalajs.linker.interface." ,
79
79
" org.scalajs.logging." ,
80
- " org.scalajs.ir."
80
+ " org.scalajs.ir." ,
81
+ /*
82
+ * A workaround for the OpenJDK bug 6265952 (#3921)
83
+ * https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6265952
84
+ *
85
+ * It manifests as a `java.lang.NoClassDefFoundError` being thrown,
86
+ * claiming the class `MethodAccessorImpl` is missing. The package of the
87
+ * class is implementation specific. The currently known packages are
88
+ * listed as prefixes below.
89
+ *
90
+ * The bug is triggered when calling `java.lang.Method#invoke` if both of
91
+ * the following conditions are met:
92
+ *
93
+ * - this is the 15th (or later) time `invoke` is called on this instance,
94
+ * - the `ClassLoader` of the method's owning class does not make
95
+ * `MethodAccessorImpl` available.
96
+ *
97
+ * Depending on the JDK implementation, the system property
98
+ * `sun.reflect.inflationThreshold` controls the invocation count
99
+ * threshold and can serve as a temporary workaround (e.g. set
100
+ * `-Dsun.reflect.inflationThreshold=30`)
101
+ *
102
+ * To work around the issue, this `ClassLoader` delegates loading of
103
+ * classes in these internal packages to the parent `ClassLoader`.
104
+ * Additional package prefixes may need to be added in the future if the
105
+ * internal package names change or another implementation uses a
106
+ * different name.
107
+ */
108
+ " sun.reflect." ,
109
+ " jdk.internal.reflect."
81
110
)
82
111
83
112
override def loadClass (name : String , resolve : Boolean ): Class [_] = {
0 commit comments