public class Class extends GTVDeclarationContext implements AClassOrInterface, IItemWithOffset, Generic, GenericTypeInsertable
Modifier and Type | Field and Description |
---|---|
private Block |
class_block |
private Menge<Type> |
containedTypes |
private Menge<Field> |
fielddecl |
private GenericDeclarationList |
genericClassParameters |
protected static Logger |
inferencelog
Log4j - Loggerinstanzen
|
static boolean |
isFirstLocalVarDecl |
protected Modifiers |
modifiers |
protected java.lang.String |
name |
private int |
offset |
private java.util.Hashtable<java.lang.String,java.lang.String> |
parahash |
private SyntaxTreeNode |
parent |
protected UsedId |
pkgName |
private Type |
superClass |
UsedId |
superclassid |
private Menge<Type> |
superif |
private TypeAssumptions |
typeAssumptions |
protected Logger |
typinferenzLog |
private Menge<UsedId> |
usedIdsToCheck |
Constructor and Description |
---|
Class(java.lang.String name,
ClassBody cb,
Menge<Type> ct,
UsedId superclass,
Menge<Type> superif,
Menge<Type> paralist,
int offset) |
Class(java.lang.String name,
int offset) |
Class(java.lang.String name2,
Modifiers object,
ClassBody classBody,
Menge<Type> containedTypes2,
Menge<Type> typeMenge,
Menge<Type> paraMenge,
int offset2) |
Class(java.lang.String name,
Modifiers mod,
ClassBody cb,
Menge<Type> ct,
Menge<UsedId> usedIdsToCheck,
UsedId superclass,
Menge<UsedId> superif,
Menge<Type> paralist,
int offset) |
Class(java.lang.String name,
Modifiers mod,
ClassBody cb,
Menge<Type> ct,
Type superclass,
Menge<Type> Menge,
Menge<? extends Type> paralist,
int offset)
Konstruktor, der die Angabe aller Parameter ermoeglicht.
|
Class(java.lang.String name2,
Modifiers modifiers2,
ClassBody classBody,
Menge<Type> containedTypes2,
UsedId usedId,
Menge<Type> typeMenge,
Menge<Type> paraMenge,
int offset2) |
Class(java.lang.String name,
Modifiers mod,
int offset) |
Class(java.lang.String name,
RefType superClass,
Modifiers mod,
int offset) |
Class(java.lang.String name,
RefType superClass,
Modifiers modifiers,
Menge<java.lang.String> supertypeGenPara)
Erstellt eine Klasse, welche nur für die Assumptions verwendet wird.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(Field i) |
boolean |
does_Class_extend() |
boolean |
equals(java.lang.Object obj) |
Block |
get_class_block() |
java.util.Hashtable<java.lang.String,java.lang.String> |
get_ParaHash() |
Menge<? extends Type> |
get_ParaList() |
JavaClassName |
get_Superclass_Name() |
short |
getAccessFlags()
Liefert die AccessFlags fuer den Bytecode zurueck.
|
Menge<SyntaxTreeNode> |
getChildren() |
Menge<Type> |
getContainedTypes() |
java.lang.String |
getDescription()
Eine Beschreibung/Name des SyntaxTree-Nodes
|
Menge<Field> |
getFields() |
Menge<GenericTypeVar> |
getGenericParameter() |
int |
getGenericVarDeclarationOffset() |
java.lang.String |
getGenericVarDeclarationString(java.lang.String genericVarDeclaration) |
Modifiers |
getModifiers() |
JavaClassName |
getName() |
int |
getOffset()
Errechnet die Generischen Parameter der Klasse für diese Klasse.
|
UsedId |
getPackageName() |
SyntaxTreeNode |
getParent() |
private TypeAssumptions |
getPrivateFieldAssumptions()
Ermittelt alle privaten Felder und Methoden der Klasse und Erstellt eine Assumption für diese.
|
TypeAssumptions |
getPublicFieldAssumptions()
Ermittelt die Sichtbaren Felder und Methoden der Klasse.
|
java.lang.String |
getSimpleName()
HOTI
Liefert bei Klassen die fullyQualified angegeben wurden
nur den schlussendlichen Bezeichner
p.ex. de.dhbwstuttgart.typeinference.Menge => Menge
|
Type |
getSuperClass()
Die Super Klasse dieser Klasse.
|
Menge<Type> |
getSuperInterfaces() |
RefType |
getType()
Erstellt einen RefType, welcher auf diese Klasse verweist
Ersetzt alle Generischen Variablen in der Parameterliste mit TPH
|
java.lang.String |
getTypeInformation(Menge<Method> methodList,
Menge<Expr> fieldList) |
Menge<UsedId> |
getUsedIdsToCheck() |
int |
getVariableLength() |
boolean |
isClass() |
void |
parserPostProcessing(SyntaxTreeNode parent)
Wird nach dem Parsen aufgerufen.
|
java.lang.String |
printJavaCode(TypeinferenceResultSet reconstructionResult)
Generiert den JavaCode dieser Klasse im Falle für das übergebene resultSet.
|
void |
set_class_block(Block block) |
void |
set_ClassBody(ClassBody body)
Setzt den ClassBody dieser Klasse.
|
void |
set_ParaHash(java.util.Hashtable<java.lang.String,java.lang.String> hash) |
void |
set_UsedId(UsedId uid)
Generiert die ClassFile für diese Klasse.
|
void |
setContainedTypes(Menge<Type> containedTypes) |
void |
setGenericParameter(GenericDeclarationList params) |
void |
setModifiers(Modifiers mod) |
void |
setName(java.lang.String strName) |
void |
setPackageName(UsedId pkgName) |
void |
setSuperInterfaces(Menge<Type> superif) |
java.lang.String |
toString()
Author: Martin Pl�micke |
ConstraintsSet |
typeReconstruction(FC_TTO supportData,
TypeAssumptions globalAssumptions)
Ausgangspunkt f�r den Typrekonstruktionsalgorithmus.
|
private static Menge<Type> |
usedIdToRefType(Menge<UsedId> superif2) |
private static Type |
usedIdToRefType(UsedId superclass2) |
void |
wandleRefTypeAttributes2GenericAttributes()
Alle Methoden der Klassen überprüfen, ob sie als
RefType deklarierte Attribute haben, die aber GenericTypeVars sind
und ggf. ersetzen
Bsp.:
bei public E elementAt(i){...} wird E vorerst als RefType erkannt
|
getGTVDeclarationContext
addTypeInsertPoints, getMatchingParentNode, getParentClass, seesType
protected static Logger inferencelog
protected UsedId pkgName
protected Modifiers modifiers
protected java.lang.String name
public UsedId superclassid
private Block class_block
private java.util.Hashtable<java.lang.String,java.lang.String> parahash
public static boolean isFirstLocalVarDecl
private TypeAssumptions typeAssumptions
protected Logger typinferenzLog
private SyntaxTreeNode parent
private GenericDeclarationList genericClassParameters
private int offset
private Type superClass
public Class(java.lang.String name, int offset)
public Class(java.lang.String name, RefType superClass, Modifiers modifiers, Menge<java.lang.String> supertypeGenPara)
name
- superClass
- modifiers
- supertypeGenPara
- - Eine Liste von Namen, welche die Generischen Parameter der Klasse darstellen.public Class(java.lang.String name, Modifiers mod, int offset)
public Class(java.lang.String name, Modifiers mod, ClassBody cb, Menge<Type> ct, Menge<UsedId> usedIdsToCheck, UsedId superclass, Menge<UsedId> superif, Menge<Type> paralist, int offset)
public Class(java.lang.String name, ClassBody cb, Menge<Type> ct, UsedId superclass, Menge<Type> superif, Menge<Type> paralist, int offset)
public Class(java.lang.String name2, Modifiers modifiers2, ClassBody classBody, Menge<Type> containedTypes2, UsedId usedId, Menge<Type> typeMenge, Menge<Type> paraMenge, int offset2)
public Class(java.lang.String name2, Modifiers object, ClassBody classBody, Menge<Type> containedTypes2, Menge<Type> typeMenge, Menge<Type> paraMenge, int offset2)
public UsedId getPackageName()
public void setPackageName(UsedId pkgName)
public JavaClassName getName()
getName
in interface AClassOrInterface
public void setName(java.lang.String strName)
public void setModifiers(Modifiers mod)
public Modifiers getModifiers()
public short getAccessFlags()
public Menge<Type> getSuperInterfaces()
getSuperInterfaces
in interface AClassOrInterface
public void setSuperInterfaces(Menge<Type> superif)
setSuperInterfaces
in interface AClassOrInterface
public void addField(Field i)
feld
- public void set_UsedId(UsedId uid)
typeinferenceResult
- - Das ResultSet einer Typinferierung oder null, falls alle Typen eindeutig feststehen.JVMCodeException
- // ino.method.codegen.23071.definition
public ClassFile codegen(ResultSet typeinferenceResult)
throws JVMCodeException
// ino.end
// ino.method.codegen.23071.body
{
ClassFile classfile = new ClassFile();
String superClass;
// Handling der Superklasse
if(superclassid != null) {
superClass = superclassid.get_codegen_UsedId();
} else {
superClass = "java/lang/Object";
}
// Handling der Package
//String pkgName = "";
//if (sf.getPackageName() != null) {
// pkgName = sf.getPackageName().get_codegen_UsedId() + "/";
//}
//geändert von Andreas Stadelmeier: pkgName wird nicht mehr aus dem SourceFile ausgelesen:
String packageName = "";
if(pkgName != null) packageName = pkgName.get_Name_1Element();
classfile.add_class(getName(), superClass, getAccessFlags());
// Handling fuer Superinterfaces
classfile.addSuperInterfaces(getSuperInterfaces());
// Generics hinzufuegen - falls erforderlich
classfile.addGenerics(this.paralist,superclassid, this.getSuperInterfaces());
// Body der Classfile generieren
//if(body != null) {
this.codegen(classfile, this.paralist);
//}
// Ueberpruefung, ob Konstruktor generiert
// Falls nicht, default-Konstruktor erzeugen
if(!classfile.get_constructor_founded()) {
classfile.add_method("public void set_ClassBody(ClassBody body)
public void set_class_block(Block block)
public JavaClassName get_Superclass_Name()
public Block get_class_block()
public boolean does_Class_extend()
public void set_ParaHash(java.util.Hashtable<java.lang.String,java.lang.String> hash)
public java.util.Hashtable<java.lang.String,java.lang.String> get_ParaHash()
public ConstraintsSet typeReconstruction(FC_TTO supportData, TypeAssumptions globalAssumptions)
supportData
- globalAssumptions
- CTypeReconstructionException
private TypeAssumptions getPrivateFieldAssumptions()
public java.lang.String toString()
toString
in class java.lang.Object
public void wandleRefTypeAttributes2GenericAttributes()
public java.lang.String getSimpleName()
public java.lang.String getTypeInformation(Menge<Method> methodList, Menge<Expr> fieldList)
public java.lang.String printJavaCode(TypeinferenceResultSet reconstructionResult)
public int getOffset()
getOffset
in interface IItemWithOffset
reconstructionResult
- public void createGenericTypeVars(TypeinferenceResultSet reconstructionResult){
this.genericClassParameters = new Mengepublic RefType getType()
public TypeAssumptions getPublicFieldAssumptions()
public void parserPostProcessing(SyntaxTreeNode parent)
SyntaxTreeNode
parserPostProcessing
in class SyntaxTreeNode
public SyntaxTreeNode getParent()
getParent
in class SyntaxTreeNode
public Menge<SyntaxTreeNode> getChildren()
getChildren
in class SyntaxTreeNode
public boolean equals(java.lang.Object obj)
equals
in class SyntaxTreeNode
public Menge<GenericTypeVar> getGenericParameter()
getGenericParameter
in interface Generic
public java.lang.String getDescription()
SyntaxTreeNode
getDescription
in class SyntaxTreeNode
public int getVariableLength()
getVariableLength
in interface IItemWithOffset
public void setGenericParameter(GenericDeclarationList params)
setGenericParameter
in interface Generic
public java.lang.String getGenericVarDeclarationString(java.lang.String genericVarDeclaration)
getGenericVarDeclarationString
in interface GenericTypeInsertable
public int getGenericVarDeclarationOffset()
getGenericVarDeclarationOffset
in interface GenericTypeInsertable
public Type getSuperClass()
public boolean isClass()
isClass
in class GTVDeclarationContext