Top Description Fields Constructors Methods
org.python.core

public Class AnnotationReader

extends ClassVisitor
Class Inheritance
Imports
java.io.IOException, .InputStream, org.objectweb.asm.AnnotationVisitor, .ClassReader, .ClassVisitor, .Opcodes

This class reads a classfile from a byte array and pulls out the value of the class annotation for APIVersion, which can then be retrieved by a call to getVersion(). Hopefully the use of ClassReader in this implementation is not too expensive. I suspect it is not since EmptyVisitor is just a bag of empty methods so shouldn't cost too much. If it turns out to cost too much, we will want to implement a special purpose ClassReader that only reads out the APIVersion annotation I think.

Field Summary

Modifier and TypeField and Description
private String
private long
private boolean
private boolean
private boolean
private int
Inherited from org.objectweb.asm.ClassVisitor:
apicv

Constructor Summary

AccessConstructor and Description
public
AnnotationReader(byte[] data)

Reads the classfile bytecode in data and to extract the version.

Method Summary

Modifier and TypeMethod and Description
public String
public long
public int
public AnnotationVisitor
visitAnnotation(String
the class descriptor of the annotation class.
desc
,
boolean
true if the annotation is visible at runtime.
visible
)

Overrides org.objectweb.asm.ClassVisitor.visitAnnotation.

Visits an annotation of the class.

Inherited from org.objectweb.asm.ClassVisitor:
getDelegatevisitvisitAttributevisitEndvisitFieldvisitInnerClassvisitMethodvisitModulevisitNestHostvisitNestMembervisitOuterClassvisitPermittedSubclassvisitRecordComponentvisitSourcevisitTypeAnnotation

Field Detail

filenameback to summary
private String filename
mtimeback to summary
private long mtime
nextVisitIsFilenameback to summary
private boolean nextVisitIsFilename
nextVisitIsMTimeback to summary
private boolean nextVisitIsMTime
nextVisitIsVersionback to summary
private boolean nextVisitIsVersion
versionback to summary
private int version

Constructor Detail

AnnotationReaderback to summary
public AnnotationReader(byte[] data) throws IOException

Reads the classfile bytecode in data and to extract the version.

Exceptions
IOException:
- if the classfile is malformed.

Method Detail

getFilenameback to summary
public String getFilename()
getMTimeback to summary
public long getMTime()
getVersionback to summary
public int getVersion()
visitAnnotationback to summary
public AnnotationVisitor visitAnnotation(String desc, boolean visible)

Overrides org.objectweb.asm.ClassVisitor.visitAnnotation.

Doc from org.objectweb.asm.ClassVisitor.visitAnnotation.

Visits an annotation of the class.

Parameters
desc:String

the class descriptor of the annotation class.

visible:boolean

true if the annotation is visible at runtime.

Returns:AnnotationVisitor

a visitor to visit the annotation values, or null if this visitor is not interested in visiting this annotation.

Annotations
@Override