Skip to content

Commit

Permalink
Merge pull request #11370 from sharon-wang/getcp
Browse files Browse the repository at this point in the history
Enable java.lang.Class.getConstantPool() for Java 8
  • Loading branch information
tajila committed Dec 7, 2020
2 parents c757b51 + 8642e39 commit c144b7c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jcl/src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Class<? extends Annotation>, Annotation> directAnnotationsMap = new LinkedHashMap<>(directAnnotations.length * 4 / 3);
Expand Down Expand Up @@ -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<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap() {
throw new Error("Class.getDeclaredAnnotationMap() unimplemented"); //$NON-NLS-1$
}
Expand Down

0 comments on commit c144b7c

Please sign in to comment.