From 8642e39e68567548aef25ab8100a276bc30775ef Mon Sep 17 00:00:00 2001 From: Sharon Wang Date: Thu, 3 Dec 2020 18:11:53 -0700 Subject: [PATCH] Enable java.lang.Class.getConstantPool() for Java 8 Signed-off-by: Sharon Wang --- jcl/src/java.base/share/classes/java/lang/Class.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jcl/src/java.base/share/classes/java/lang/Class.java b/jcl/src/java.base/share/classes/java/lang/Class.java index afcf8fcb7cd..b48d67d6b7d 100644 --- a/jcl/src/java.base/share/classes/java/lang/Class.java +++ b/jcl/src/java.base/share/classes/java/lang/Class.java @@ -67,12 +67,14 @@ /*[IF Sidecar19-SE] import jdk.internal.misc.Unsafe; +import jdk.internal.misc.SharedSecrets; import java.io.IOException; import jdk.internal.reflect.Reflection; import jdk.internal.reflect.CallerSensitive; import jdk.internal.reflect.ConstantPool; /*[ELSE]*/ import sun.misc.Unsafe; +import sun.misc.SharedSecrets; import sun.reflect.Reflection; import sun.reflect.CallerSensitive; import sun.reflect.ConstantPool; @@ -3110,7 +3112,7 @@ private AnnotationCache getAnnotationCache() { Annotation[] directAnnotations = sun.reflect.annotation.AnnotationParser.toArray( sun.reflect.annotation.AnnotationParser.parseAnnotations( annotationsData, - new Access().getConstantPool(this), + getConstantPool(), this)); LinkedHashMap, Annotation> directAnnotationsMap = new LinkedHashMap<>(directAnnotations.length * 4 / 3); @@ -4670,10 +4672,11 @@ Object setMethodHandleCache(Object cache) { return result; } -/*[IF Sidecar19-SE]*/ ConstantPool getConstantPool() { - return new Access().getConstantPool(this); + return SharedSecrets.getJavaLangAccess().getConstantPool(this); } + +/*[IF Sidecar19-SE]*/ Map, Annotation> getDeclaredAnnotationMap() { throw new Error("Class.getDeclaredAnnotationMap() unimplemented"); //$NON-NLS-1$ }