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.

Extends

Object

Modifiers

public

// Randomly-generated example
assert SourceReader.isAvailable();
SourceReader.getParameterNames(method);
SourceReader.getParameterNames(method);

Constructors


new SourceReader ()

Constructor
No description is available for this element.
Return Type

SourceReader

Modifiers

public


Methods


isAvailable ()

Method

Whether 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.

Return Type

boolean

Modifiers

public static

// Randomly-generated example
assert SourceReader.isAvailable();

getParameterNames (Method)

Method

Scours 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.

IndexTypeName
1Methodmethod
Return Type

String[]

Modifiers

public static

// Randomly-generated example
final String[] string = SourceReader.getParameterNames(method);

getParameterNames (Constructor)

Method

Scours 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.

IndexTypeName
1Constructormethod
Return Type

String[]

Modifiers

public static

// Randomly-generated example
final String[] string = SourceReader.getParameterNames(method);