Skip to content

Commit

Permalink
Append cp to annotation data to fix redefinition inconsistencies
Browse files Browse the repository at this point in the history
Port to Java next from ibmruntimes/openj9-openjdk-jdk8#705

Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
  • Loading branch information
theresa-m committed Nov 15, 2023
1 parent 332d74a commit 2f1a5de
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
12 changes: 8 additions & 4 deletions src/java.base/share/classes/java/lang/reflect/Executable.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
* ===========================================================================
*/

package java.lang.reflect;

import java.lang.annotation.Annotation;
Expand Down Expand Up @@ -84,8 +90,7 @@ boolean equalParamTypes(Class<?>[] params1, Class<?>[] params2) {
Annotation[][] parseParameterAnnotations(byte[] parameterAnnotations) {
return AnnotationParser.parseParameterAnnotations(
parameterAnnotations,
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
com.ibm.oti.vm.VM.getConstantPoolFromAnnotationBytes(getDeclaringClass(), parameterAnnotations),
getDeclaringClass());
}

Expand Down Expand Up @@ -634,8 +639,7 @@ private Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
} else {
declAnnos = AnnotationParser.parseAnnotations(
getAnnotationBytes(),
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
com.ibm.oti.vm.VM.getConstantPoolFromAnnotationBytes(getDeclaringClass(), getAnnotationBytes()),
getDeclaringClass()
);
}
Expand Down
9 changes: 7 additions & 2 deletions src/java.base/share/classes/java/lang/reflect/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
* ===========================================================================
*/

package java.lang.reflect;

import jdk.internal.access.SharedSecrets;
Expand Down Expand Up @@ -1280,8 +1286,7 @@ private Map<Class<? extends Annotation>, Annotation> declaredAnnotations() {
} else {
declAnnos = AnnotationParser.parseAnnotations(
annotations,
SharedSecrets.getJavaLangAccess()
.getConstantPool(getDeclaringClass()),
com.ibm.oti.vm.VM.getConstantPoolFromAnnotationBytes(getDeclaringClass(), annotations),
getDeclaringClass());
}
declaredAnnotations = declAnnos;
Expand Down
9 changes: 7 additions & 2 deletions src/java.base/share/classes/java/lang/reflect/Method.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
* ===========================================================================
*/

package java.lang.reflect;

import jdk.internal.access.SharedSecrets;
Expand Down Expand Up @@ -771,8 +777,7 @@ public Object getDefaultValue() {
getReturnType());
Object result = AnnotationParser.parseMemberValue(
memberType, ByteBuffer.wrap(annotationDefault),
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
com.ibm.oti.vm.VM.getConstantPoolFromAnnotationBytes(getDeclaringClass(), annotationDefault),
getDeclaringClass());
if (result instanceof ExceptionProxy) {
if (result instanceof TypeNotPresentExceptionProxy proxy) {
Expand Down

0 comments on commit 2f1a5de

Please sign in to comment.