diff --git a/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java b/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java index 0e7d625290e..0b46055423a 100644 --- a/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java +++ b/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -40,7 +40,7 @@ import jdk.internal.javac.PreviewFeature; * @since 22 */ @PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API) -public interface AttributeMapper { +public interface AttributeMapper> { /** * Attribute stability indicator diff --git a/src/java.base/share/classes/java/lang/classfile/package-info.java b/src/java.base/share/classes/java/lang/classfile/package-info.java index 921cf9e1a34..6e9ecfe4819 100644 --- a/src/java.base/share/classes/java/lang/classfile/package-info.java +++ b/src/java.base/share/classes/java/lang/classfile/package-info.java @@ -147,7 +147,7 @@ * ClassReader, int)} method for mapping from the classfile format * to an attribute instance, and the * {@link java.lang.classfile.AttributeMapper#writeAttribute(java.lang.classfile.BufWriter, - * java.lang.Object)} method for mapping back to the classfile format. It also + * java.lang.classfile.Attribute)} method for mapping back to the classfile format. It also * contains metadata including the attribute name, the set of classfile entities * where the attribute is applicable, and whether multiple attributes of the * same kind are allowed on a single entity. diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java b/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java index 31e1a7f2533..fb9ecc98902 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java @@ -54,7 +54,7 @@ public class AttributeHolder { } @SuppressWarnings("unchecked") - A get(AttributeMapper am) { + > A get(AttributeMapper am) { for (Attribute a : attributes) if (a.attributeMapper() == am) return (A)a; diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java b/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java index d5ed0c14bce..36ef2fa55eb 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java @@ -148,7 +148,7 @@ public abstract sealed class BoundAttribute> mapper = customAttributes.apply(name); } if (mapper != null) { - filled.add((Attribute) Objects.requireNonNull(mapper.readAttribute(enclosing, reader, p))); + filled.add(Objects.requireNonNull(mapper.readAttribute(enclosing, reader, p))); } else { AttributeMapper fakeMapper = new AttributeMapper<>() { @Override diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java b/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java index 1ff80d76676..a064c40be30 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java @@ -224,7 +224,7 @@ public class Util { } @SuppressWarnings("unchecked") - private static void writeAttribute(BufWriterImpl writer, Attribute attr) { + private static > void writeAttribute(BufWriterImpl writer, Attribute attr) { if (attr instanceof CustomAttribute ca) { var mapper = (AttributeMapper) ca.attributeMapper(); mapper.writeAttribute(writer, (T) ca);