2013-10-18 11:33:46 +00:00
// ino.module.Class.8553.package
2014-09-02 08:33:54 +00:00
package de.dhbwstuttgart.syntaxtree ;
2013-10-18 11:33:46 +00:00
// ino.end
// ino.module.Class.8553.import
import java.util.ArrayList ;
import java.util.Collection ;
import java.util.Enumeration ;
import java.util.Hashtable ;
import java.util.Iterator ;
2015-05-21 15:10:04 +00:00
import org.apache.bcel.generic.ClassGen ;
2015-05-22 11:50:43 +00:00
import org.apache.bcel.generic.ConstantPoolGen ;
import org.apache.bcel.generic.InstructionFactory ;
import org.apache.bcel.generic.InstructionHandle ;
import org.apache.bcel.generic.InstructionList ;
import org.apache.bcel.generic.MethodGen ;
2015-05-21 15:10:04 +00:00
2015-04-22 19:40:22 +00:00
import de.dhbwstuttgart.typeinference.Menge ;
2014-02-09 15:07:31 +00:00
2014-10-09 10:01:16 +00:00
import de.dhbwstuttgart.logger.Logger ;
2014-10-09 15:38:10 +00:00
import de.dhbwstuttgart.logger.Section ;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.core.AClassOrInterface ;
import de.dhbwstuttgart.core.IItemWithOffset ;
2014-09-05 09:49:31 +00:00
import de.dhbwstuttgart.parser.JavaClassName ;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.syntaxtree.misc.UsedId ;
2014-09-05 09:49:31 +00:00
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers ;
2014-09-02 08:33:54 +00:00
import de.dhbwstuttgart.syntaxtree.statement.Block ;
import de.dhbwstuttgart.syntaxtree.statement.Expr ;
import de.dhbwstuttgart.syntaxtree.statement.Statement ;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar ;
import de.dhbwstuttgart.syntaxtree.type.RefType ;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType ;
import de.dhbwstuttgart.syntaxtree.type.Type ;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder ;
import de.dhbwstuttgart.syntaxtree.type.WildcardType ;
import de.dhbwstuttgart.typeinference.* ;
import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption ;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions ;
import de.dhbwstuttgart.typeinference.exceptions.DebugException ;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException ;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint ;
2014-09-02 09:07:16 +00:00
import de.dhbwstuttgart.typeinference.unify.FC_TTO ;
import de.dhbwstuttgart.typeinference.unify.Unify ;
2015-05-21 15:10:04 +00:00
import org.apache.bcel.generic.* ;
import org.apache.bcel.classfile.* ;
import org.apache.bcel.* ;
import java.io.* ;
2013-10-18 11:33:46 +00:00
2015-05-22 11:50:43 +00:00
2013-10-18 11:33:46 +00:00
// ino.class.Class.23010.declaration
2015-02-24 16:06:14 +00:00
public class Class extends GTVDeclarationContext implements AClassOrInterface , IItemWithOffset , Generic , GenericTypeInsertable
2013-10-18 11:33:46 +00:00
// ino.end
// ino.class.Class.23010.body
{
2014-02-12 01:12:12 +00:00
/ * *
* Log4j - Loggerinstanzen
* /
protected static Logger inferencelog = Logger . getLogger ( " inference " ) ;
2014-10-09 15:38:10 +00:00
//protected static Logger codegenlog = Logger.getLogger("codegen");
//protected static Logger parserlog = Logger.getLogger("parser");
2014-02-12 01:12:12 +00:00
protected UsedId pkgName ;
protected Modifiers modifiers ;
protected String name ;
2015-05-22 11:50:43 +00:00
//For ByteCode Construction
private InstructionFactory _factory ;
private ConstantPoolGen _cp ;
private ClassGen _cg ;
2015-05-21 15:10:04 +00:00
2015-05-22 11:50:43 +00:00
//Method created with BCEL to generate ByteCode
public ByteCodeResult genByteCode ( ) throws IOException {
ByteCodeResult code = new ByteCodeResult ( ) ;
_cg = new ClassGen ( pkgName . get_Name ( ) + " / " + name , superClass . get_Name ( ) , name + " .java " , Constants . ACC_PUBLIC , new String [ ] { } ) ; //new String necessary?
_cp = _cg . getConstantPool ( ) ;
_factory = new InstructionFactory ( _cg , _cp ) ;
ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ;
InstructionList il = new InstructionList ( ) ;
MethodGen method = new MethodGen ( Constants . ACC_PUBLIC , org . apache . bcel . generic . Type . VOID , org . apache . bcel . generic . Type . NO_ARGS , new String [ ] { } , " <init> " , " bceltesting.leer " , il , _cp ) ;
InstructionHandle ih_0 = il . append ( _factory . createLoad ( org . apache . bcel . generic . Type . OBJECT , 0 ) ) ; //creates Constructor
il . append ( _factory . createInvoke ( " java.lang.Object " , " <init> " , org . apache . bcel . generic . Type . VOID , org . apache . bcel . generic . Type . NO_ARGS , Constants . INVOKESPECIAL ) ) ;
InstructionHandle ih_4 = il . append ( _factory . createReturn ( org . apache . bcel . generic . Type . VOID ) ) ; //creates Constructor
method . setMaxStack ( ) ;
method . setMaxLocals ( ) ;
_cg . addMethod ( method . getMethod ( ) ) ;
il . dispose ( ) ;
_cg . getJavaClass ( ) . dump ( out ) ;
code . attach ( out . toString ( ) ) ;
return code ;
/ * ByteCodeResult bc = new ByteCodeResult ( ) ;
2015-05-21 15:10:04 +00:00
_cg = new ClassGen ( pkgName . get_Name ( ) + " / " + name , superClass . get_Name ( ) , name + " .java " , Constants . ACC_PUBLIC , new String [ ] { } ) ;
//_cg zur<75> ckgeben
bc . append ( BCELByteCodeOutput ) ;
2015-05-22 11:50:43 +00:00
return _cg ; * /
}
2014-02-12 01:12:12 +00:00
2015-04-22 19:40:22 +00:00
private Menge < Type > superif = new Menge < Type > ( ) ;
2014-02-12 01:12:12 +00:00
public UsedId getPackageName ( )
{
return pkgName ;
}
public void setPackageName ( UsedId pkgName )
{
this . pkgName = pkgName ;
}
2014-09-02 16:49:19 +00:00
public JavaClassName getName ( )
2014-02-12 01:12:12 +00:00
{
2014-09-02 16:49:19 +00:00
return new JavaClassName ( ( this . pkgName ! = null ? this . pkgName . toString ( ) + " . " : " " ) + this . name ) ;
2014-02-12 01:12:12 +00:00
}
public void setName ( String strName )
{
name = strName ;
}
public void setModifiers ( Modifiers mod )
{
this . modifiers = mod ;
}
public Modifiers getModifiers ( )
{
return this . modifiers ;
}
/ * *
* Liefert die AccessFlags fuer den Bytecode zurueck .
* /
public short getAccessFlags ( )
{
short ret = 0 ;
if ( modifiers ! = null ) {
ret = modifiers . calculate_access_flags ( ) ;
}
return ret ;
}
2014-09-14 16:38:43 +00:00
2015-04-22 19:40:22 +00:00
public Menge < Type > getSuperInterfaces ( )
2014-02-12 01:12:12 +00:00
{
return superif ;
}
2014-09-14 16:38:43 +00:00
2014-09-18 14:26:02 +00:00
@Override
2015-04-22 19:40:22 +00:00
public void setSuperInterfaces ( Menge < Type > superif )
2014-02-12 01:12:12 +00:00
{
this . superif = superif ;
}
2013-10-18 11:33:46 +00:00
// ino.attribute.superclassid.23014.decldescription type=line
// private Status status;
// ino.end
// ino.attribute.superclassid.23014.declaration
public UsedId superclassid = ( SourceFile . READ_OBJECT_SUPERCLASSES_FROM_JRE ? UsedId . createFromQualifiedName ( " Object " , - 1 ) : null ) ;
// ino.end
// ino.attribute.class_block.23020.decldescription type=line
// private Class java;
// ino.end
// ino.attribute.class_block.23020.declaration
private Block class_block ;
// ino.end
// ino.attribute.paralist.23023.declaration
2015-04-22 19:40:22 +00:00
//private Menge<Type> paralist = new Menge<Type>(); // Parameterliste 'class xy<para1, para2,...>{}' wird gespeichert
2013-10-18 11:33:46 +00:00
// ino.end
// ino.attribute.parahash.23026.declaration
private Hashtable < String , String > parahash = new Hashtable < String , String > ( ) ; // parametrisierten Attrib. werden mit den Paramet.aus paralist verk.
// ino.end
// ino.attribute.isFirstLocalVarDecl.23029.declaration
public static boolean isFirstLocalVarDecl ; //Hilfsvariable fuer Offsets, hoth
// ino.end
2015-04-22 19:40:22 +00:00
//private Menge<GenericTypeVar> genericClassParameters=new Menge<GenericTypeVar>();
2013-10-18 11:33:46 +00:00
// ino.attribute.containedTypes.23032.decldescription type=line
// PL 05-07-30 eingefuegt. Vektor aller Typdeklarationen, die in der Klasse
2015-05-12 17:49:27 +00:00
// vorkommen. Wird in der Studienarbeit von Andreas Stadelmeier nur für Verifizierung der Tests eingesetzt.
2013-10-18 11:33:46 +00:00
// ino.end
// ino.attribute.containedTypes.23032.declaration
2015-04-22 19:40:22 +00:00
private Menge < Type > containedTypes = new Menge < Type > ( ) ;
2013-10-18 11:33:46 +00:00
// ino.end
// ino.attribute.usedIdsToCheck.23035.declaration
2015-04-22 19:40:22 +00:00
private Menge < UsedId > usedIdsToCheck = new Menge < UsedId > ( ) ;
2013-10-18 11:33:46 +00:00
// ino.end
2015-05-12 17:49:27 +00:00
private TypeAssumptions typeAssumptions = null ; //muss mit null Initialisiert werden. Darf nur über getTypeAssumptions abgerufen werden.
2013-10-18 11:33:46 +00:00
// ino.attribute.parserlog.23038.declaration
2014-10-09 15:38:10 +00:00
//protected Logger parselog = Logger.getLogger("parser");
2013-10-18 11:33:46 +00:00
// ino.end
2014-10-09 15:38:10 +00:00
protected Logger typinferenzLog = Logger . getLogger ( Class . class . getName ( ) ) ;
2014-02-11 15:30:38 +00:00
private SyntaxTreeNode parent ;
2015-04-22 19:40:22 +00:00
private Menge < Field > fielddecl = new Menge < Field > ( ) ;
2014-06-25 15:30:31 +00:00
private GenericDeclarationList genericClassParameters ;
2014-07-16 12:35:12 +00:00
private int offset ;
2014-09-18 14:26:02 +00:00
private Type superClass ;
2013-10-18 11:33:46 +00:00
// ino.method.Class.23041.definition
2014-07-16 12:35:12 +00:00
public Class ( String name , int offset )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.Class.23041.body
{
2014-02-12 01:12:12 +00:00
this . name = name ;
2013-10-18 11:33:46 +00:00
if ( name . equals ( " java.lang.Object " ) ) {
superclassid = null ;
}
2014-07-16 12:35:12 +00:00
this . offset = offset ;
2015-05-12 17:49:27 +00:00
if ( ! name . equals ( " Object " ) ) //Alle Klassen auà er Object erben von Object:
2014-09-18 14:26:02 +00:00
this . superClass = new Class ( " Object " , - 1 ) . getType ( ) ;
2013-10-18 11:33:46 +00:00
}
// ino.end
2014-10-07 13:36:18 +00:00
/ * *
2015-05-12 17:49:27 +00:00
* Erstellt eine Klasse , welche nur fà ¼ r die Assumptions verwendet wird .
* Sie enthà ¤ lt keine unnà ¶ tigen Informationen , wie Offset oder ClassBody .
2014-10-07 13:36:18 +00:00
* @param name
* @param superClass
* @param modifiers
* @param supertypeGenPara - Eine Liste von Namen , welche die Generischen Parameter der Klasse darstellen .
* /
public Class ( String name , RefType superClass , Modifiers modifiers ,
2015-04-22 19:40:22 +00:00
Menge < String > supertypeGenPara ) {
2014-10-07 13:36:18 +00:00
this ( name , superClass , modifiers , 0 ) ;
if ( supertypeGenPara = = null ) return ;
2015-04-22 19:40:22 +00:00
Menge < GenericTypeVar > gtvs = new Menge < > ( ) ;
2014-10-07 13:36:18 +00:00
for ( String gname : supertypeGenPara ) {
GenericTypeVar newGTV = new GenericTypeVar ( gname , this , 0 ) ;
gtvs . add ( newGTV ) ;
}
2015-02-03 14:58:04 +00:00
this . setGenericParameter ( new GenericDeclarationList ( gtvs , 0 ) ) ;
2014-10-07 13:36:18 +00:00
}
2014-10-01 15:12:16 +00:00
public Class ( String name , RefType superClass , Modifiers mod , int offset ) {
this ( name , mod , offset ) ;
2014-10-08 17:00:17 +00:00
if ( superClass = = null ) this . superClass = new Class ( " Object " , - 1 ) . getType ( ) ;
2015-04-08 19:23:28 +00:00
else this . superClass = superClass ;
2014-09-14 16:38:43 +00:00
}
2013-10-18 11:33:46 +00:00
// ino.method.Class.23044.definition
2014-07-16 12:35:12 +00:00
public Class ( String name , Modifiers mod , int offset )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.Class.23044.body
{
2014-09-16 09:31:15 +00:00
this ( name , offset ) ;
2014-02-12 01:12:12 +00:00
this . modifiers = mod ;
2013-10-18 11:33:46 +00:00
}
// ino.end
2015-04-22 19:40:22 +00:00
public Class ( String name , Modifiers mod , ClassBody cb , Menge < Type > ct , Menge < UsedId > usedIdsToCheck ,
UsedId superclass , Menge < UsedId > superif , Menge < Type > paralist , int offset ) {
2014-09-18 14:26:02 +00:00
this ( name , mod , cb , ct , usedIdToRefType ( superclass ) , usedIdToRefType ( superif ) , paralist , offset ) ;
}
2015-04-22 19:40:22 +00:00
public Class ( String name , ClassBody cb , Menge < Type > ct ,
UsedId superclass , Menge < Type > superif , Menge < Type > paralist , int offset ) {
2014-09-18 14:26:02 +00:00
this ( name , null , cb , ct , usedIdToRefType ( superclass ) , superif , paralist , offset ) ;
}
public Class ( String name2 , Modifiers modifiers2 , ClassBody classBody ,
2015-04-22 19:40:22 +00:00
Menge < Type > containedTypes2 , UsedId usedId ,
Menge < Type > typeMenge , Menge < Type > paraMenge , int offset2 ) {
this ( name2 , modifiers2 , classBody , containedTypes2 , usedIdToRefType ( usedId ) , typeMenge , paraMenge , offset2 ) ;
2014-09-18 14:26:02 +00:00
}
public Class ( String name2 , Modifiers object , ClassBody classBody ,
2015-04-22 19:40:22 +00:00
Menge < Type > containedTypes2 , Menge < Type > typeMenge ,
Menge < Type > paraMenge , int offset2 ) {
this ( name2 , object , classBody , containedTypes2 , ( Type ) null , typeMenge , paraMenge , offset2 ) ;
2014-09-18 14:26:02 +00:00
}
2015-04-22 19:40:22 +00:00
private static Menge < Type > usedIdToRefType ( Menge < UsedId > superif2 ) {
Menge < Type > ret = new Menge < > ( ) ;
2014-09-18 14:26:02 +00:00
for ( UsedId id : superif2 ) ret . add ( usedIdToRefType ( id ) ) ;
return ret ;
}
private static Type usedIdToRefType ( UsedId superclass2 ) {
RefType ret = new RefType ( superclass2 . getSimpleName ( ) , null , superclass2 . getOffset ( ) ) ;
ret . set_ParaList ( superclass2 . get_ParaList ( ) ) ;
return ret ;
}
// ino.method.Class.23047.defdescription type=javadoc
2013-10-18 11:33:46 +00:00
/ * *
* Konstruktor , der die Angabe aller Parameter ermoeglicht .
* Zur Uebersichtlichkeit in der Grammatik .
* /
// ino.end
// ino.method.Class.23047.definition
2015-04-22 19:40:22 +00:00
public Class ( String name , Modifiers mod , ClassBody cb , Menge < Type > ct ,
Type superclass , Menge < Type > Menge , Menge < ? extends Type > paralist , int offset )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.Class.23047.body
{
2014-09-16 09:31:15 +00:00
this ( name , offset ) ;
2014-02-12 01:12:12 +00:00
this . modifiers = mod ;
2013-10-18 11:33:46 +00:00
if ( cb ! = null ) set_ClassBody ( cb ) ;
if ( ct ! = null ) setContainedTypes ( ct ) ;
2014-09-16 09:31:15 +00:00
if ( superclass ! = null ) {
2014-09-18 14:26:02 +00:00
this . superClass = superclass ;
2014-09-16 09:31:15 +00:00
}
2015-04-22 19:40:22 +00:00
if ( Menge ! = null ) setSuperInterfaces ( Menge ) ;
2015-02-03 11:24:40 +00:00
if ( paralist ! = null & & ! paralist . isEmpty ( ) ) {
Type lastPara = paralist . lastElement ( ) ;
Integer lastItemOffset = lastPara . getOffset ( ) + lastPara . get_Name ( ) . length ( ) ;
2015-04-22 19:40:22 +00:00
this . setGenericParameter ( new GenericDeclarationList ( ( Menge < GenericTypeVar > ) paralist , lastItemOffset ) ) ;
2015-02-03 11:24:40 +00:00
/ *
2014-10-08 17:00:17 +00:00
//this.set_ParaList(paralist);
2015-04-22 19:40:22 +00:00
Menge < GenericTypeVar > gtvList = new Menge < > ( ) ;
2014-10-08 17:00:17 +00:00
int lastItemOffset = 0 ;
for ( Type paraT : paralist ) {
GenericTypeVar gtv = new GenericTypeVar ( paraT . get_Name ( ) , this , paraT . getOffset ( ) ) ;
gtvList . add ( gtv ) ;
lastItemOffset = paraT . getOffset ( ) + paraT . get_Name ( ) . length ( ) ;
}
this . genericClassParameters = new GenericDeclarationList ( gtvList , lastItemOffset ) ;
2015-02-03 11:24:40 +00:00
* /
2014-09-16 09:31:15 +00:00
}
2013-10-18 11:33:46 +00:00
if ( usedIdsToCheck ! = null ) this . usedIdsToCheck = usedIdsToCheck ;
// HOTI 10.5.06
// Object darf natuerlich nicht Object als Superklasse haben
// Sonst gibt es eine endlosaufloesung
if ( name . equals ( " java.lang.Object " ) ) {
superclassid = null ;
}
2014-09-16 09:31:15 +00:00
2013-10-18 11:33:46 +00:00
2014-10-09 15:38:10 +00:00
//parserlog.debug("Neue Klasse: " + name);
2013-10-18 11:33:46 +00:00
}
// ino.end
2014-09-18 14:26:02 +00:00
2015-04-22 19:40:22 +00:00
public Menge < Field > getFields ( )
2014-02-14 16:31:55 +00:00
{
return fielddecl ;
}
/ * *
* @author Andreas Stadelmeier , a10023
2015-05-12 17:49:27 +00:00
* FÃ ¼ gt der Klasse eine Feld hinzu .
* Prà ¼ ft dabei , ob es sich um einen Constructor handelt und wandelt diesen direkt um .
2014-02-14 16:31:55 +00:00
* @param feld
* /
public void addField ( Field i )
{
2014-02-19 16:32:43 +00:00
fielddecl . addElement ( i ) ;
2014-02-14 16:31:55 +00:00
}
2013-10-18 11:33:46 +00:00
// ino.method.getUsedIdsToCheck.23050.definition
2015-04-22 19:40:22 +00:00
public Menge < UsedId > getUsedIdsToCheck ( )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.getUsedIdsToCheck.23050.body
{
return usedIdsToCheck ;
}
// ino.end
// ino.method.setContainedTypes.23053.definition
2015-04-22 19:40:22 +00:00
public void setContainedTypes ( Menge < Type > containedTypes )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.setContainedTypes.23053.body
{
this . containedTypes = containedTypes ;
}
// ino.end
// ino.method.getContainedTypes.23056.definition
2015-04-22 19:40:22 +00:00
public Menge < Type > getContainedTypes ( )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.getContainedTypes.23056.body
{
return containedTypes ;
}
// ino.end
2014-10-08 17:00:17 +00:00
/ *
2013-10-18 11:33:46 +00:00
// ino.method.complete_paralist.23062.definition
2015-04-22 19:40:22 +00:00
public Menge < Type > complete_paralist ( boolean ext )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.complete_paralist.23062.body
{
2015-05-12 17:49:27 +00:00
//Diese Funktion vervollt�ndigt die Parameterliste f�r vererbte Klassen
2015-04-22 19:40:22 +00:00
Menge < Type > child = paralist ;
2013-10-18 11:33:46 +00:00
2015-04-22 19:40:22 +00:00
paralist = ( Menge < Type > ) superclassid . get_ParaList ( ) ;
2013-10-18 11:33:46 +00:00
for ( Enumeration < Type > e = child . elements ( ) ; e . hasMoreElements ( ) ; ) {
paralist . addElement ( e . nextElement ( ) ) ;
}
return this . paralist ;
}
// ino.end
2014-10-08 17:00:17 +00:00
* /
2013-10-18 11:33:46 +00:00
2014-03-12 15:32:50 +00:00
/ * *
2015-05-12 17:49:27 +00:00
* Generiert die ClassFile fà ¼ r diese Klasse .
2014-03-12 15:32:50 +00:00
* @param typeinferenceResult - Das ResultSet einer Typinferierung oder null , falls alle Typen eindeutig feststehen .
* @return
* @throws JVMCodeException
2014-09-02 16:49:19 +00:00
2013-10-18 11:33:46 +00:00
// ino.method.codegen.23071.definition
2014-03-12 15:32:50 +00:00
public ClassFile codegen ( ResultSet typeinferenceResult )
2013-10-18 11:33:46 +00:00
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
2014-03-12 15:32:50 +00:00
//String pkgName = "";
//if (sf.getPackageName() != null) {
// pkgName = sf.getPackageName().get_codegen_UsedId() + "/";
//}
2013-10-18 11:33:46 +00:00
2015-05-12 17:49:27 +00:00
//geändert von Andreas Stadelmeier: pkgName wird nicht mehr aus dem SourceFile ausgelesen:
2014-03-12 17:28:30 +00:00
String packageName = " " ;
if ( pkgName ! = null ) packageName = pkgName . get_Name_1Element ( ) ;
2014-09-02 16:49:19 +00:00
classfile . add_class ( getName ( ) , superClass , getAccessFlags ( ) ) ;
2013-10-18 11:33:46 +00:00
// Handling fuer Superinterfaces
classfile . addSuperInterfaces ( getSuperInterfaces ( ) ) ;
// Generics hinzufuegen - falls erforderlich
classfile . addGenerics ( this . paralist , superclassid , this . getSuperInterfaces ( ) ) ;
// Body der Classfile generieren
2014-02-14 16:31:55 +00:00
//if(body != null) {
this . codegen ( classfile , this . paralist ) ;
//}
2013-10-18 11:33:46 +00:00
// Ueberpruefung, ob Konstruktor generiert
// Falls nicht, default-Konstruktor erzeugen
if ( ! classfile . get_constructor_founded ( ) ) {
classfile . add_method ( " <init> " , " ()V " , null , null , null , ( short ) 0 , this . paralist , false ) ;
}
2014-03-12 15:32:50 +00:00
//classfile.codegen();
2013-10-18 11:33:46 +00:00
codegenlog . info ( " Compilierung erfolgreich abgeschlossen, " + getName ( ) + " .class erstellt. " ) ;
2014-03-12 15:32:50 +00:00
return classfile ;
2013-10-18 11:33:46 +00:00
}
2014-09-02 16:49:19 +00:00
* /
2014-09-05 09:49:31 +00:00
2013-10-18 11:33:46 +00:00
public void set_UsedId ( UsedId uid )
// ino.end
// ino.method.set_UsedId.23074.body
{
this . superclassid = uid ;
}
// ino.end
2014-02-14 16:31:55 +00:00
/ * *
2015-05-12 17:49:27 +00:00
* Setzt den ClassBody dieser Klasse . Wird zum Parsen benà ¶ tigt .
* Der ClassBody enthà ¤ lt sà ¤ mtliche Felder dieser Klasse .
* Mit dem Aufruf dieser Methode werden alle Felder des ClassBody in diese Class à ¼ bertragen .
* ( Nur einmal wà ¤ hrend des Parsens aufrufen ! )
2014-02-14 16:31:55 +00:00
* /
2013-10-18 11:33:46 +00:00
public void set_ClassBody ( ClassBody body )
{
2015-04-22 19:40:22 +00:00
Menge < Field > tempFields = body . getFields ( ) ;
2014-02-14 16:31:55 +00:00
for ( Field f : this . getFields ( ) ) {
2015-05-12 17:49:27 +00:00
if ( f instanceof Method ) { //Wenn es sich um eine Methode handelt ist eine zusätzliche Prüfung erfoderlich: (Ist es ein Konstruktor?)
2014-02-14 16:31:55 +00:00
Method m = ( Method ) f ;
/ *
* Ermitteln ob es sich bei der Methode um einen Konstruktor handelt :
* ( Parser kann nicht zwischen Methode und Konstruktor unterscheiden .
2015-05-12 17:49:27 +00:00
* Denn fà ¼ r einen Konstruktor gelten besondere Regeln :
2014-02-14 16:31:55 +00:00
* - Typ des Blocks eines Konstruktor ist void ( kein Return - Statement )
2015-05-12 17:49:27 +00:00
* - RÃ ¼ ckgabetyp der Methode / Konstruktors ist der Typ der Klasse
2014-02-14 16:31:55 +00:00
* - Ein Konstruktor kann nicht aufgerufen werden ( nur mit new )
* /
2015-05-12 17:49:27 +00:00
if ( m . get_Method_Name ( ) . equals ( " <init> " ) ) throw new TypeinferenceException ( " <init> ist kein gültiger Methodenname " , m ) ;
2014-02-14 16:31:55 +00:00
if ( ( m . get_Method_Name ( ) . equals ( this . getName ( ) ) ) ) {
Constructor constructor = new Constructor ( m ) ;
2015-05-12 17:49:27 +00:00
tempFields . add ( constructor ) ; //Den Konstruktor anstatt der Methode anfügen
2014-02-14 16:31:55 +00:00
} else {
2015-05-12 17:49:27 +00:00
//Handelt es sich um keinen Konstruktor, dann die Methode unverändert den Feldern hinzufügen:
2014-02-14 16:31:55 +00:00
tempFields . add ( m ) ;
}
} else {
2015-05-12 17:49:27 +00:00
tempFields . add ( f ) ; //Ansonsten das Feld anfügen...
2014-02-14 16:31:55 +00:00
}
}
this . fielddecl = tempFields ;
2013-10-18 11:33:46 +00:00
}
// ino.method.set_class_block.23080.definition
public void set_class_block ( Block block )
// ino.end
// ino.method.set_class_block.23080.body
{
this . class_block = block ;
}
// ino.end
2014-02-11 01:47:39 +00:00
2013-10-18 11:33:46 +00:00
// ino.method.get_Superclass_Name.23086.definition
2014-09-02 16:49:19 +00:00
public JavaClassName get_Superclass_Name ( )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.get_Superclass_Name.23086.body
{
if ( superclassid ! = null )
return superclassid . getQualifiedName ( ) ;
else
return null ;
}
// ino.end
2014-02-14 16:31:55 +00:00
2013-10-18 11:33:46 +00:00
// ino.method.get_class_block.23092.definition
public Block get_class_block ( )
// ino.end
// ino.method.get_class_block.23092.body
{
return class_block ;
}
// ino.end
// ino.method.does_Class_extend.23095.definition
public boolean does_Class_extend ( )
// ino.end
// ino.method.does_Class_extend.23095.body
{
if ( superclassid = = null )
return false ;
else
return true ;
}
// ino.end
2014-10-08 17:00:17 +00:00
/ *
2013-10-18 11:33:46 +00:00
// ino.method.set_ParaList.23098.definition
2015-04-22 19:40:22 +00:00
public void set_ParaList ( Menge < Type > para )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.set_ParaList.23098.body
{
this . paralist = para ;
}
// ino.end
2014-10-08 17:00:17 +00:00
* /
2013-10-18 11:33:46 +00:00
// ino.method.get_ParaList.23101.definition
2015-04-22 19:40:22 +00:00
public Menge < ? extends Type > get_ParaList ( )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.get_ParaList.23101.body
{
2015-04-22 19:40:22 +00:00
//if(this.paralist == null)return new Menge<Type>();
2014-10-08 17:00:17 +00:00
return this . getGenericParameter ( ) ;
2013-10-18 11:33:46 +00:00
}
// ino.end
// ino.method.set_ParaHash.23104.definition
public void set_ParaHash ( Hashtable < String , String > hash )
// ino.end
// ino.method.set_ParaHash.23104.body
{
this . parahash = hash ;
}
// ino.end
// ino.method.get_ParaHash.23107.definition
public Hashtable < String , String > get_ParaHash ( )
// ino.end
// ino.method.get_ParaHash.23107.body
{
return this . parahash ;
}
// ino.end
/ * static void string_rec ( Hashtable ht ) {
String record = " " ;
boolean isError = false ;
record = record . concat ( " [ " ) ;
for ( Enumeration e = ht . elements ( ) , k = ht . keys ( ) ; e . hasMoreElements ( ) ; ) {
String s = ( String ) k . nextElement ( ) ;
Object o = e . nextElement ( ) ;
record = record . concat ( " " + s ) ;
if ( o instanceof Type ) {
record = record . concat ( " = " + ( ( Type ) o ) . getName ( ) ) ;
} else if ( o instanceof Hashtable ) {
record = record . concat ( " = " ) ;
string_rec ( ( Hashtable ) o ) ;
if ( e . hasMoreElements ( ) )
record = record . concat ( " , " ) ;
} else if ( o instanceof String ) {
record = record . concat ( " = " + o ) ;
if ( e . hasMoreElements ( ) )
record = record . concat ( " , " ) ;
}
else {
record = ( " [ FEHLER : string_rec : unbekannter Typ ! ! ! ! ! ! " );
isError = true ;
}
}
record = record . concat ( " ] " ) ;
if ( isError ) {
parserlog . error ( record ) ;
} else {
parserlog . debug ( record ) ;
}
} * /
2015-04-22 19:40:22 +00:00
/ * static void string_rec ( Menge v ) {
2013-10-18 11:33:46 +00:00
String record = ( " { " ) ;
for ( Enumeration e = v . elements ( ) ; e . hasMoreElements ( ) ; ) {
Type t = ( Type ) e . nextElement ( ) ;
record = record . concat ( " " + t . getName ( ) ) ;
if ( e . hasMoreElements ( ) )
record = record . concat ( " , " ) ;
}
record = record . concat ( " } " ) ;
parserlog . debug ( record ) ;
} * /
/ * static void string_rec ( String st , Hashtable ht ) {
String record = ( st ) ;
boolean isError = false ;
record = record . concat ( " [ " ) ;
for ( Enumeration e = ht . elements ( ) , k = ht . keys ( ) ; e . hasMoreElements ( ) ; ) {
String s = ( String ) k . nextElement ( ) ;
Object o = e . nextElement ( ) ;
record = record . concat ( " " + s ) ;
if ( o instanceof Type ) {
record = record . concat ( " = " + ( ( Type ) o ) . getName ( ) ) ;
}
else if ( o instanceof Hashtable ) {
record = record . concat ( " = " ) ;
string_rec ( ( Hashtable ) o ) ;
if ( e . hasMoreElements ( ) )
record = record . concat ( " , " ) ;
}
else if ( o instanceof String ) {
record = record . concat ( " = " + o ) ;
if ( e . hasMoreElements ( ) )
record = record . concat ( " , " ) ;
}
else {
record = ( " [ FEHLER : string_rec : unbekannter Typ ! ! ! ! ! ! " +o);
isError = true ;
}
}
record = record . concat ( " ] " ) ;
if ( isError ) {
parserlog . error ( record ) ;
} else {
parserlog . debug ( record ) ;
}
} * /
2015-04-22 19:40:22 +00:00
/ * static void string_rec ( String st , Menge v )
2013-10-18 11:33:46 +00:00
{
String record = ( st ) ;
record = record . concat ( " { " ) ;
for ( Enumeration e = v . elements ( ) ; e . hasMoreElements ( ) ; )
{
Type t = ( Type ) e . nextElement ( ) ;
record = record . concat ( " " + t . getName ( ) ) ;
if ( e . hasMoreElements ( ) )
{
record = record . concat ( " , " ) ;
}
}
record = record . concat ( " } " ) ;
parserlog . debug ( record ) ;
} * /
/////////////////////////////////////////////////////////////////////////
// TypeReconstructionAlgorithmus
/////////////////////////////////////////////////////////////////////////
// ino.method.TRProg.23110.defdescription type=javadoc
/ * *
2015-05-12 17:49:27 +00:00
* Ausgangspunkt fà ¯  ¿  ½ r den Typrekonstruktionsalgorithmus . Hier werden zunà ¯  ¿  ½ chst
2013-10-18 11:33:46 +00:00
* die Mengen von Typannahmen V_fields_methods und V_i erstellt , die als Eingabe
2015-05-12 17:49:27 +00:00
* fà ¯  ¿  ½ r den Algorithmus dienen . < br / >
* ( siehe Algorithmus 5 . 17 TRProg , Martin Plà ¯  ¿  ½ micke )
* < br / > Author : JÃ ¯ Â ¿ Â ½ rg BÃ ¯ Â ¿ Â ½ uerle
2013-10-18 11:33:46 +00:00
* @param supportData
* @param globalAssumptions
2015-05-12 17:49:27 +00:00
* @return Liste aller bisher berechneten , mà ¯  ¿  ½ glichen Typkombinationen
2013-10-18 11:33:46 +00:00
* @throws CTypeReconstructionException
* /
// ino.end
// ino.method.TRProg.23110.definition
2014-02-11 01:47:39 +00:00
public ConstraintsSet typeReconstruction ( FC_TTO supportData , TypeAssumptions globalAssumptions )
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.TRProg.23110.body
{
2014-09-04 14:35:44 +00:00
/ *
* /
2013-10-18 11:33:46 +00:00
//////////////////////////////
// Und los geht's:
//////////////////////////////
2014-11-04 12:47:05 +00:00
inferencelog . info ( " Rufe TRStart()... " , Section . TYPEINFERENCE ) ;
2014-09-02 16:49:19 +00:00
2014-10-09 15:38:10 +00:00
typinferenzLog . debug ( " Erstellte FiniteClosure: " + supportData , Section . TYPEINFERENCE ) ;
2013-10-18 11:33:46 +00:00
//////////////////////////////
// Ab hier ...
// @author A10023 - Andreas Stadelmeier:
//////////////////////////////
//Erzeuge Assumptions:
2014-03-19 14:14:50 +00:00
TypeAssumptions assumptions = this . getPrivateFieldAssumptions ( ) ;
2015-05-12 17:49:27 +00:00
//Globale Assumptions anfügen:
2013-10-18 11:33:46 +00:00
assumptions . add ( globalAssumptions ) ;
2014-06-18 11:37:17 +00:00
ConstraintsSet oderConstraints = new ConstraintsSet ( ) ;
2014-07-17 18:17:59 +00:00
2014-10-08 17:00:17 +00:00
for ( Type gparam : this . get_ParaList ( ) ) {
2015-05-12 17:49:27 +00:00
if ( gparam instanceof GenericTypeVar ) assumptions . add ( ( ( GenericTypeVar ) gparam ) . createAssumptions ( ) ) ; //Constraints für die Generischen Variablen erstellen und diese dem AssumptionsSet hinzufügen
2014-07-17 18:17:59 +00:00
}
2014-10-08 17:00:17 +00:00
for ( Type gparam : this . get_ParaList ( ) ) {
2015-05-12 17:49:27 +00:00
if ( gparam instanceof GenericTypeVar ) oderConstraints . add ( ( ( GenericTypeVar ) gparam ) . TYPE ( assumptions ) ) ; //Constraints für die Generischen Variablen erstellen und diese dem AssumptionsSet hinzufügen
2014-06-18 09:30:14 +00:00
}
2014-10-09 15:38:10 +00:00
typinferenzLog . debug ( " Erstellte Assumptions: " + assumptions , Section . TYPEINFERENCE ) ;
2014-02-12 21:10:33 +00:00
/ *
2013-10-18 11:33:46 +00:00
//Generiere Liste mit Expressions, welche zur Initialisierung von Feldern verwendet werden.
2015-04-22 19:40:22 +00:00
Menge < Expr > fieldInitializers = new Menge < Expr > ( ) ;
2014-02-12 01:12:12 +00:00
for ( FieldDeclaration field : body . getFieldInitializations ( ) ) {
2013-10-18 11:33:46 +00:00
Assign fieldAssign = new Assign ( 0 , 0 ) ;
Expr expr1 = new LocalOrFieldVar ( field . getName ( ) , 0 ) ;
Expr expr2 = field . getWert ( ) ;
fieldAssign . set_Expr ( expr1 , expr2 ) ;
fieldInitializers . add ( fieldAssign ) ;
}
2014-02-12 21:10:33 +00:00
* /
2013-10-18 11:33:46 +00:00
2014-02-12 21:10:33 +00:00
//ConstraintsSet oderConstraints = this.TYPE(this.getMethodList(), fieldInitializers, assumptions);
2014-06-18 11:37:17 +00:00
2014-02-14 16:31:55 +00:00
for ( Field f : this . getFields ( ) ) {
2014-02-12 21:10:33 +00:00
oderConstraints . add ( f . TYPE ( assumptions ) ) ;
}
2014-10-09 15:38:10 +00:00
typinferenzLog . debug ( " Erstellte Constraints: " + oderConstraints , Section . TYPEINFERENCE ) ;
2013-10-18 11:33:46 +00:00
2014-02-11 01:47:39 +00:00
return oderConstraints ;
2013-10-18 11:33:46 +00:00
/ *
CReconstructionTupleSet retTupleSet = this . TRStart ( methodList , V , V_fields_methods , supportData ) ;
2015-05-12 17:49:27 +00:00
inferencelog . debug ( " Bin aus TRStart() zur�ck in TRProg(). " ) ;
2013-10-18 11:33:46 +00:00
//////////////////////////////
// Neu Ergebnismenge A aller
// Typannahmen erzeugen:
//////////////////////////////
inferencelog . debug ( " Erstelle Ergebnismenge... " ) ;
2015-04-22 19:40:22 +00:00
Menge < CTypeReconstructionResult > newA = new Menge < CTypeReconstructionResult > ( ) ;
2013-10-18 11:33:46 +00:00
2015-05-12 17:49:27 +00:00
// Alle bisherigen M�glichkeiten an Typkombinationen durchgehen:
2015-04-22 19:40:22 +00:00
Menge < CTypeReconstructionResult > oldA = supportData . getA ( ) ;
2013-10-18 11:33:46 +00:00
for ( int i = 0 ; i < oldA . size ( ) ; i + + ) {
CTypeReconstructionResult oneReconResult = oldA . elementAt ( i ) ;
2015-05-12 17:49:27 +00:00
// Und mit den neuen m�glichen Typkombinationen vereinigen:
2013-10-18 11:33:46 +00:00
Iterator < CReconstructionTuple > retTupleIt = retTupleSet . getIterator ( ) ;
while ( retTupleIt . hasNext ( ) ) {
CReconstructionTuple possibleTuple = retTupleIt . next ( ) ;
this . clear ( possibleTuple . getAssumSet ( ) , rememberLocals ) ;
// Neue Typinformationen mit alten Typinformationen vereinigen:
CTypeReconstructionResult newReconResult = oneReconResult . shallowCopy ( ) ;
newReconResult . addDataFromTupel ( possibleTuple ) ;
//PL 05-08-02 eingefuegt
//Fuegt Klassen und GenericTypeVars zu A hinzu
newReconResult . addClassName ( this . getName ( ) ) ;
2015-04-22 19:40:22 +00:00
Menge < GenericTypeVar > genericsList = new Menge < GenericTypeVar > ( ) ;
2013-10-18 11:33:46 +00:00
for ( int ii = 0 ; ii < this . get_ParaList ( ) . size ( ) ; ii + + ) {
Type para = ( Type ) this . get_ParaList ( ) . elementAt ( ii ) ;
if ( para instanceof GenericTypeVar ) {
genericsList . addElement ( ( GenericTypeVar ) para ) ;
}
}
newReconResult . addGenericTypeVars ( this . getName ( ) , genericsList ) ;
2015-05-12 17:49:27 +00:00
//Hinzuf�gen:
2013-10-18 11:33:46 +00:00
newA . addElement ( newReconResult ) ;
}
}
return newA ;
* /
}
// ino.end
/ * *
* @return Eine Liste mit allen Methoden dieser Klasse
2014-02-19 04:20:54 +00:00
2015-04-22 19:40:22 +00:00
private Menge < Method > getMethodList ( ) {
2014-02-19 04:20:54 +00:00
2014-02-11 01:47:39 +00:00
2013-10-18 11:33:46 +00:00
if ( this . methodList ! = null ) return this . methodList ;
2015-05-12 17:49:27 +00:00
//TODO: Unnötige Berechnungen im folgenden Code rauskürzen:
2013-10-18 11:33:46 +00:00
//////////////////////////////
// Die Eingabedaten bauen:
//////////////////////////////
inferencelog . debug ( " Baue Eingabedaten... " ) ;
TypeAssumptions V_fields_methods = new TypeAssumptions ( this . getName ( ) ) ;
2015-04-22 19:40:22 +00:00
Menge < Method > methodList = new Menge < Method > ( ) ;
Menge < CTypeAssumptionSet > V = new Menge < CTypeAssumptionSet > ( ) ;
Menge < CTypeAssumption > rememberLocals = new Menge < CTypeAssumption > ( ) ;
2013-10-18 11:33:46 +00:00
//////////////////////////////
// Alle Felder durchgehen:
// Zuerst alle Attribute, dann Methoden
2015-05-12 17:49:27 +00:00
// ge�ndert: hoth 06.04.2006
2013-10-18 11:33:46 +00:00
//////////////////////////////
2014-02-14 16:31:55 +00:00
for ( Field field : this . getFields ( ) )
2013-10-18 11:33:46 +00:00
{
//////////////////////////////
// Attribut:
//////////////////////////////
2014-02-11 01:47:39 +00:00
2013-10-18 11:33:46 +00:00
}
2014-02-14 16:31:55 +00:00
for ( Field field : this . getFields ( ) )
2013-10-18 11:33:46 +00:00
{
//////////////////////////////
// Methode:
//////////////////////////////
if ( field instanceof Method ) {
Method method = ( Method ) field ;
//if(method.get_Method_Name().equals(this.getName()) && ((method.getReturnType().equals(new mycompiler.mytype.Void(0))) || method.getReturnType() instanceof TypePlaceholder)){
if ( method . get_Method_Name ( ) . equals ( this . getName ( ) ) ) {
method . set_Method_Name ( " <init> " ) ;
}
//hoth: 06.04.2006
//durchlaufe Block und suche nach Objektvariablen fuer Offset-Markierung
Iterator < CTypeAssumption > fieldVarIterator = V_fields_methods . iterator ( ) ;
while ( fieldVarIterator . hasNext ( ) )
{
//Wenn ObjektVariable
CTypeAssumption dieAssum = fieldVarIterator . next ( ) ;
if ( dieAssum instanceof CInstVarTypeAssumption )
{
Class . isFirstLocalVarDecl = false ;
if ( method . get_Block ( ) ! = null )
method . get_Block ( ) . addOffsetsToAssumption ( dieAssum , dieAssum . getIdentifier ( ) , true ) ;
}
}
methodList . addElement ( method ) ;
2015-05-12 17:49:27 +00:00
// F�r V_fields_methods:
2015-04-22 19:40:22 +00:00
CMethodTypeAssumption methodAssum = new CMethodTypeAssumption ( this . getType ( ) , method . get_Method_Name ( ) , method . getReturnType ( ) , method . getParameterCount ( ) , method . getLineNumber ( ) , method . getOffset ( ) , new Menge < Integer > ( ) , method . getGenericMethodParameters ( ) ) ; // Typannahme bauen...
2013-10-18 11:33:46 +00:00
// Methode in V_Fields_methods ablegen
// Dabei wird die OverloadedMethodID ermittelt !!
// => Method setzenuct
V_fields_methods . add ( methodAssum ) ;
method . setOverloadedID ( methodAssum . getHashSetKey ( ) . getOverloadedMethodID ( ) ) ;
2015-05-12 17:49:27 +00:00
// F�r die V_i:
2013-10-18 11:33:46 +00:00
CTypeAssumptionSet localAssum = new CTypeAssumptionSet ( ) ;
// Bauen...
ParameterList parameterList = method . getParameterList ( ) ;
if ( parameterList ! = null ) {
for ( int i = 0 ; i < parameterList . sc_get_Formalparalist ( ) . size ( ) ; i + + ) {
FormalParameter para = parameterList . sc_get_Formalparalist ( ) . elementAt ( i ) ;
2015-05-12 17:49:27 +00:00
// F�r V_fields_methods:
2015-04-22 19:40:22 +00:00
CParaTypeAssumption paraAssum = new CParaTypeAssumption ( this . getName ( ) , method . get_Method_Name ( ) , method . getParameterCount ( ) , method . getOverloadedID ( ) , para . getIdentifier ( ) , para . getType ( ) , para . getLineNumber ( ) , para . getOffset ( ) , new Menge < Integer > ( ) ) ;
2013-10-18 11:33:46 +00:00
//fuege Offsets fuer Parameter hinzu, hoth: 06.04.2006
Class . isFirstLocalVarDecl = false ;
if ( method . get_Block ( ) ! = null )
method . get_Block ( ) . addOffsetsToAssumption ( paraAssum , paraAssum . getIdentifier ( ) , true ) ;
methodAssum . addParaAssumption ( paraAssum ) ;
2015-05-12 17:49:27 +00:00
// F�r die V_i:
2015-04-22 19:40:22 +00:00
CLocalVarTypeAssumption varAssum = new CLocalVarTypeAssumption ( this . getName ( ) , method . get_Method_Name ( ) , method . getParameterCount ( ) , method . getOverloadedID ( ) , " 1 " , para . getIdentifier ( ) , para . getType ( ) , para . getLineNumber ( ) , para . getOffset ( ) , new Menge < Integer > ( ) ) ;
2013-10-18 11:33:46 +00:00
localAssum . addElement ( varAssum ) ;
rememberLocals . addElement ( varAssum ) ;
}
}
2015-05-12 17:49:27 +00:00
// ...und hinzuf�gen:
2013-10-18 11:33:46 +00:00
V . addElement ( localAssum ) ;
}
}
this . methodList = methodList ;
return methodList ;
2014-02-19 04:20:54 +00:00
2013-10-18 11:33:46 +00:00
}
2014-02-19 04:20:54 +00:00
* /
2013-10-18 11:33:46 +00:00
/ * *
2015-05-12 17:49:27 +00:00
* Ermittelt alle privaten Felder und Methoden der Klasse und Erstellt eine Assumption fà ¼ r diese .
* Bemerkung : Momentan werden noch alle Felder dieser Klasse zurà ¼ ckgegeben .
2013-10-18 11:33:46 +00:00
* @return Die erstellten TypeAssumptions
* /
2014-03-19 14:14:50 +00:00
private TypeAssumptions getPrivateFieldAssumptions ( ) {
2015-05-12 17:49:27 +00:00
if ( this . typeAssumptions ! = null ) return this . typeAssumptions ; //Das sorgt dafür, dass die Assumptions nur einmalig generiert werden.
2013-10-18 11:33:46 +00:00
TypeAssumptions assumptions = new TypeAssumptions ( this . getName ( ) ) ;
2015-05-12 17:49:27 +00:00
//this.getMethodList(); //Diese Funktion muss zuerst ausgeführt werden.
//Assumption für this, also die aktuelle Klasse: (ist nicht mehr nötig, da jedes AssumptionSet einer Klasse (dem namen einer Klasse) zugewiesen ist.
2013-10-18 11:33:46 +00:00
//CLocalVarTypeAssumption thisAssumption = new CLocalVarTypeAssumption(this.name, name, 0, 0, name, "this", new RefType(name,0), 0, 0, null);
//assumptions.setThisV(thisAssumption);
2014-02-14 16:31:55 +00:00
for ( Field field : this . getFields ( ) ) {
2014-04-14 16:05:24 +00:00
if ( ! field . isPublic ( ) ) assumptions . add ( field . createTypeAssumptions ( this ) ) ;
2013-10-18 11:33:46 +00:00
}
2015-05-12 17:49:27 +00:00
//Eine Assumption für den Standardkonstruktor:
// (Ein Standardkonstruktor wird immer angefügt, da es momentan keine statischen Klassen gibt)
//auskommentiert, da der Standardkonstruktor beim Parser-Postprocessing angefügt wird.
//if(assumptions.getMethodAssumptions(this.getName(), "<init>").size()==0){ //Falls kein Konstruktor für diese Klasse definiert wurde:
2015-04-22 19:40:22 +00:00
// assumptions.addMethodAssumption(new RefType(this.getName(),0), "<init>", new RefType(this.getName(),0), new Menge<CParaTypeAssumption>());
2014-02-19 04:20:54 +00:00
//}
2013-10-18 11:33:46 +00:00
2015-05-12 17:49:27 +00:00
this . typeAssumptions = assumptions ; //Diese müssen anschlieà end nicht wieder generiert werden.
2013-10-18 11:33:46 +00:00
return assumptions ;
}
2014-09-02 08:33:54 +00:00
/ *
2015-04-22 19:40:22 +00:00
public ConstraintsSet TYPE ( Menge < Method > methodList , Menge < Expr > fielddeclarationList , TypeAssumptions assumptions ) {
2013-10-18 11:33:46 +00:00
ConstraintsSet ret = new ConstraintsSet ( ) ;
2015-05-12 17:49:27 +00:00
// Die Felddeklarationen werden zu den Assumptions hinzugefügt und gelten danach für jede Methode.
2013-10-18 11:33:46 +00:00
//TypeAssumptions assumptionsPlusFieldAssumptions = new TypeAssumptions(assumptions);
for ( Expr expr : fielddeclarationList ) {
//ret.add(expr.TYPEStmt(assumptionsPlusFieldAssumptions));
ret . add ( expr . TYPEStmt ( assumptions ) ) ;
}
for ( Method methode : methodList ) {
//ret.add(methode.TYPE(assumptionsPlusFieldAssumptions));
ret . add ( methode . TYPE ( assumptions ) ) ;
}
return ret ;
}
2014-09-02 08:33:54 +00:00
* /
2014-09-05 09:49:31 +00:00
2013-10-18 11:33:46 +00:00
// ino.method.RetType.23119.defdescription type=javadoc
/ * *
2015-05-12 17:49:27 +00:00
* Liefert den berechneten Rà ¯  ¿  ½ ckgabetyp fà ¯  ¿  ½ r die à ¯  ¿  ½ bergebene Methode zurà ¯  ¿  ½ ck . < br / >
* ( siehe Algorithmus RetType , Martin Plà ¯  ¿  ½ micke )
* < br / > Author : JÃ ¯ Â ¿ Â ½ rg BÃ ¯ Â ¿ Â ½ uerle
2013-10-18 11:33:46 +00:00
* @param me
* @param V
* @return
2014-09-02 16:49:19 +00:00
2013-10-18 11:33:46 +00:00
// ino.end
// ino.method.RetType.23119.definition
private Type RetType ( Method me , CTypeAssumptionSet V )
// ino.end
// ino.method.RetType.23119.body
{
CTypeAssumption assum = V . getElement ( new CMethodKey ( this . getName ( ) , me . get_Method_Name ( ) , me . getParameterCount ( ) , me . getOverloadedID ( ) ) ) ;
if ( assum instanceof CMethodTypeAssumption ) {
return ( ( CMethodTypeAssumption ) assum ) . getAssumedType ( ) ;
}
else return null ;
}
// ino.end
2014-09-02 16:49:19 +00:00
* /
2014-02-10 03:25:14 +00:00
// ino.method.toString.23125.defdescription type=javadoc
2013-10-18 11:33:46 +00:00
/ * *
2015-05-12 17:49:27 +00:00
* < br / > Author : Martin Plà ¯  ¿  ½ micke
2013-10-18 11:33:46 +00:00
* @return
* /
// ino.end
// ino.method.toString.23125.definition
public String toString ( )
// ino.end
// ino.method.toString.23125.body
{
//return superclassid.toString() + body.toString();
//geaendert PL 07-07-28
2014-02-14 16:31:55 +00:00
return name ;
2013-10-18 11:33:46 +00:00
}
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.23128.defdescription type=javadoc
/ * *
2015-05-12 17:49:27 +00:00
* Alle Methoden der Klassen à ¼ berprà ¼ fen , ob sie als
2013-10-18 11:33:46 +00:00
* RefType deklarierte Attribute haben , die aber GenericTypeVars sind
* und ggf . ersetzen
*
* Bsp . :
* bei public E elementAt ( i ) { . . . } wird E vorerst als RefType erkannt
*
* /
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.23128.definition
public void wandleRefTypeAttributes2GenericAttributes ( )
// ino.end
// ino.method.wandleRefTypeAttributes2GenericAttributes.23128.body
{
2014-03-27 15:43:07 +00:00
for ( Field f : this . getFields ( ) ) {
2014-07-09 14:04:33 +00:00
//f.wandleRefTypeAttributes2GenericAttributes(paralist);
2014-03-27 15:43:07 +00:00
}
/ *
2015-04-22 19:40:22 +00:00
Menge fieldsAndMethods = this . getFields ( ) ;
2013-10-18 11:33:46 +00:00
// Alle Methoden und Instanzvariablen durchgehen
for ( int i = 0 ; i < fieldsAndMethods . size ( ) ; i + + ) {
// Ist es eine Methode?
if ( fieldsAndMethods . get ( i ) instanceof Method ) {
Method method = ( Method ) fieldsAndMethods . get ( i ) ;
method . wandleRefTypeAttributes2GenericAttributes ( paralist ) ;
} // Ist es eine InstanzVariable?
2014-03-27 15:43:07 +00:00
* //*
2013-10-18 11:33:46 +00:00
else if ( fieldsAndMethods . get ( i ) instanceof InstVarDecl ) {
InstVarDecl instVar = ( InstVarDecl ) fieldsAndMethods . get ( i ) ;
Type type = instVar . getType ( ) ;
// Nur wenn es sich um ein RefType-Field handelt
if ( type instanceof RefType ) {
GenericTypeVar pendant = ClassHelper . findGenericType ( ( RefType ) type , paralist , null ) ;
if ( pendant ! = null ) { //Wenn generisch, dann modifizieren
instVar . setType ( pendant ) ;
}
}
2014-03-27 15:43:07 +00:00
}
} * /
2013-10-18 11:33:46 +00:00
}
// ino.end
// private void removeOldLocalVars(CTypeAssumptionSet V_i, CTypeAssumptionSet V_last){
// Enumeration<IHashSetKey> enumer = V_last.getHashtable().keys();
// while(enumer.hasMoreElements()){
// CTypeAssumption currentAssum = V_last.getElement(enumer.nextElement());
// if(currentAssum instanceof CLocalVarTypeAssumption){
// V_i.removeElement(currentAssum);
// }
// }
//
// }
2014-09-05 09:49:31 +00:00
2013-10-18 11:33:46 +00:00
// ino.method.getSimpleName.23140.defdescription type=javadoc
/ * *
* HOTI
* Liefert bei Klassen die fullyQualified angegeben wurden
* nur den schlussendlichen Bezeichner
2015-04-22 19:40:22 +00:00
* p . ex . de . dhbwstuttgart . typeinference . Menge = > Menge
2013-10-18 11:33:46 +00:00
* @return
* /
// ino.end
// ino.method.getSimpleName.23140.definition
public String getSimpleName ( )
// ino.end
// ino.method.getSimpleName.23140.body
{
2014-09-02 16:49:19 +00:00
return UsedId . createFromQualifiedName ( getName ( ) . toString ( ) , - 1 ) . getSimpleName ( ) ;
2013-10-18 11:33:46 +00:00
}
// ino.end
2015-04-22 19:40:22 +00:00
public String getTypeInformation ( Menge < Method > methodList , Menge < Expr > fieldList ) {
2013-10-18 11:33:46 +00:00
String ret = this . name + " : " ;
for ( Expr field : fieldList ) {
ret + = field . getTypeInformation ( ) + " \ n " ;
}
for ( Method m : methodList ) {
ret + = m . getTypeInformation ( ) + " \ n " ;
}
return ret ;
}
/ * *
2015-05-12 17:49:27 +00:00
* Generiert den JavaCode dieser Klasse im Falle fà ¼ r das à ¼ bergebene resultSet .
2013-10-18 11:33:46 +00:00
* Dem ResultSet entsprechend werden in diesem Java - Code die TypePlaceholder durch die in ResultSet stehenden Typen ersetzt .
* @return Java - Sourcefile
* /
2014-02-09 15:07:31 +00:00
public String printJavaCode ( TypeinferenceResultSet reconstructionResult ) {
2013-10-18 11:33:46 +00:00
JavaCodeResult ret = new JavaCodeResult ( " class " ) ;
//Generiere JavaCode der extends-Typen:
/ *
String containedTypesJavaCode = " " ;
for ( Type containedType : containedTypes ) {
containedTypesJavaCode + = containedType . printJavaCode ( resultSet ) + " , " ;
}
if ( containedTypesJavaCode . length ( ) > 1 ) containedTypesJavaCode = containedTypesJavaCode . substring ( 0 , containedTypesJavaCode . length ( ) - 2 ) ;
* /
JavaCodeResult classBodyCode = new JavaCodeResult ( ) ;
if ( this . modifiers ! = null ) classBodyCode . attach ( this . modifiers . printJavaCode ( reconstructionResult . getUnifiedConstraints ( ) ) ) . attach ( " " ) ;
classBodyCode . attach ( this . name + " extends " ) . attach ( superclassid . printJavaCode ( reconstructionResult . getUnifiedConstraints ( ) ) ) . attach ( " \ n " ) ;
2014-02-14 16:31:55 +00:00
JavaCodeResult bodyString = new JavaCodeResult ( " { \ n " ) ;
for ( Field field : this . fielddecl ) bodyString . attach ( field . printJavaCode ( reconstructionResult . getUnifiedConstraints ( ) ) ) . attach ( " \ n " ) ;
bodyString . attach ( " } \ n " ) ;
2013-10-18 11:33:46 +00:00
classBodyCode . attach ( bodyString ) ;
2015-05-12 17:49:27 +00:00
//Zuerst die generischen Parameter für diese Klasse berechnen:
2014-07-09 08:52:23 +00:00
//this.createGenericTypeVars(classBodyCode.getUnresolvedTPH());
2013-10-18 11:33:46 +00:00
if ( this . genericClassParameters ! = null & & this . genericClassParameters . size ( ) > 0 ) {
ret . attach ( " < " ) ;
Iterator < GenericTypeVar > it = this . genericClassParameters . iterator ( ) ;
while ( it . hasNext ( ) ) {
GenericTypeVar tph = it . next ( ) ;
ret . attach ( tph . printJavaCode ( reconstructionResult . getUnifiedConstraints ( ) ) ) ;
if ( it . hasNext ( ) ) ret . attach ( " , " ) ;
}
ret . attach ( " > " ) ;
}
String stringReturn = ret . attach ( classBodyCode ) . toString ( ) ;
return stringReturn ;
}
/ * *
2015-05-12 17:49:27 +00:00
* Errechnet die Generischen Parameter der Klasse fà ¼ r diese Klasse .
* Die berechneten Variablen werden anschlieà end in die this . genericTypeVars eingesetzt . Dabei werden alte genericTypeVars à ¼ berschrieben .
* @param tphs : Alle à ¼ briggebliebenen TypePLaceholder
2014-07-09 08:52:23 +00:00
2015-04-22 19:40:22 +00:00
private void createGenericTypeVars ( Menge < TypePlaceholder > tphs ) {
this . genericClassParameters = new GenericDeclarationList ( new Menge < GenericTypeVar > ( ) ) ;
2013-10-18 11:33:46 +00:00
for ( TypePlaceholder tph : tphs ) {
2014-04-16 14:02:16 +00:00
GenericTypeVar toAdd = new GenericTypeVar ( tph , this . getOffset ( ) ) ;
2013-10-18 11:33:46 +00:00
if ( ! this . genericClassParameters . contains ( toAdd ) ) this . genericClassParameters . add ( toAdd ) ;
}
}
2014-07-09 08:52:23 +00:00
* /
2013-10-18 11:33:46 +00:00
/ * *
2015-05-12 17:49:27 +00:00
* Errechnet die Generischen Parameter der Klasse fà ¼ r diese Klasse .
* Die berechneten Variablen werden anschlieà end in die this . genericTypeVars eingesetzt . Dabei werden alte genericTypeVars à ¼ berschrieben .
2013-10-18 11:33:46 +00:00
* @param reconstructionResult
2014-06-18 09:30:14 +00:00
2014-02-09 15:07:31 +00:00
public void createGenericTypeVars ( TypeinferenceResultSet reconstructionResult ) {
2015-04-22 19:40:22 +00:00
this . genericClassParameters = new Menge < GenericTypeVar > ( ) ;
2013-10-18 11:33:46 +00:00
for ( Pair pair : reconstructionResult . getUnifiedConstraints ( ) ) {
if ( pair . TA2 instanceof TypePlaceholder & & pair . TA1 instanceof TypePlaceholder ) { // if(pair.OperatorSmallerExtends() || pair.OperatorSmaller()){
Type ta1 = reconstructionResult . getUnifiedConstraints ( ) . getTypeEqualTo ( pair . TA1 ) ;
Type ta2 = reconstructionResult . getUnifiedConstraints ( ) . getTypeEqualTo ( pair . TA2 ) ;
2014-04-16 14:02:16 +00:00
this . genericClassParameters . add ( new GenericTypeVar ( new Pair ( ta1 , ta2 ) , this . getOffset ( ) ) ) ;
2013-10-18 11:33:46 +00:00
}
}
for ( Pair pair : reconstructionResult . getConstraints ( ) ) {
if ( ! reconstructionResult . getUnifiedConstraints ( ) . contains ( pair . TA1 ) ) {
2014-04-16 14:02:16 +00:00
this . genericClassParameters . add ( new GenericTypeVar ( pair . TA1 , this . getOffset ( ) ) ) ;
2013-10-18 11:33:46 +00:00
}
if ( ! reconstructionResult . getUnifiedConstraints ( ) . contains ( pair . TA2 ) ) {
2014-04-16 14:02:16 +00:00
this . genericClassParameters . add ( new GenericTypeVar ( pair . TA2 , this . getOffset ( ) ) ) ;
2013-10-18 11:33:46 +00:00
}
}
}
2014-06-18 09:30:14 +00:00
* /
2014-04-16 14:02:16 +00:00
public int getOffset ( ) {
2014-07-16 12:35:12 +00:00
return this . offset ;
2014-04-16 14:02:16 +00:00
}
2013-10-18 11:33:46 +00:00
/ * *
* Erstellt einen RefType , welcher auf diese Klasse verweist
2014-04-09 12:12:55 +00:00
* Ersetzt alle Generischen Variablen in der Parameterliste mit TPH
2013-10-18 11:33:46 +00:00
* @return
* /
public RefType getType ( ) {
2014-06-18 11:37:17 +00:00
/ *
2015-04-22 19:40:22 +00:00
Menge < Type > parameter = new Menge < Type > ( ) ;
2014-03-28 17:36:08 +00:00
for ( Type param : this . get_ParaList ( ) ) {
parameter . add ( ( ( GenericTypeVar ) param ) . getTypePlaceHolder ( ) ) ; //(TypePlaceholder.fresh()); //Hier ist kein ReplacementListener notwendig. Der Typ soll nie eingesetzt werden. Der TPH wird nur gebraucht, damit das Unifizieren funktioniert.
}
2014-06-18 11:37:17 +00:00
* /
2014-09-14 16:38:43 +00:00
return new RefType ( this . getName ( ) . toString ( ) , this . get_ParaList ( ) , this , 0 ) ;
2013-10-18 11:33:46 +00:00
}
/ * *
* Ermittelt die Sichtbaren Felder und Methoden der Klasse .
* ( Momentan sind im Projekt alle Felder und Methoden " package private " , da der Parser keine Access - Modifier einlesen kann .
* @return
* /
public TypeAssumptions getPublicFieldAssumptions ( ) {
2014-04-14 16:05:24 +00:00
TypeAssumptions ret = new TypeAssumptions ( ) ; //this.getPrivateFieldAssumptions();
2014-04-09 12:12:55 +00:00
ret . addClassAssumption ( new ClassAssumption ( this ) ) ;
2014-02-19 13:16:28 +00:00
for ( Field f : this . getFields ( ) ) {
2014-04-14 16:05:24 +00:00
if ( f . isPublic ( ) ) ret . add ( f . createTypeAssumptions ( this ) ) ;
2014-02-19 13:16:28 +00:00
}
2014-09-18 14:26:02 +00:00
for ( GenericTypeVar gtv : this . getGenericParameter ( ) ) {
ret . add ( gtv . createAssumptions ( ) ) ;
}
2013-10-18 11:33:46 +00:00
return ret ;
}
2014-02-11 15:30:38 +00:00
@Override
public void parserPostProcessing ( SyntaxTreeNode parent ) {
2014-03-18 19:18:57 +00:00
//Wenn keine Superklasse, dann erbt die Klasse zwangsweise von Object:
if ( superclassid = = null | | superclassid . get_Name ( ) . size ( ) < 1 ) {
int superclassidOffset = superclassid = = null ? 0 : superclassid . getOffset ( ) ;
superclassid = new UsedId ( " Object " , superclassidOffset ) ;
}
2014-02-19 16:32:43 +00:00
//Alle Methoden auf Konstruktoren durchsuchen und diese umwandeln:
2015-04-22 19:40:22 +00:00
Menge < Field > tempFields = new Menge < Field > ( ) ;
2014-02-19 16:32:43 +00:00
for ( Field f : this . getFields ( ) ) {
if ( f instanceof Method & & ! ( f instanceof Constructor ) ) {
Method method = ( Method ) f ;
2015-02-25 15:34:29 +00:00
if ( method . get_Method_Name ( ) . equals ( this . getName ( ) . toString ( ) ) ) {
2014-02-19 16:32:43 +00:00
tempFields . add ( new Constructor ( method ) ) ;
} else {
tempFields . add ( f ) ;
}
} else {
tempFields . add ( f ) ;
}
}
this . fielddecl = tempFields ;
2015-05-12 17:49:27 +00:00
//Prüfen ob ein Konstruktor vorhanden ist:
2014-02-19 04:20:54 +00:00
boolean constructorVorhanden = false ;
for ( Field f : this . getFields ( ) ) {
if ( f instanceof Constructor ) {
constructorVorhanden = true ;
break ;
}
}
2015-05-12 17:49:27 +00:00
if ( ! constructorVorhanden ) { //Falls kein Konstruktor vorhanden ist, muss noch der Standardkonstruktor angefügt werden:
2014-09-02 16:49:19 +00:00
Constructor standardKonstruktor = new Constructor ( Method . createEmptyMethod ( this . getName ( ) . toString ( ) , this ) ) ;
2014-02-19 04:20:54 +00:00
this . addField ( standardKonstruktor ) ;
}
2014-03-27 15:43:07 +00:00
2015-04-22 19:40:22 +00:00
if ( this . genericClassParameters = = null ) this . setGenericParameter ( new GenericDeclarationList ( new Menge < GenericTypeVar > ( ) , 0 ) ) ;
2014-10-08 17:00:17 +00:00
/ * //Nicht mehr notwendig, Generische Klassenparameter werden nun immer direkt in die genericClassParameters gespeichert.
2014-09-09 09:15:10 +00:00
for ( Type t : this . get_ParaList ( ) ) {
if ( t instanceof GenericTypeVar ) this . genericClassParameters . add ( ( GenericTypeVar ) t ) ;
else this . genericClassParameters . add ( new GenericTypeVar ( t . get_Name ( ) , this , - 1 ) ) ;
}
2014-10-08 17:00:17 +00:00
* /
2015-02-25 15:34:29 +00:00
/ *
2014-09-16 09:31:15 +00:00
for ( Type t : this . get_ParaList ( ) ) {
t . parserPostProcessing ( this ) ;
}
2015-02-25 15:34:29 +00:00
* /
2014-09-10 21:32:36 +00:00
/ *
2014-09-09 09:15:10 +00:00
for ( GenericTypeVar gtv : this . getGenericParameter ( ) ) {
gtv . setParentClass ( this ) ; ;
}
2014-09-10 21:32:36 +00:00
* /
2014-04-14 16:05:24 +00:00
//TODO: Umwandlung zu RefTypes funktioniert noch nicht richtig. (siehe LambdaTest2)
2014-03-27 15:43:07 +00:00
//Als RefType geparste Generische Variablen umwandeln:
this . wandleRefTypeAttributes2GenericAttributes ( ) ;
2015-02-25 15:34:29 +00:00
//Erst am Schluss, nachdem Methoden zu Konstruktoren umgewandelt wurden:
super . parserPostProcessing ( parent ) ;
2014-02-11 15:30:38 +00:00
}
2014-03-27 15:43:07 +00:00
2014-02-11 15:30:38 +00:00
@Override
public SyntaxTreeNode getParent ( ) {
2014-02-19 04:20:54 +00:00
return this ;
2014-02-11 15:30:38 +00:00
}
@Override
2015-04-22 19:40:22 +00:00
public Menge < SyntaxTreeNode > getChildren ( ) {
Menge < SyntaxTreeNode > ret = new Menge < SyntaxTreeNode > ( ) ;
2015-02-25 15:34:29 +00:00
//for(Field f : this.getFields()){
// ret.add(f);
//}
ret . addAll ( this . getFields ( ) ) ;
ret . addAll ( this . get_ParaList ( ) ) ;
2014-09-10 21:32:36 +00:00
ret . addAll ( this . getGenericParameter ( ) ) ;
2014-02-12 01:12:12 +00:00
return ret ;
2014-02-11 15:30:38 +00:00
}
2013-10-18 11:33:46 +00:00
2014-02-19 04:20:54 +00:00
@Override
public boolean equals ( Object obj ) {
if ( ! ( obj instanceof Class ) ) return false ;
Class cl = ( Class ) obj ;
if ( ! ( cl . getName ( ) . equals ( this . getName ( ) ) ) ) return false ;
return true ;
}
2014-03-12 14:27:26 +00:00
2014-07-16 08:33:34 +00:00
@Override
2015-04-22 19:40:22 +00:00
public Menge < GenericTypeVar > getGenericParameter ( ) {
if ( this . genericClassParameters = = null ) return new Menge < GenericTypeVar > ( ) ;
return this . genericClassParameters . getMenge ( ) ;
2014-07-16 08:33:34 +00:00
}
2014-03-12 14:27:26 +00:00
@Override
public String getDescription ( ) {
return " class " + this . getName ( ) ;
}
2014-04-16 14:02:16 +00:00
@Override
public int getVariableLength ( ) {
// TODO Auto-generated method stub
return 0 ;
}
2014-06-25 15:30:31 +00:00
2014-05-07 11:01:14 +00:00
@Override
2014-06-25 15:30:31 +00:00
public void setGenericParameter ( GenericDeclarationList params ) {
2014-05-07 11:01:14 +00:00
this . genericClassParameters = params ;
}
2014-04-26 17:33:26 +00:00
2014-06-25 15:30:31 +00:00
@Override
2014-07-16 12:35:12 +00:00
public String getGenericVarDeclarationString ( String genericVarDeclaration ) {
if ( this . genericClassParameters ! = null ) {
return " , " + genericVarDeclaration ;
} else {
return " < " + genericVarDeclaration + " > " ;
}
}
@Override
public int getGenericVarDeclarationOffset ( ) {
2015-05-12 17:49:27 +00:00
// Falls Generische Parameterliste vorhanden, hier Wert der Liste zurückgegebn
2014-07-16 12:35:12 +00:00
if ( this . genericClassParameters ! = null ) {
2014-07-31 13:15:33 +00:00
return this . genericClassParameters . getEndOffset ( ) ;
2014-07-16 12:35:12 +00:00
} else {
return this . offset ;
}
2014-06-25 15:30:31 +00:00
}
2014-07-16 08:33:34 +00:00
2014-09-14 16:38:43 +00:00
/ * *
* Die Super Klasse dieser Klasse .
2015-05-12 17:49:27 +00:00
* @return null fà ¼ r Klasse Object
2014-09-14 16:38:43 +00:00
* /
2014-09-18 14:26:02 +00:00
public Type getSuperClass ( ) {
2014-09-14 16:38:43 +00:00
return this . superClass ;
}
2015-02-24 16:06:14 +00:00
@Override
public boolean isClass ( ) {
return true ;
}
2013-10-18 11:33:46 +00:00
}
// ino.end