Skip to content

Commit

Permalink
Merge pull request #729 from theresa-m/parseannotation
Browse files Browse the repository at this point in the history
0.43.0: Append cp to annotation data to fix redefinition inconsistencies
  • Loading branch information
tajila committed Nov 20, 2023
2 parents 4bb9143 + d39cff5 commit ef0e328
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 @@ -77,8 +83,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 @@ -603,8 +608,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.misc.SharedSecrets;
Expand Down Expand Up @@ -1174,8 +1180,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.HotSpotIntrinsicCandidate;
Expand Down Expand Up @@ -673,8 +679,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) {
Expand Down

0 comments on commit ef0e328

Please sign in to comment.