< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/util/CheckClassAdapter.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch

*** 71,80 **** --- 71,81 ---- import jdk.internal.org.objectweb.asm.ClassReader; import jdk.internal.org.objectweb.asm.ClassVisitor; import jdk.internal.org.objectweb.asm.FieldVisitor; import jdk.internal.org.objectweb.asm.Label; import jdk.internal.org.objectweb.asm.MethodVisitor; + import jdk.internal.org.objectweb.asm.ModuleVisitor; import jdk.internal.org.objectweb.asm.Opcodes; import jdk.internal.org.objectweb.asm.Type; import jdk.internal.org.objectweb.asm.TypePath; import jdk.internal.org.objectweb.asm.TypeReference; import jdk.internal.org.objectweb.asm.tree.ClassNode;
*** 179,188 **** --- 180,194 ---- * <tt>true</tt> if the visitEnd method has been called. */ private boolean end; /** + * <tt>true</tt> if the visitModule method has been called. + */ + private boolean module; + + /** * The already visited labels. This map associate Integer values to Label * keys. */ private Map<Label, Integer> labels;
*** 361,371 **** * maxLocals and maxStack values. * @throws IllegalStateException * If a subclass calls this constructor. */ public CheckClassAdapter(final ClassVisitor cv, final boolean checkDataFlow) { ! this(Opcodes.ASM5, cv, checkDataFlow); if (getClass() != CheckClassAdapter.class) { throw new IllegalStateException(); } } --- 367,377 ---- * maxLocals and maxStack values. * @throws IllegalStateException * If a subclass calls this constructor. */ public CheckClassAdapter(final ClassVisitor cv, final boolean checkDataFlow) { ! this(Opcodes.ASM6, cv, checkDataFlow); if (getClass() != CheckClassAdapter.class) { throw new IllegalStateException(); } }
*** 372,382 **** /** * Constructs a new {@link CheckClassAdapter}. * * @param api * the ASM API version implemented by this visitor. Must be one ! * of {@link Opcodes#ASM4} or {@link Opcodes#ASM5}. * @param cv * the class visitor to which this adapter must delegate calls. * @param checkDataFlow * <tt>true</tt> to perform basic data flow checks, or * <tt>false</tt> to not perform any data flow check (see --- 378,388 ---- /** * Constructs a new {@link CheckClassAdapter}. * * @param api * the ASM API version implemented by this visitor. Must be one ! * of {@link Opcodes#ASM4}, {@link Opcodes#ASM5} or {@link Opcodes#ASM6}. * @param cv * the class visitor to which this adapter must delegate calls. * @param checkDataFlow * <tt>true</tt> to perform basic data flow checks, or * <tt>false</tt> to not perform any data flow check (see
*** 405,416 **** checkState(); checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER + Opcodes.ACC_INTERFACE + Opcodes.ACC_ABSTRACT + Opcodes.ACC_SYNTHETIC + Opcodes.ACC_ANNOTATION + Opcodes.ACC_ENUM ! + Opcodes.ACC_DEPRECATED + 0x40000); // ClassWriter.ACC_SYNTHETIC_ATTRIBUTE ! if (name == null || !name.endsWith("package-info")) { CheckMethodAdapter.checkInternalName(name, "class name"); } if ("java/lang/Object".equals(name)) { if (superName != null) { throw new IllegalArgumentException( --- 411,426 ---- checkState(); checkAccess(access, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER + Opcodes.ACC_INTERFACE + Opcodes.ACC_ABSTRACT + Opcodes.ACC_SYNTHETIC + Opcodes.ACC_ANNOTATION + Opcodes.ACC_ENUM ! + Opcodes.ACC_DEPRECATED + Opcodes.ACC_MODULE ! + 0x40000); // ClassWriter.ACC_SYNTHETIC_ATTRIBUTE ! if (name == null) { ! throw new IllegalArgumentException("Illegal class name (null)"); ! } ! if (!name.endsWith("package-info")) { CheckMethodAdapter.checkInternalName(name, "class name"); } if ("java/lang/Object".equals(name)) { if (superName != null) { throw new IllegalArgumentException(
*** 447,456 **** --- 457,482 ---- } source = true; super.visitSource(file, debug); } + @Override + public ModuleVisitor visitModule(String name, int access, String version) { + checkState(); + if (module) { + throw new IllegalStateException( + "visitModule can be called only once."); + } + module = true; + if (name == null) { + throw new IllegalArgumentException("Illegal module name (null)"); + } + checkAccess(access, Opcodes.ACC_OPEN | Opcodes.ACC_SYNTHETIC); + return new CheckModuleAdapter(super.visitModule(name, access, version), + (access & Opcodes.ACC_OPEN) != 0); + } + @Override public void visitOuterClass(final String owner, final String name, final String desc) { checkState(); if (outer) {
< prev index next >