SourceReader
Class
This tool is for reading the bytecode of a class-file to gain special insights about elements. It is currently used only for scouring variable and parameter names, to make method documentation clearer.
In the future, this will also be used to identify simple getter/setter methods for fields and link them accordingly.
This may not be available in all distributions. ASM is not packaged by default.
Object
public
// Randomly-generated example
assert SourceReader.isAvailable();
SourceReader.getParameterNames(method);
SourceReader.getParameterNames(method);
Constructors
new SourceReader ()
ConstructorSourceReader
public
Methods
isAvailable ()
MethodWhether the source-reader tool is available.
Most of the tool methods are designed to check this and return some default value before an exception is thrown, but it may be worth checking here before using the class at all to avoid an exception being thrown.
boolean
public static
// Randomly-generated example
assert SourceReader.isAvailable();
getParameterNames (Method)
MethodScours the compiled source debug information for the pre-compile parameter names.
While these are supposed to be available to the JVM, the class-file structure changed after Java 1.6 and the JVM implementation was never updated.
This is a relatively slow operation.
Index | Type | Name |
---|---|---|
1 | Method | method |
String[]
public static
// Randomly-generated example
final String[] string = SourceReader.getParameterNames(method);
getParameterNames (Constructor)
MethodScours the compiled source debug information for the pre-compile parameter names.
While these are supposed to be available to the JVM, the class-file structure changed after Java 1.6 and the JVM implementation was never updated.
This is a relatively slow operation.
Index | Type | Name |
---|---|---|
1 | Constructor | method |
String[]
public static
// Randomly-generated example
final String[] string = SourceReader.getParameterNames(method);