File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,27 @@ private Class<?> findLoadedClass0(String name) {
208208 * boot class loader.
209209 */
210210 @ Alias @ RecomputeFieldValue (kind = RecomputeFieldValue .Kind .NewInstance , declClass = ConcurrentHashMap .class )//
211- ConcurrentHashMap <?, ?> classLoaderValueMap ;
211+ volatile ConcurrentHashMap <?, ?> classLoaderValueMap ;
212+
213+ /**
214+ * This substitution is a temporary workaround for GR-33896 until GR-36494 is merged.
215+ */
216+ @ Substitute //
217+ @ TargetElement (onlyWith = JDK17OrLater .class ) //
218+ @ SuppressWarnings ({"unused" }) //
219+ ConcurrentHashMap <?, ?> createOrGetClassLoaderValueMap () {
220+ ConcurrentHashMap <?, ?> result = classLoaderValueMap ;
221+ if (result == null ) {
222+ // Checkstyle: allow synchronization
223+ synchronized (this ) {
224+ result = classLoaderValueMap ;
225+ if (result == null ) {
226+ classLoaderValueMap = result = new ConcurrentHashMap <>();
227+ }
228+ }
229+ }
230+ return result ;
231+ }
212232
213233 @ Alias
214234 native Stream <Package > packages ();
You can’t perform that action at this time.
0 commit comments