Class AsmDecompiler
java.lang.Object
org.codehaus.groovy.ast.decompiled.AsmDecompiler
Utility class responsible for decompiling JVM class files into
ClassStub objects that reflect their bytecode structure.
Uses ASM to parse compiled bytecode and extract class metadata including fields, methods, constructors, and annotations
without requiring access to source code.
Parsed stubs are cached using soft references indexed by URI, enabling efficient reuse across multiple
compilations in the same JVM and in test scenarios. The cache occasionally allows misses when multiple threads
simultaneously load the same class, but this is acceptable as it avoids serious memory issues.
The decompiler skips synthetic class initializers (<clinit>) and frame debug information during parsing.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassStubparseClass(URL url) Loads the URL contents and parses them with ASM, producing aClassStubobject representing the structure of the corresponding class file.
-
Constructor Details
-
AsmDecompiler
public AsmDecompiler()
-
-
Method Details
-
parseClass
Loads the URL contents and parses them with ASM, producing aClassStubobject representing the structure of the corresponding class file. Stubs are cached and reused if queried several times with equal URLs.- Parameters:
url- a URL from a class loader, most likely a file system file or a JAR entry- Returns:
- the class stub containing all extracted bytecode metadata
- Throws:
IOException- if reading from this URL is impossibleGroovyRuntimeException- if the URL cannot be converted to a valid URI
-