--- old/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassVisitor.java Fri Oct 27 09:23:35 2017
+++ new/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassVisitor.java Fri Oct 27 09:23:35 2017
@@ -61,7 +61,7 @@
/**
* A visitor to visit a Java class. The methods of this class must be called in
* the following order: visit [ visitSource ] [
- * visitOuterClass ] ( visitAnnotation |
+ * visitModule ][ visitOuterClass ] ( visitAnnotation |
* visitTypeAnnotation | visitAttribute )* (
* visitInnerClass | visitField | visitMethod )*
* visitEnd.
@@ -72,7 +72,7 @@
/**
* The ASM API version implemented by this visitor. The value of this field
- * must be one of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
+ * must be one of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
protected final int api;
@@ -87,7 +87,7 @@
*
* @param api
* the ASM API version implemented by this visitor. Must be one
- * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
+ * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
*/
public ClassVisitor(final int api) {
this(api, null);
@@ -98,13 +98,13 @@
*
* @param api
* the ASM API version implemented by this visitor. Must be one
- * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}.
+ * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}.
* @param cv
* the class visitor to which this visitor must delegate method
* calls. May be null.
*/
public ClassVisitor(final int api, final ClassVisitor cv) {
- if (api != Opcodes.ASM4 && api != Opcodes.ASM5) {
+ if (api < Opcodes.ASM4 || api > Opcodes.ASM6) {
throw new IllegalArgumentException();
}
this.api = api;
@@ -160,6 +160,28 @@
}
}
+ /**
+ * Visit the module corresponding to the class.
+ * @param name
+ * module name
+ * @param access
+ * module flags, among {@code ACC_OPEN}, {@code ACC_SYNTHETIC}
+ * and {@code ACC_MANDATED}.
+ * @param version
+ * module version or null.
+ * @return a visitor to visit the module values, or null if
+ * this visitor is not interested in visiting this module.
+ */
+ public ModuleVisitor visitModule(String name, int access, String version) {
+ if (api < Opcodes.ASM6) {
+ throw new RuntimeException();
+ }
+ if (cv != null) {
+ return cv.visitModule(name, access, version);
+ }
+ return null;
+ }
+
/**
* Visits the enclosing class of the class. This method must be called only
* if the class has an enclosing class.