java.lang.Object
org.objectweb.asm.ClassVisitor
org.objectweb.asm.ClassWriter
simula.compiler.byteCodeEngineering.ExtendedClassWriter
public class ExtendedClassWriter
extends org.objectweb.asm.ClassWriter
Extended ClassWriter.
This class is introduced to compensate for a weakness in ASM ( https://asm.ow2.io/ ).
ClassWriter.getCommonSuperClass does not work because Global.tempClassFileDir is not present in java.class.path
Instead we use the information we have about all generated .class files to find common superclass of two types.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
Fields inherited from class org.objectweb.asm.ClassWriter
COMPUTE_FRAMES, COMPUTE_MAXS
Fields inherited from class org.objectweb.asm.ClassVisitor
api, cv
-
Constructor Summary
ConstructorDescriptionExtendedClassWriter
(org.objectweb.asm.ClassReader classReader, int flags) Create a new ExtendedClassWriter. -
Method Summary
Modifier and TypeMethodDescriptionprivate static JavaClassInfo
getClassInfo
(String type) Get class infoprotected String
getCommonSuperClass
(String type1, String type2) Returns the common super type of the two given types.Methods inherited from class org.objectweb.asm.ClassWriter
getClassLoader, hasFlags, newClass, newConst, newConstantDynamic, newField, newHandle, newHandle, newInvokeDynamic, newMethod, newMethodType, newModule, newNameType, newPackage, newUTF8, toByteArray, visit, visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitMethod, visitModule, visitNestHost, visitNestMember, visitOuterClass, visitPermittedSubclass, visitRecordComponent, visitSource, visitTypeAnnotation
Methods inherited from class org.objectweb.asm.ClassVisitor
getDelegate
-
Field Details
-
DEBUG
private static final boolean DEBUGDEBUG on/off- See Also:
-
-
Constructor Details
-
ExtendedClassWriter
public ExtendedClassWriter(org.objectweb.asm.ClassReader classReader, int flags) Create a new ExtendedClassWriter.- Parameters:
classReader
- theClassReader
used to read the original class.flags
- option flags that can be used to modify the default behavior of this class.
-
-
Method Details
-
getCommonSuperClass
Description copied from class:org.objectweb.asm.ClassWriter
Returns the common super type of the two given types. The default implementation of this method loads the two given classes and uses the java.lang.Class methods to find the common super class. It can be overridden to compute this common super type in other ways, in particular without actually loading any class, or to take into account the class that is currently being generated by this ClassWriter, which can of course not be loaded since it is under construction.- Overrides:
getCommonSuperClass
in classorg.objectweb.asm.ClassWriter
- Parameters:
type1
- the internal name of a class (seeType.getInternalName()
).type2
- the internal name of another class (seeType.getInternalName()
).- Returns:
- the internal name of the common super class of the two given classes (see
Type.getInternalName()
).
-
getClassInfo
Get class info- Parameters:
type
- the type- Returns:
- the resulting JavaClassInfo
-