src.org.python.expose.generate.RestrictiveAnnotationVisitor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jython Show documentation
Show all versions of jython Show documentation
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
package org.python.expose.generate;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Opcodes;
/**
* An Annotation visitor that throws an IllegalArgumentException if it visits anything other than
* visitEnd. Should be subclasses by something interested in only certain events.
*/
public class RestrictiveAnnotationVisitor extends AnnotationVisitor {
public RestrictiveAnnotationVisitor() {
super(Opcodes.ASM5);
}
public AnnotationVisitor visitAnnotation(String name, String desc) {
throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
}
public void visitEnd() {}
public AnnotationVisitor visitArray(String name) {
throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
}
public void visitEnum(String name, String desc, String value) {
throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
}
public void visit(String name, Object value) {
throw new IllegalArgumentException("Unknown annotation field '" + name + "'");
}
}