11/*
2- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
33 */
44/*
55 * Licensed to the Apache Software Foundation (ASF) under one or more
2525/**
2626 * Constants for the project, mostly defined in the JVM specification.
2727 *
28- * @version $Id$
2928 * @since 6.0 (intended to replace the Constants interface)
29+ * @LastModified: Jan 2020
3030 */
3131public final class Const {
3232
@@ -180,6 +180,18 @@ public final class Const {
180180 * */
181181 public static final short MINOR_13 = 0 ;
182182
183+ /** Major version number of class files for Java 14.
184+ * @see #MINOR_14
185+ * @since 6.4.0
186+ * */
187+ public static final short MAJOR_14 = 58 ;
188+
189+ /** Minor version number of class files for Java 14.
190+ * @see #MAJOR_14
191+ * @since 6.4.0
192+ * */
193+ public static final short MINOR_14 = 0 ;
194+
183195 /** Default major version number. Class file is for Java 1.1.
184196 * @see #MAJOR_1_1
185197 * */
@@ -199,12 +211,14 @@ public final class Const {
199211 public static final int MAX_BYTE = 255 ; // 2^8 - 1
200212
201213 /** One of the access flags for fields, methods, or classes.
202- * @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.5'>
203- * Flag definitions for Fields in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
204- * @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6'>
205- * Flag definitions for Methods in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
206- * @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1'>
207- * Flag definitions for Classes in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
214+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1'>
215+ * Flag definitions for Classes in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
216+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5'>
217+ * Flag definitions for Fields in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
218+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6'>
219+ * Flag definitions for Methods in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
220+ * @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1'>
221+ * Flag definitions for Inner Classes in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
208222 */
209223 public static final short ACC_PUBLIC = 0x0001 ;
210224
@@ -228,89 +242,123 @@ public final class Const {
228242 */
229243 public static final short ACC_FINAL = 0x0010 ;
230244
231- /** One of the access flags for fields, methods, or classes.
245+ /** One of the access flags for the Module attribute.
246+ * @see #ACC_PUBLIC
247+ */
248+ public static final short ACC_OPEN = 0x0020 ;
249+
250+ /** One of the access flags for classes.
251+ * @see #ACC_PUBLIC
252+ */
253+ public static final short ACC_SUPER = 0x0020 ;
254+
255+ /** One of the access flags for methods.
232256 * @see #ACC_PUBLIC
233257 */
234258 public static final short ACC_SYNCHRONIZED = 0x0020 ;
235259
236- /** One of the access flags for fields, methods, or classes .
260+ /** One of the access flags for the Module attribute .
237261 * @see #ACC_PUBLIC
238262 */
239- public static final short ACC_VOLATILE = 0x0040 ;
263+ public static final short ACC_TRANSITIVE = 0x0020 ;
240264
241- /** One of the access flags for fields, methods, or classes .
265+ /** One of the access flags for methods.
242266 * @see #ACC_PUBLIC
243267 */
244268 public static final short ACC_BRIDGE = 0x0040 ;
245269
246- /** One of the access flags for fields, methods, or classes.
270+ /** One of the access flags for the Module attribute.
271+ * @see #ACC_PUBLIC
272+ */
273+ public static final short ACC_STATIC_PHASE = 0x0040 ;
274+
275+ /** One of the access flags for fields.
276+ * @see #ACC_PUBLIC
277+ */
278+ public static final short ACC_VOLATILE = 0x0040 ;
279+
280+ /** One of the access flags for fields.
247281 * @see #ACC_PUBLIC
248282 */
249283 public static final short ACC_TRANSIENT = 0x0080 ;
250284
251- /** One of the access flags for fields, methods, or classes .
285+ /** One of the access flags for methods.
252286 * @see #ACC_PUBLIC
253287 */
254288 public static final short ACC_VARARGS = 0x0080 ;
255289
256- /** One of the access flags for fields, methods, or classes .
290+ /** One of the access flags for methods.
257291 * @see #ACC_PUBLIC
258292 */
259293 public static final short ACC_NATIVE = 0x0100 ;
260294
261- /** One of the access flags for fields, methods, or classes.
295+ /** One of the access flags for classes.
262296 * @see #ACC_PUBLIC
263297 */
264298 public static final short ACC_INTERFACE = 0x0200 ;
265299
266- /** One of the access flags for fields, methods, or classes.
300+ /** One of the access flags for methods or classes.
267301 * @see #ACC_PUBLIC
268302 */
269303 public static final short ACC_ABSTRACT = 0x0400 ;
270304
271- /** One of the access flags for fields, methods, or classes .
305+ /** One of the access flags for methods.
272306 * @see #ACC_PUBLIC
273307 */
274308 public static final short ACC_STRICT = 0x0800 ;
275309
276- /** One of the access flags for fields, methods, or classes .
310+ /** One of the access flags for fields, methods, classes, MethodParameter attribute, or Module attribute .
277311 * @see #ACC_PUBLIC
278312 */
279313 public static final short ACC_SYNTHETIC = 0x1000 ;
280314
281- /** One of the access flags for fields, methods, or classes.
315+ /** One of the access flags for classes.
282316 * @see #ACC_PUBLIC
283317 */
284318 public static final short ACC_ANNOTATION = 0x2000 ;
285319
286- /** One of the access flags for fields, methods, or classes.
320+ /** One of the access flags for fields or classes.
287321 * @see #ACC_PUBLIC
288322 */
289323 public static final short ACC_ENUM = 0x4000 ;
290324
291- /** One of the access flags for fields, methods, or classes.
325+ // Applies to classes compiled by new compilers only
326+ /** One of the access flags for MethodParameter or Module attributes.
292327 * @see #ACC_PUBLIC
293328 */
294329 public static final short ACC_MANDATED = (short ) 0x8000 ;
295330
296- // Applies to classes compiled by new compilers only
297- /** One of the access flags for fields, methods, or classes.
331+ /** One of the access flags for classes.
298332 * @see #ACC_PUBLIC
299333 */
300- public static final short ACC_SUPER = 0x0020 ;
334+ public static final short ACC_MODULE = ( short ) 0x8000 ;
301335
302336 /** One of the access flags for fields, methods, or classes.
303337 * @see #ACC_PUBLIC
338+ * @deprecated Use {@link #MAX_ACC_FLAG_I}
304339 */
340+ @ Deprecated
305341 public static final short MAX_ACC_FLAG = ACC_ENUM ;
306342
343+ /** One of the access flags for fields, methods, or classes.
344+ * ACC_MODULE is negative as a short.
345+ * @see #ACC_PUBLIC
346+ * @since 6.4.0
347+ */
348+ public static final int MAX_ACC_FLAG_I = 0x8000 ; // ACC_MODULE is negative as a short
349+
350+ // Note that do to overloading:
351+ // 'synchronized' is for methods, might be 'open' (if Module), 'super' (if class), or 'transitive' (if Module).
352+ // 'volatile' is for fields, might be 'bridge' (if method) or 'static_phase' (if Module)
353+ // 'transient' is for fields, might be 'varargs' (if method)
354+ // 'module' is for classes, might be 'mandated' (if Module or MethodParameters)
307355 /**
308356 * The names of the access flags.
309357 */
310358 private static final String [] ACCESS_NAMES = {
311359 "public" , "private" , "protected" , "static" , "final" , "synchronized" ,
312360 "volatile" , "transient" , "native" , "interface" , "abstract" , "strictfp" ,
313- "synthetic" , "annotation" , "enum"
361+ "synthetic" , "annotation" , "enum" , "module"
314362 };
315363
316364 /** @since 6.0 */
@@ -2279,8 +2327,13 @@ public static int getProduceStack(final int index) {
22792327 public static final byte ATTR_STACK_MAP_TABLE = 19 ;
22802328 public static final byte ATTR_BOOTSTRAP_METHODS = 20 ;
22812329 public static final byte ATTR_METHOD_PARAMETERS = 21 ;
2330+ public static final byte ATTR_MODULE = 22 ;
2331+ public static final byte ATTR_MODULE_PACKAGES = 23 ;
2332+ public static final byte ATTR_MODULE_MAIN_CLASS = 24 ;
2333+ public static final byte ATTR_NEST_HOST = 25 ;
2334+ public static final byte ATTR_NEST_MEMBERS = 26 ;
22822335
2283- public static final short KNOWN_ATTRIBUTES = 22 ; // count of attributes
2336+ public static final short KNOWN_ATTRIBUTES = 27 ; // count of attributes
22842337
22852338 private static final String [] ATTRIBUTE_NAMES = {
22862339 "SourceFile" , "ConstantValue" , "Code" , "Exceptions" ,
@@ -2290,7 +2343,8 @@ public static int getProduceStack(final int index) {
22902343 "RuntimeVisibleAnnotations" , "RuntimeInvisibleAnnotations" ,
22912344 "RuntimeVisibleParameterAnnotations" , "RuntimeInvisibleParameterAnnotations" ,
22922345 "AnnotationDefault" , "LocalVariableTypeTable" , "EnclosingMethod" , "StackMapTable" ,
2293- "BootstrapMethods" , "MethodParameters"
2346+ "BootstrapMethods" , "MethodParameters" , "Module" , "ModulePackages" ,
2347+ "ModuleMainClass" , "NestHost" , "NestMembers"
22942348 };
22952349
22962350 /**
0 commit comments