< prev index next >

src/java.base/share/classes/java/lang/classfile/Attributes.java

Print this page

 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 package java.lang.classfile;
 26 
 27 import java.lang.classfile.AttributeMapper.AttributeStability;
 28 import java.lang.classfile.attribute.*;
 29 
 30 import jdk.internal.classfile.impl.AbstractAttributeMapper.*;

 31 
 32 /**
 33  * Attribute mappers for predefined (JVMS {@jvms 4.7}) and JDK-specific
 34  * nonstandard attributes.
 35  * <p>
 36  * Unless otherwise specified, each mapper returned by methods in this class:
 37  * <ul>
 38  * <li>is predefined in the JVMS instead of JDK-specific;
 39  * <li>does not permit {@linkplain AttributeMapper#allowMultiple() multiple
 40  * attribute instances} in the same structure;
 41  * <li>the attribute has a {@linkplain AttributeMapper#stability() data
 42  * dependency} on the {@linkplain AttributeStability#CP_REFS constant pool}.
 43  * </ul>
 44  *
 45  * @see AttributeMapper
 46  * @see java.lang.classfile.attribute
 47  * @since 24
 48  */
 49 public final class Attributes {
 50 

 64     public static final String NAME_COMPILATION_ID = "CompilationID";
 65 
 66     /** ConstantValue */
 67     public static final String NAME_CONSTANT_VALUE = "ConstantValue";
 68 
 69     /** Deprecated */
 70     public static final String NAME_DEPRECATED = "Deprecated";
 71 
 72     /** EnclosingMethod */
 73     public static final String NAME_ENCLOSING_METHOD = "EnclosingMethod";
 74 
 75     /** Exceptions */
 76     public static final String NAME_EXCEPTIONS = "Exceptions";
 77 
 78     /** InnerClasses */
 79     public static final String NAME_INNER_CLASSES = "InnerClasses";
 80 
 81     /** LineNumberTable */
 82     public static final String NAME_LINE_NUMBER_TABLE = "LineNumberTable";
 83 



 84     /** LocalVariableTable */
 85     public static final String NAME_LOCAL_VARIABLE_TABLE = "LocalVariableTable";
 86 
 87     /** LocalVariableTypeTable */
 88     public static final String NAME_LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable";
 89 
 90     /** MethodParameters */
 91     public static final String NAME_METHOD_PARAMETERS = "MethodParameters";
 92 
 93     /** Module */
 94     public static final String NAME_MODULE = "Module";
 95 
 96     /** ModuleHashes */
 97     public static final String NAME_MODULE_HASHES = "ModuleHashes";
 98 
 99     /** ModuleMainClass */
100     public static final String NAME_MODULE_MAIN_CLASS = "ModuleMainClass";
101 
102     /** ModulePackages */
103     public static final String NAME_MODULE_PACKAGES = "ModulePackages";

228     public static AttributeMapper<ExceptionsAttribute> exceptions() {
229         return ExceptionsMapper.INSTANCE;
230     }
231 
232     /**
233      * {@return the mapper for the {@code InnerClasses} attribute}
234      */
235     public static AttributeMapper<InnerClassesAttribute> innerClasses() {
236         return InnerClassesMapper.INSTANCE;
237     }
238 
239     /**
240      * {@return the mapper for the {@code LineNumberTable} attribute}
241      * The mapper permits multiple instances in a {@code Code} attribute.
242      * This has a data dependency on {@linkplain AttributeStability#LABELS labels}.
243      */
244     public static AttributeMapper<LineNumberTableAttribute> lineNumberTable() {
245         return LineNumberTableMapper.INSTANCE;
246     }
247 









248     /**
249      * {@return the mapper for the {@code LocalVariableTable} attribute}
250      * The mapper permits multiple instances in a {@code Code} attribute.
251      * This has a data dependency on {@linkplain AttributeStability#LABELS labels}.
252      */
253     public static AttributeMapper<LocalVariableTableAttribute> localVariableTable() {
254         return LocalVariableTableMapper.INSTANCE;
255     }
256 
257     /**
258      * {@return the mapper for the {@code LocalVariableTypeTable} attribute}
259      * The mapper permits multiple instances in a given location.
260      * This has a data dependency on {@linkplain AttributeStability#LABELS labels}.
261      */
262     public static AttributeMapper<LocalVariableTypeTableAttribute> localVariableTypeTable() {
263         return LocalVariableTypeTableMapper.INSTANCE;
264     }
265 
266     /**
267      * {@return the mapper for the {@code MethodParameters} attribute}

 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 package java.lang.classfile;
 26 
 27 import java.lang.classfile.AttributeMapper.AttributeStability;
 28 import java.lang.classfile.attribute.*;
 29 
 30 import jdk.internal.classfile.impl.AbstractAttributeMapper.*;
 31 import jdk.internal.javac.PreviewFeature;
 32 
 33 /**
 34  * Attribute mappers for predefined (JVMS {@jvms 4.7}) and JDK-specific
 35  * nonstandard attributes.
 36  * <p>
 37  * Unless otherwise specified, each mapper returned by methods in this class:
 38  * <ul>
 39  * <li>is predefined in the JVMS instead of JDK-specific;
 40  * <li>does not permit {@linkplain AttributeMapper#allowMultiple() multiple
 41  * attribute instances} in the same structure;
 42  * <li>the attribute has a {@linkplain AttributeMapper#stability() data
 43  * dependency} on the {@linkplain AttributeStability#CP_REFS constant pool}.
 44  * </ul>
 45  *
 46  * @see AttributeMapper
 47  * @see java.lang.classfile.attribute
 48  * @since 24
 49  */
 50 public final class Attributes {
 51 

 65     public static final String NAME_COMPILATION_ID = "CompilationID";
 66 
 67     /** ConstantValue */
 68     public static final String NAME_CONSTANT_VALUE = "ConstantValue";
 69 
 70     /** Deprecated */
 71     public static final String NAME_DEPRECATED = "Deprecated";
 72 
 73     /** EnclosingMethod */
 74     public static final String NAME_ENCLOSING_METHOD = "EnclosingMethod";
 75 
 76     /** Exceptions */
 77     public static final String NAME_EXCEPTIONS = "Exceptions";
 78 
 79     /** InnerClasses */
 80     public static final String NAME_INNER_CLASSES = "InnerClasses";
 81 
 82     /** LineNumberTable */
 83     public static final String NAME_LINE_NUMBER_TABLE = "LineNumberTable";
 84 
 85     /** LoadableDescriptors */
 86     public static final String NAME_LOADABLE_DESCRIPTORS = "LoadableDescriptors";
 87 
 88     /** LocalVariableTable */
 89     public static final String NAME_LOCAL_VARIABLE_TABLE = "LocalVariableTable";
 90 
 91     /** LocalVariableTypeTable */
 92     public static final String NAME_LOCAL_VARIABLE_TYPE_TABLE = "LocalVariableTypeTable";
 93 
 94     /** MethodParameters */
 95     public static final String NAME_METHOD_PARAMETERS = "MethodParameters";
 96 
 97     /** Module */
 98     public static final String NAME_MODULE = "Module";
 99 
100     /** ModuleHashes */
101     public static final String NAME_MODULE_HASHES = "ModuleHashes";
102 
103     /** ModuleMainClass */
104     public static final String NAME_MODULE_MAIN_CLASS = "ModuleMainClass";
105 
106     /** ModulePackages */
107     public static final String NAME_MODULE_PACKAGES = "ModulePackages";

232     public static AttributeMapper<ExceptionsAttribute> exceptions() {
233         return ExceptionsMapper.INSTANCE;
234     }
235 
236     /**
237      * {@return the mapper for the {@code InnerClasses} attribute}
238      */
239     public static AttributeMapper<InnerClassesAttribute> innerClasses() {
240         return InnerClassesMapper.INSTANCE;
241     }
242 
243     /**
244      * {@return the mapper for the {@code LineNumberTable} attribute}
245      * The mapper permits multiple instances in a {@code Code} attribute.
246      * This has a data dependency on {@linkplain AttributeStability#LABELS labels}.
247      */
248     public static AttributeMapper<LineNumberTableAttribute> lineNumberTable() {
249         return LineNumberTableMapper.INSTANCE;
250     }
251 
252     /**
253      * {@return Attribute mapper for the {@code LoadableDescriptors} attribute}
254      * @since Valhalla
255      */
256     @PreviewFeature(feature = PreviewFeature.Feature.VALUE_OBJECTS)
257     public static AttributeMapper<LoadableDescriptorsAttribute> loadableDescriptors() {
258         return LoadableDescriptorsMapper.INSTANCE;
259     }
260 
261     /**
262      * {@return the mapper for the {@code LocalVariableTable} attribute}
263      * The mapper permits multiple instances in a {@code Code} attribute.
264      * This has a data dependency on {@linkplain AttributeStability#LABELS labels}.
265      */
266     public static AttributeMapper<LocalVariableTableAttribute> localVariableTable() {
267         return LocalVariableTableMapper.INSTANCE;
268     }
269 
270     /**
271      * {@return the mapper for the {@code LocalVariableTypeTable} attribute}
272      * The mapper permits multiple instances in a given location.
273      * This has a data dependency on {@linkplain AttributeStability#LABELS labels}.
274      */
275     public static AttributeMapper<LocalVariableTypeTableAttribute> localVariableTypeTable() {
276         return LocalVariableTypeTableMapper.INSTANCE;
277     }
278 
279     /**
280      * {@return the mapper for the {@code MethodParameters} attribute}
< prev index next >