diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java index 792c7bc00a2..f46e487db9c 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotJavaType.java @@ -23,11 +23,12 @@ package jdk.vm.ci.hotspot; import jdk.vm.ci.meta.JavaType; +import jdk.vm.ci.meta.annotation.AbstractAnnotated; /** * Common base class for all HotSpot {@link JavaType} implementations. */ -public abstract class HotSpotJavaType implements JavaType { +public abstract class HotSpotJavaType extends AbstractAnnotated implements JavaType { private final String name; diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethod.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethod.java index c2145b298b6..1e09a639b8f 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotMethod.java @@ -22,17 +22,18 @@ */ package jdk.vm.ci.hotspot; -import static java.util.FormattableFlags.ALTERNATE; -import static java.util.FormattableFlags.LEFT_JUSTIFY; -import static java.util.FormattableFlags.UPPERCASE; +import jdk.vm.ci.meta.JavaMethod; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import jdk.vm.ci.meta.annotation.AbstractAnnotated; import java.util.Formattable; import java.util.Formatter; -import jdk.vm.ci.meta.JavaMethod; -import jdk.vm.ci.meta.ResolvedJavaMethod; +import static java.util.FormattableFlags.ALTERNATE; +import static java.util.FormattableFlags.LEFT_JUSTIFY; +import static java.util.FormattableFlags.UPPERCASE; -abstract class HotSpotMethod implements JavaMethod, Formattable { +abstract class HotSpotMethod extends AbstractAnnotated implements JavaMethod, Formattable { public static String applyFormattingFlagsAndWidth(String s, int flags, int width) { if (flags == 0 && width < 0) { diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java index 49a3773f1d4..a0fbfaf3283 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java @@ -26,6 +26,7 @@ import jdk.vm.ci.meta.JavaType; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.UnresolvedJavaType; +import jdk.vm.ci.meta.annotation.AbstractAnnotated; import jdk.vm.ci.meta.annotation.AnnotationsInfo; import java.lang.annotation.Annotation; @@ -39,7 +40,7 @@ /** * Represents a field in a HotSpot type. */ -class HotSpotResolvedJavaFieldImpl implements HotSpotResolvedJavaField { +class HotSpotResolvedJavaFieldImpl extends AbstractAnnotated implements HotSpotResolvedJavaField { private final HotSpotResolvedObjectTypeImpl holder; private JavaType type; @@ -191,7 +192,7 @@ private boolean hasAnnotations(boolean typeAnnotations) { HotSpotVMConfig config = config(); final long metaspaceAnnotations = UNSAFE.getAddress(holder.getKlassPointer() + config.instanceKlassAnnotationsOffset); if (metaspaceAnnotations != 0) { - int annotationsOffset = typeAnnotations? config.annotationsFieldTypeAnnotationsOffset: config.annotationsFieldAnnotationsOffset; + int annotationsOffset = typeAnnotations ? config.annotationsFieldTypeAnnotationsOffset : config.annotationsFieldAnnotationsOffset; long fieldsAnnotations = UNSAFE.getAddress(metaspaceAnnotations + annotationsOffset); if (fieldsAnnotations != 0) { int indexOffset = ADDRESS_SIZE * index; @@ -233,7 +234,7 @@ public JavaConstant getConstantValue() { } @Override - public AnnotationsInfo getDeclaredAnnotationInfo() { + public AnnotationsInfo getRawDeclaredAnnotationInfo() { if (!hasAnnotations(false)) { return null; } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java index 893d25bc5f1..2102eeb59f3 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java @@ -779,7 +779,7 @@ public BitSet getOopMapAt(int bci) { } @Override - public AnnotationsInfo getDeclaredAnnotationInfo() { + public AnnotationsInfo getRawDeclaredAnnotationInfo() { if (!hasAnnotations(config().constMethodHasMethodAnnotations)) { return null; } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaRecordComponent.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaRecordComponent.java index 5c6f7f3fc90..3a3bd903203 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaRecordComponent.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaRecordComponent.java @@ -23,18 +23,19 @@ package jdk.vm.ci.hotspot; import jdk.vm.ci.meta.JavaType; -import java.lang.reflect.RecordComponent; - import jdk.vm.ci.meta.ResolvedJavaRecordComponent; +import jdk.vm.ci.meta.annotation.AbstractAnnotated; import jdk.vm.ci.meta.annotation.AnnotationsInfo; +import java.lang.reflect.RecordComponent; + import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; /** * Represents a {@linkplain RecordComponent component} in a HotSpot record. */ -final class HotSpotResolvedJavaRecordComponent implements ResolvedJavaRecordComponent { +final class HotSpotResolvedJavaRecordComponent extends AbstractAnnotated implements ResolvedJavaRecordComponent { private final HotSpotResolvedObjectTypeImpl declaringRecord; private final String name; @@ -76,6 +77,7 @@ public String toString() { public JavaType getType() { return type; } + @Override public boolean equals(Object obj) { if (obj instanceof HotSpotResolvedJavaRecordComponent that) { @@ -90,7 +92,7 @@ public int hashCode() { } @Override - public AnnotationsInfo getDeclaredAnnotationInfo() { + public AnnotationsInfo getRawDeclaredAnnotationInfo() { byte[] bytes = compilerToVM().getRawAnnotationBytes('r', declaringRecord, declaringRecord.getKlassPointer(), index, CompilerToVM.DECLARED_ANNOTATIONS); return AnnotationsInfo.make(bytes, getDeclaringRecord().getConstantPool(), getDeclaringRecord()); } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java index 4e1d399e67a..2259e162d03 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java @@ -22,25 +22,6 @@ */ package jdk.vm.ci.hotspot; -import static java.util.Objects.requireNonNull; -import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; -import static jdk.vm.ci.hotspot.HotSpotConstantPool.isSignaturePolymorphicHolder; -import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; -import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmClassModifiers; -import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; -import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.nio.ByteOrder; -import java.util.Arrays; -import java.util.Collections; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import jdk.vm.ci.common.JVMCIError; import jdk.vm.ci.meta.Assumptions.AssumptionResult; import jdk.vm.ci.meta.Assumptions.ConcreteMethod; @@ -60,6 +41,25 @@ import jdk.vm.ci.meta.UnresolvedJavaType; import jdk.vm.ci.meta.annotation.AnnotationsInfo; +import java.lang.annotation.Annotation; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static java.util.Objects.requireNonNull; +import static jdk.vm.ci.hotspot.CompilerToVM.compilerToVM; +import static jdk.vm.ci.hotspot.HotSpotConstantPool.isSignaturePolymorphicHolder; +import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime; +import static jdk.vm.ci.hotspot.HotSpotModifiers.jvmClassModifiers; +import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; +import static jdk.vm.ci.hotspot.UnsafeAccess.UNSAFE; + /** * Implementation of {@link JavaType} for resolved non-primitive HotSpot classes. This class is not * an {@link MetaspaceHandleObject} because it doesn't have to be scanned for GC. Its liveness is @@ -807,18 +807,18 @@ HotSpotResolvedJavaField lookupField(Field reflectionField) { * @param internalFlags field's internal flags (from the VM) * @param initializerIndex field's initial value index in the constant pool */ - record FieldInfo(int nameIndex, - int signatureIndex, - int offset, - int classfileFlags, - int internalFlags, - int initializerIndex) { - - record Key(String name, String signature, boolean isStatic) { - static Key from(FieldInfo fi, HotSpotResolvedObjectTypeImpl holder) { - return new FieldInfo.Key(fi.getName(holder), fi.getSignature(holder), fi.isStatic()); - } - } + record FieldInfo(int nameIndex, + int signatureIndex, + int offset, + int classfileFlags, + int internalFlags, + int initializerIndex) { + + record Key(String name, String signature, boolean isStatic) { + static Key from(FieldInfo fi, HotSpotResolvedObjectTypeImpl holder) { + return new FieldInfo.Key(fi.getName(holder), fi.getSignature(holder), fi.isStatic()); + } + } /** * Returns the name of this field as a {@link String}. If the field is an internal field the @@ -1014,7 +1014,7 @@ private boolean hasDirectAnnotations(boolean typeAnnotations) { HotSpotVMConfig config = config(); final long metaspaceAnnotations = UNSAFE.getAddress(getKlassPointer() + config.instanceKlassAnnotationsOffset); if (metaspaceAnnotations != 0) { - int annotationsOffset = typeAnnotations?config.annotationsClassTypeAnnotationsOffset: config.annotationsClassAnnotationsOffset; + int annotationsOffset = typeAnnotations ? config.annotationsClassTypeAnnotationsOffset : config.annotationsClassAnnotationsOffset; long classAnnotations = UNSAFE.getAddress(metaspaceAnnotations + annotationsOffset); return classAnnotations != 0; } @@ -1237,7 +1237,7 @@ public boolean isCloneableWithAllocation() { } @Override - public AnnotationsInfo getDeclaredAnnotationInfo() { + public AnnotationsInfo getRawDeclaredAnnotationInfo() { if (!hasDirectAnnotations(false)) { return null; } diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java index 888c889afe2..4a0712483c7 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java @@ -32,6 +32,7 @@ import jdk.vm.ci.meta.ResolvedJavaRecordComponent; import jdk.vm.ci.meta.ResolvedJavaType; import jdk.vm.ci.meta.UnresolvedJavaType; +import jdk.vm.ci.meta.annotation.AnnotationsInfo; import java.lang.annotation.Annotation; import java.lang.reflect.Modifier; @@ -268,6 +269,16 @@ public T getAnnotation(Class annotationClass) { return null; } + @Override + public AnnotationsInfo getTypeAnnotationInfo() { + return null; + } + + @Override + public AnnotationsInfo getRawDeclaredAnnotationInfo() { + return null; + } + @Override public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { requireNonNull(accessingClass); diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaRecordComponent.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaRecordComponent.java index 6bfa27b3953..c9bc40076ff 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaRecordComponent.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/ResolvedJavaRecordComponent.java @@ -32,22 +32,22 @@ public interface ResolvedJavaRecordComponent extends Annotated { /** * Gets the {@link ResolvedJavaType} object representing the class which declares this record component. */ - ResolvedJavaType getDeclaringRecord(); + ResolvedJavaType getDeclaringRecord(); /** * Gets a {@code ResolvedJavaMethod} that represents the accessor for this record * component. */ - default ResolvedJavaMethod getAccessor() { - for (ResolvedJavaMethod method : getDeclaringRecord().getDeclaredMethods(false)) { - if (method.getName().equals(getName()) && - method.getSignature().getParameterCount(false) == 0 && - method.getSignature().getReturnType(null).getName().equals(getType().getName())) { - return method; - } - } - return null; - } + default ResolvedJavaMethod getAccessor() { + for (ResolvedJavaMethod method : getDeclaringRecord().getDeclaredMethods(false)) { + if (method.getName().equals(getName()) && + method.getSignature().getParameterCount(false) == 0 && + method.getSignature().getReturnType(null).getName().equals(getType().getName())) { + return method; + } + } + return null; + } /** * Returns the name of this record component. diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/AbstractAnnotated.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/AbstractAnnotated.java new file mode 100644 index 00000000000..a6f159ab760 --- /dev/null +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/AbstractAnnotated.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.meta.annotation; + +import java.util.function.Function; + +/** + * A partial implementation of the {@link Annotated} interface, providing + * the caching mechanism for parsed declared annotation information. + *

+ * This class maintains a single-entry cache for the result of parsing + * the declared annotation information, allowing for efficient reuse of + * the parsed data when the same parser function is applied multiple times. + *

+ * Subclasses must provide an implementation for the {@link #getRawDeclaredAnnotationInfo} + * method, which returns the raw annotation information. + */ +public abstract class AbstractAnnotated implements Annotated { + + /** + * Record used for entry in {@link #parsedDeclaredAnnotationsCache}. + */ + private record ParsedDeclaredAnnotationsCacheEntry(Function parser, R result) { + } + + /** + * Single-entry cache for the result of parsing {@link #getDeclaredAnnotationInfo}. + */ + private volatile ParsedDeclaredAnnotationsCacheEntry parsedDeclaredAnnotationsCache; + + @SuppressWarnings("unchecked") + @Override + public T getDeclaredAnnotationInfo(Function parser) { + if (parser == null) { + return (T) getRawDeclaredAnnotationInfo(); + } + ParsedDeclaredAnnotationsCacheEntry cache = parsedDeclaredAnnotationsCache; + if (cache == null || !parser.equals(cache.parser)) { + AnnotationsInfo info = getRawDeclaredAnnotationInfo(); + cache = new ParsedDeclaredAnnotationsCacheEntry<>(parser, parser.apply(info)); + parsedDeclaredAnnotationsCache = cache; + } + return (T) cache.result; + } + + /** + * Gets the unparsed class file info for the annotations directly present on this element. + */ + public abstract AnnotationsInfo getRawDeclaredAnnotationInfo(); +} diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/Annotated.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/Annotated.java index cdfa356128b..11a21376778 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/Annotated.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/annotation/Annotated.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,6 +23,7 @@ package jdk.vm.ci.meta.annotation; import java.lang.reflect.AnnotatedElement; +import java.util.function.Function; /** * Represents a program element such as a method, constructor, field or class for which annotations @@ -33,17 +34,33 @@ public interface Annotated { /** * Gets the class file info for the annotations directly present on this element - * or {@code null} if no such info exists. + * (which will be {@code null} if no such info exists), applies the provided + * parser function to it and returns the result. + *

+ * The result of the last call to this method is cached if {@code parser != null}. + * That is, if an {@linkplain Object#equals(Object) equivalent} parser object is + * used again without any intervening calls with a different parser, the same + * result object will be returned. + *

+ * Note: Since lambda objects implement {@link Object#equals(Object)} with identity, + * if {@code parser} is a lambda object, it should be a singleton in a final + * static field. There is no guarantee about the identity of the result of a + * lambda expression (JLS {@jls 15.27.4}). + * + * @param the type of the result produced by the parser function + * @param parser a function that takes the declared annotation information and + * produces a result of type T. If {@code null}, then the + * AnnotationsInfo value that would have been parsed is returned and + * the cache is not updated. + * @return the result of applying the parser function to the declared annotation + * information, potentially retrieved from cache if the identical parser object + * was previously used */ - default AnnotationsInfo getDeclaredAnnotationInfo() { - return null; - } + T getDeclaredAnnotationInfo(Function parser); /** * Gets the class file info for the type annotations associated with this element * or {@code null} if no such info exists. */ - default AnnotationsInfo getTypeAnnotationInfo() { - return null; - } + AnnotationsInfo getTypeAnnotationInfo(); } diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java index 15ed60515e7..1c86e5c32f8 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java @@ -204,7 +204,7 @@ public void getDeclaredAnnotationInfoTest() { for (Field f : fields.keySet()) { ResolvedJavaField field = metaAccess.lookupJavaField(f); byte[] rawAnnotations = getFieldValue(fieldAnnotations, f); - TestResolvedJavaType.checkRawAnnotations(field, "getDeclaredAnnotationInfo", rawAnnotations, field.getDeclaredAnnotationInfo()); + TestResolvedJavaType.checkRawAnnotations(field, "getDeclaredAnnotationInfo", rawAnnotations, field.getDeclaredAnnotationInfo(null)); } } diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java index 1f1af4d0af2..eb1e336e89d 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java @@ -550,7 +550,7 @@ public void getDeclaredAnnotationInfoTest() { for (Method m : methods.keySet()) { ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m); byte[] rawAnnotations = getFieldValue(methodAnnotations, m); - TestResolvedJavaType.checkRawAnnotations(method, "getDeclaredAnnotationInfo", rawAnnotations, method.getDeclaredAnnotationInfo()); + TestResolvedJavaType.checkRawAnnotations(method, "getDeclaredAnnotationInfo", rawAnnotations, method.getDeclaredAnnotationInfo(null)); } } @@ -696,7 +696,7 @@ public void getOopMapAtTest() throws Exception { try { oopMap = m.getOopMapAt(bci + 1); throw new AssertionError("expected exception for illegal bci %d in %s: %s".formatted(bci + 1, m.format("%H.%n(%p)"), oopMap)); - } catch(IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaRecordComponent.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaRecordComponent.java index 474b5412d71..4ca055c3d8f 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaRecordComponent.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaRecordComponent.java @@ -124,7 +124,7 @@ public void getDeclaredAnnotationInfoTest() { for (RecordComponent rc : recordComponents.keySet()) { ResolvedJavaRecordComponent jrc = metaAccess.lookupJavaRecordComponent(rc); byte[] rawAnnotations = getFieldValue(recordComponentAnnotations, rc); - TestResolvedJavaType.checkRawAnnotations(jrc, "getDeclaredAnnotationInfo", rawAnnotations, jrc.getDeclaredAnnotationInfo()); + TestResolvedJavaType.checkRawAnnotations(jrc, "getDeclaredAnnotationInfo", rawAnnotations, jrc.getDeclaredAnnotationInfo(null)); } } diff --git a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java index 9f444c68347..d3e7af2f1e1 100644 --- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java +++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java @@ -1421,7 +1421,7 @@ public void getDeclaredAnnotationInfoTest() { public static void checkDeclaredAnnotationInfo(Class clazz) { Annotated type = metaAccess.lookupJavaType(clazz); byte[] rawAnnotations = invokeMethod(classGetRawAnnotations, clazz); - checkRawAnnotations(type, "getDeclaredAnnotationInfo", rawAnnotations, type.getDeclaredAnnotationInfo()); + checkRawAnnotations(type, "getDeclaredAnnotationInfo", rawAnnotations, type.getDeclaredAnnotationInfo(null)); } // @formatter:off