/* * Copyright (c) 2022, 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. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * 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 java.lang.classfile; import java.lang.classfile.AttributeMapper.AttributeStability; import java.lang.classfile.attribute.*; import jdk.internal.classfile.impl.AbstractAttributeMapper.*; import jdk.internal.javac.PreviewFeature; /** * Attribute mappers for standard classfile attributes. *

* Unless otherwise specified, mappers returned by each method * do not permit multiple attribute instances in a given location. *

* The most stable {@link AttributeStability#STATELESS STATELESS} mappers are: *

* * The mappers with {@link AttributeStability#CP_REFS CP_REFS} stability are: * * * The mappers with {@link AttributeStability#LABELS LABELS} stability are: * * * The {@link AttributeStability#UNSTABLE UNSTABLE} mappers are: * * * @see AttributeMapper * * @since 22 */ @PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API) public final class Attributes { /** AnnotationDefault */ public static final String NAME_ANNOTATION_DEFAULT = "AnnotationDefault"; /** BootstrapMethods */ public static final String NAME_BOOTSTRAP_METHODS = "BootstrapMethods"; /** CharacterRangeTable */ public static final String NAME_CHARACTER_RANGE_TABLE = "CharacterRangeTable"; /** Code */ public static final String NAME_CODE = "Code"; /** CompilationID */ public static final String NAME_COMPILATION_ID = "CompilationID"; /** ConstantValue */ public static final String NAME_CONSTANT_VALUE = "ConstantValue"; /** Deprecated */ public static final String NAME_DEPRECATED = "Deprecated"; /** EnclosingMethod */ public static final String NAME_ENCLOSING_METHOD = "EnclosingMethod"; /** Exceptions */ public static final String NAME_EXCEPTIONS = "Exceptions"; /** InnerClasses */ public static final String NAME_INNER_CLASSES = "InnerClasses"; /** LineNumberTable */ public static final String NAME_LINE_NUMBER_TABLE = "LineNumberTable"; /** LocalVariableTable */ public static final String NAME_LOCAL_VARIABLE_TABLE = "LocalVariableTable"; /** LocalVariableTypeTable */ public static final String NAME_LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable"; /** MethodParameters */ public static final String NAME_METHOD_PARAMETERS = "MethodParameters"; /** Module */ public static final String NAME_MODULE = "Module"; /** ModuleHashes */ public static final String NAME_MODULE_HASHES = "ModuleHashes"; /** ModuleMainClass */ public static final String NAME_MODULE_MAIN_CLASS = "ModuleMainClass"; /** ModulePackages */ public static final String NAME_MODULE_PACKAGES = "ModulePackages"; /** ModuleResolution */ public static final String NAME_MODULE_RESOLUTION = "ModuleResolution"; /** ModuleTarget */ public static final String NAME_MODULE_TARGET = "ModuleTarget"; /** NestHost */ public static final String NAME_NEST_HOST = "NestHost"; /** NestMembers */ public static final String NAME_NEST_MEMBERS = "NestMembers"; /** PermittedSubclasses */ public static final String NAME_PERMITTED_SUBCLASSES = "PermittedSubclasses"; /** Record */ public static final String NAME_RECORD = "Record"; /** RuntimeInvisibleAnnotations */ public static final String NAME_RUNTIME_INVISIBLE_ANNOTATIONS = "RuntimeInvisibleAnnotations"; /** RuntimeInvisibleParameterAnnotations */ public static final String NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = "RuntimeInvisibleParameterAnnotations"; /** RuntimeInvisibleTypeAnnotations */ public static final String NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations"; /** RuntimeVisibleAnnotations */ public static final String NAME_RUNTIME_VISIBLE_ANNOTATIONS = "RuntimeVisibleAnnotations"; /** RuntimeVisibleParameterAnnotations */ public static final String NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS = "RuntimeVisibleParameterAnnotations"; /** RuntimeVisibleTypeAnnotations */ public static final String NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations"; /** Signature */ public static final String NAME_SIGNATURE = "Signature"; /** SourceDebugExtension */ public static final String NAME_SOURCE_DEBUG_EXTENSION = "SourceDebugExtension"; /** SourceFile */ public static final String NAME_SOURCE_FILE = "SourceFile"; /** SourceID */ public static final String NAME_SOURCE_ID = "SourceID"; /** StackMapTable */ public static final String NAME_STACK_MAP_TABLE = "StackMapTable"; /** Synthetic */ public static final String NAME_SYNTHETIC = "Synthetic"; private Attributes() { } /** * {@return Attribute mapper for the {@code AnnotationDefault} attribute} * @since 23 */ public static AttributeMapper annotationDefault() { return AnnotationDefaultMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code BootstrapMethods} attribute} * @since 23 */ public static AttributeMapper bootstrapMethods() { return BootstrapMethodsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code CharacterRangeTable} attribute} * The mapper permits multiple instances in a given location. * @since 23 */ public static AttributeMapper characterRangeTable() { return CharacterRangeTableMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Code} attribute} * @since 23 */ public static AttributeMapper code() { return CodeMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code CompilationID} attribute} * @since 23 */ public static AttributeMapper compilationId() { return CompilationIDMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code ConstantValue} attribute} * @since 23 */ public static AttributeMapper constantValue() { return ConstantValueMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Deprecated} attribute} * The mapper permits multiple instances in a given location. * @since 23 */ public static AttributeMapper deprecated() { return DeprecatedMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code EnclosingMethod} attribute} * @since 23 */ public static AttributeMapper enclosingMethod() { return EnclosingMethodMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Exceptions} attribute} * @since 23 */ public static AttributeMapper exceptions() { return ExceptionsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code InnerClasses} attribute} * @since 23 */ public static AttributeMapper innerClasses() { return InnerClassesMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code LineNumberTable} attribute} * The mapper permits multiple instances in a given location. * @since 23 */ public static AttributeMapper lineNumberTable() { return LineNumberTableMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code LocalVariableTable} attribute} * The mapper permits multiple instances in a given location. * @since 23 */ public static AttributeMapper localVariableTable() { return LocalVariableTableMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code LocalVariableTypeTable} attribute} * The mapper permits multiple instances in a given location. * @since 23 */ public static AttributeMapper localVariableTypeTable() { return LocalVariableTypeTableMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code MethodParameters} attribute} * @since 23 */ public static AttributeMapper methodParameters() { return MethodParametersMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Module} attribute} * @since 23 */ public static AttributeMapper module() { return ModuleMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code ModuleHashes} attribute} * @since 23 */ public static AttributeMapper moduleHashes() { return ModuleHashesMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code ModuleMainClass} attribute} * @since 23 */ public static AttributeMapper moduleMainClass() { return ModuleMainClassMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code ModulePackages} attribute} * @since 23 */ public static AttributeMapper modulePackages() { return ModulePackagesMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code ModuleResolution} attribute} * @since 23 */ public static AttributeMapper moduleResolution() { return ModuleResolutionMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code ModuleTarget} attribute} * @since 23 */ public static AttributeMapper moduleTarget() { return ModuleTargetMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code NestHost} attribute} * @since 23 */ public static AttributeMapper nestHost() { return NestHostMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code NestMembers} attribute} * @since 23 */ public static AttributeMapper nestMembers() { return NestMembersMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code PermittedSubclasses} attribute} * @since 23 */ public static AttributeMapper permittedSubclasses() { return PermittedSubclassesMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Record} attribute} * @since 23 */ public static AttributeMapper record() { return RecordMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code RuntimeInvisibleAnnotations} attribute} * @since 23 */ public static AttributeMapper runtimeInvisibleAnnotations() { return RuntimeInvisibleAnnotationsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code RuntimeInvisibleParameterAnnotations} attribute} * @since 23 */ public static AttributeMapper runtimeInvisibleParameterAnnotations() { return RuntimeInvisibleParameterAnnotationsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code RuntimeInvisibleTypeAnnotations} attribute} * @since 23 */ public static AttributeMapper runtimeInvisibleTypeAnnotations() { return RuntimeInvisibleTypeAnnotationsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code RuntimeVisibleAnnotations} attribute} * @since 23 */ public static AttributeMapper runtimeVisibleAnnotations() { return RuntimeVisibleAnnotationsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code RuntimeVisibleParameterAnnotations} attribute} * @since 23 */ public static AttributeMapper runtimeVisibleParameterAnnotations() { return RuntimeVisibleParameterAnnotationsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code RuntimeVisibleTypeAnnotations} attribute} * @since 23 */ public static AttributeMapper runtimeVisibleTypeAnnotations() { return RuntimeVisibleTypeAnnotationsMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Signature} attribute} * @since 23 */ public static AttributeMapper signature() { return SignatureMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code SourceDebugExtension} attribute} * @since 23 */ public static AttributeMapper sourceDebugExtension() { return SourceDebugExtensionMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code SourceFile} attribute} * @since 23 */ public static AttributeMapper sourceFile() { return SourceFileMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code SourceID} attribute} * @since 23 */ public static AttributeMapper sourceId() { return SourceIDMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code StackMapTable} attribute} * @since 23 */ public static AttributeMapper stackMapTable() { return StackMapTableMapper.INSTANCE; } /** * {@return Attribute mapper for the {@code Synthetic} attribute} * The mapper permits multiple instances in a given location. * @since 23 */ public static AttributeMapper synthetic() { return SyntheticMapper.INSTANCE; } }