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 17 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 3dfae78 commit 26b5740
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.*;
Expand Down Expand Up @@ -82,8 +88,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 @@ -624,8 +629,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 @@ -1210,8 +1216,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 @@ -716,8 +722,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 26b5740

Please sign in to comment.