@Override public void visitAttribute(final Attribute attribute) { checkState(); if (attribute == null) { throw new IllegalArgumentException("Invalid attribute (must not be null)"); } super.visitAttribute(attribute); }
@Override public void visitSource(final String file, final String debug) { checkState(); if (visitSourceCalled) { throw new IllegalStateException("visitSource can be called only once."); } visitSourceCalled = true; super.visitSource(file, debug); }
@Override public void visitAttribute(final Attribute attribute) { checkState(); if (attribute == null) { throw new IllegalArgumentException("Invalid attribute (must not be null)"); } super.visitAttribute(attribute); }
@Override public void visitSource(final String file, final String debug) { checkState(); if (source) { throw new IllegalStateException( "visitSource can be called only once."); } source = true; super.visitSource(file, debug); }
@Override public void visitAttribute(final Attribute attr) { checkState(); if (attr == null) { throw new IllegalArgumentException( "Invalid attribute (must not be null)"); } super.visitAttribute(attr); }
@Override public void visitSource(final String file, final String debug) { checkState(); if (visitSourceCalled) { throw new IllegalStateException("visitSource can be called only once."); } visitSourceCalled = true; super.visitSource(file, debug); }
@Override public void visitEnd() { checkState(); end = true; super.visitEnd(); }
@Override public void visitEnd() { checkState(); visitEndCalled = true; super.visitEnd(); }
@Override public void visitEnd() { checkState(); visitEndCalled = true; super.visitEnd(); }
@Override public void visitNestHost(final String nestHost) { checkState(); CheckMethodAdapter.checkInternalName(version, nestHost, "nestHost"); if (visitNestHostCalled) { throw new IllegalStateException("visitNestHost can be called only once."); } if (nestMemberPackageName != null) { throw new IllegalStateException("visitNestHost and visitNestMember are mutually exclusive."); } visitNestHostCalled = true; super.visitNestHost(nestHost); }
@Override public void visitNestHost(final String nestHost) { checkState(); CheckMethodAdapter.checkInternalName(version, nestHost, "nestHost"); if (visitNestHostCalled) { throw new IllegalStateException("visitNestHost can be called only once."); } if (nestMemberPackageName != null) { throw new IllegalStateException("visitNestHost and visitNestMember are mutually exclusive."); } visitNestHostCalled = true; super.visitNestHost(nestHost); }
@Override public void visitOuterClass(final String owner, final String name, final String descriptor) { checkState(); if (visitOuterClassCalled) { throw new IllegalStateException("visitOuterClass can be called only once."); } visitOuterClassCalled = true; if (owner == null) { throw new IllegalArgumentException("Illegal outer class owner"); } if (descriptor != null) { CheckMethodAdapter.checkMethodDescriptor(version, descriptor); } super.visitOuterClass(owner, name, descriptor); }
@Override public void visitOuterClass(final String owner, final String name, final String descriptor) { checkState(); if (visitOuterClassCalled) { throw new IllegalStateException("visitOuterClass can be called only once."); } visitOuterClassCalled = true; if (owner == null) { throw new IllegalArgumentException("Illegal outer class owner"); } if (descriptor != null) { CheckMethodAdapter.checkMethodDescriptor(version, descriptor); } super.visitOuterClass(owner, name, descriptor); }
@Override public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { checkState(); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter(super.visitAnnotation(descriptor, visible)); }
@Override public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { checkState(); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitAnnotation(desc, visible)); }
@Override public AnnotationVisitor visitTypeAnnotation(final int typeRef, final TypePath typePath, final String desc, final boolean visible) { checkState(); int sort = typeRef >>> 24; if (sort != TypeReference.CLASS_TYPE_PARAMETER && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND && sort != TypeReference.CLASS_EXTENDS) { throw new IllegalArgumentException("Invalid type reference sort 0x" + Integer.toHexString(sort)); } checkTypeRefAndPath(typeRef, typePath); CheckMethodAdapter.checkDesc(desc, false); return new CheckAnnotationAdapter(super.visitTypeAnnotation(typeRef, typePath, desc, visible)); }
@Override public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) { checkState(); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter(super.visitAnnotation(descriptor, visible)); }
@Override public ModuleVisitor visitModule(final String name, final int access, final String version) { checkState(); if (visitModuleCalled) { throw new IllegalStateException("visitModule can be called only once."); } visitModuleCalled = true; checkFullyQualifiedName(this.version, name, "module name"); checkAccess(access, Opcodes.ACC_OPEN | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_MANDATED); CheckModuleAdapter checkModuleAdapter = new CheckModuleAdapter( api, super.visitModule(name, access, version), (access & Opcodes.ACC_OPEN) != 0); checkModuleAdapter.classVersion = this.version; return checkModuleAdapter; }
@Override public ModuleVisitor visitModule(final String name, final int access, final String version) { checkState(); if (visitModuleCalled) { throw new IllegalStateException("visitModule can be called only once."); } visitModuleCalled = true; checkFullyQualifiedName(this.version, name, "module name"); checkAccess(access, Opcodes.ACC_OPEN | Opcodes.ACC_SYNTHETIC | Opcodes.ACC_MANDATED); CheckModuleAdapter checkModuleAdapter = new CheckModuleAdapter( api, super.visitModule(name, access, version), (access & Opcodes.ACC_OPEN) != 0); checkModuleAdapter.classVersion = this.version; return checkModuleAdapter; }
@Override public AnnotationVisitor visitTypeAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { checkState(); int sort = new TypeReference(typeRef).getSort(); if (sort != TypeReference.CLASS_TYPE_PARAMETER && sort != TypeReference.CLASS_TYPE_PARAMETER_BOUND && sort != TypeReference.CLASS_EXTENDS) { throw new IllegalArgumentException( "Invalid type reference sort 0x" + Integer.toHexString(sort)); } checkTypeRef(typeRef); CheckMethodAdapter.checkDescriptor(version, descriptor, false); return new CheckAnnotationAdapter( super.visitTypeAnnotation(typeRef, typePath, descriptor, visible)); }