JavaClassName implementiert

This commit is contained in:
JanUlrich 2014-09-02 18:49:19 +02:00
parent 01c6a934ed
commit 37d33b7a31
45 changed files with 227 additions and 196 deletions

5
bin/.gitignore vendored
View File

@ -1,8 +1,7 @@
/mycompiler /bytecode
/userinterface
/de /de
/myJvmDisassembler /myJvmDisassembler
/bytecode /mycompiler
/parser /parser
/plugindevelopment /plugindevelopment
/syntaxTree /syntaxTree

View File

@ -13,7 +13,9 @@ import org.apache.log4j.Logger;
// ino.end // ino.end
import de.dhbwstuttgart.syntaxtree.misc.UsedId; import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
// ino.class.AClassOrInterface.21186.description type=javadoc // ino.class.AClassOrInterface.21186.description type=javadoc
/** /**
@ -30,7 +32,7 @@ public interface AClassOrInterface
// ino.class.AClassOrInterface.21186.body // ino.class.AClassOrInterface.21186.body
{ {
public String getName(); public JavaClassName getName();
public Vector<UsedId> getSuperInterfaces(); public Vector<UsedId> getSuperInterfaces();
public void setSuperInterfaces(Vector<UsedId> vector); public void setSuperInterfaces(Vector<UsedId> vector);

View File

@ -174,7 +174,7 @@ public class MyCompiler implements MyCompilerAPI
// Klasse existiert, darf aber keine Parameterliste in der Definition haben // Klasse existiert, darf aber keine Parameterliste in der Definition haben
if( KlassenVektor.elementAt(k).get_ParaList().size() == 0 ) if( KlassenVektor.elementAt(k).get_ParaList().size() == 0 )
{ {
RefType RNeu = new RefType( TempParameter.getName(), null,TempParameter.getOffset()); RefType RNeu = new RefType( TempParameter.getName().toString(), null,TempParameter.getOffset());
inferencelog.debug( "Vorher: " + Parameter ); inferencelog.debug( "Vorher: " + Parameter );
// i-te Stelle ersetzen // i-te Stelle ersetzen
Parameter.set( i, RNeu ); Parameter.set( i, RNeu );
@ -561,7 +561,7 @@ public class MyCompiler implements MyCompilerAPI
* Generiert den Bytecode und das Class-File f<EFBFBD>r den Syntaxbaum. * Generiert den Bytecode und das Class-File f<EFBFBD>r den Syntaxbaum.
* @throws NullPointerException Wenn noch kein abstrakter Syntaxbaum vorhanden * @throws NullPointerException Wenn noch kein abstrakter Syntaxbaum vorhanden
* ist. * ist.
*/
@Override @Override
public Vector<ClassFile> codeGeneration(ResultSet result) public Vector<ClassFile> codeGeneration(ResultSet result)
throws NullPointerException, JVMCodeException throws NullPointerException, JVMCodeException
@ -579,7 +579,8 @@ public class MyCompiler implements MyCompilerAPI
codegenlog.info("Codegenerierung beendet!"); codegenlog.info("Codegenerierung beendet!");
return ret; return ret;
} }*/
// ino.method.main.21313.defdescription type=javadoc // ino.method.main.21313.defdescription type=javadoc
/** /**
@ -668,7 +669,7 @@ public class MyCompiler implements MyCompilerAPI
for(int j=0;j<declarations.size();j++){ for(int j=0;j<declarations.size();j++){
UsedId impDecl=declarations.elementAt(j); UsedId impDecl=declarations.elementAt(j);
if(impDecl.getSimpleName().equals(typ)){ if(impDecl.getSimpleName().equals(typ)){
ret=(impDecl.getQualifiedName()); ret=(impDecl.getQualifiedName().toString());
break; break;
} }
@ -736,7 +737,7 @@ public class MyCompiler implements MyCompilerAPI
if(tt instanceof GenericTypeVar) if(tt instanceof GenericTypeVar)
{ {
GenericTypeVar gtv = (GenericTypeVar)tt; GenericTypeVar gtv = (GenericTypeVar)tt;
paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName())); paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName().toString()));
} }
else else
{ {
@ -853,5 +854,12 @@ public class MyCompiler implements MyCompilerAPI
this.m_AbstractSyntaxTree.add(ret); this.m_AbstractSyntaxTree.add(ret);
return ret; return ret;
} }
@Override
public Vector<ClassFile> codeGeneration(ResultSet result)
throws NullPointerException, JVMCodeException {
// TODO Auto-generated method stub
return null;
}
} }
// ino.end // ino.end

View File

@ -58,6 +58,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.unify.FC_TTO; import de.dhbwstuttgart.typeinference.unify.FC_TTO;
import de.dhbwstuttgart.typeinference.unify.Unify; import de.dhbwstuttgart.typeinference.unify.Unify;
import mycompiler.myclass.*; import mycompiler.myclass.*;
@ -231,7 +232,7 @@ public class SourceFile
* Startet die Bytecodegenerierung fuer alle in der Datei * Startet die Bytecodegenerierung fuer alle in der Datei
* enthaltenen Klassen und Interfaces. * enthaltenen Klassen und Interfaces.
* *
*/
// ino.end // ino.end
// ino.method.codegen.21397.definition // ino.method.codegen.21397.definition
public Vector<ClassFile> codegen(ResultSet result) public Vector<ClassFile> codegen(ResultSet result)
@ -254,7 +255,7 @@ public class SourceFile
return ret; return ret;
} }
// ino.end // ino.end
*/
// ino.method.createPairFromClassAndSuperclass.21400.defdescription type=javadoc // ino.method.createPairFromClassAndSuperclass.21400.defdescription type=javadoc
/** /**
* Erstellt ein Typ-Paar, welches im 1. Durchlauf in die Menge der Finite Closure * Erstellt ein Typ-Paar, welches im 1. Durchlauf in die Menge der Finite Closure
@ -264,7 +265,7 @@ public class SourceFile
*/ */
// ino.end // ino.end
// ino.method.createPairFromClassAndSuperclass.21400.definition // ino.method.createPairFromClassAndSuperclass.21400.definition
private Pair createPairFromClassAndSuperclass(String className, String superclassName, Vector classParaOrg, Vector superclassParaOrg) private Pair createPairFromClassAndSuperclass(JavaClassName className, JavaClassName superclassName, Vector classParaOrg, Vector superclassParaOrg)
// ino.end // ino.end
// ino.method.createPairFromClassAndSuperclass.21400.body // ino.method.createPairFromClassAndSuperclass.21400.body
{ {
@ -276,15 +277,15 @@ public class SourceFile
superclassParaOrg=null; superclassParaOrg=null;
} }
Pair P = new Pair( Pair P = new Pair(
new RefType( className, classParaOrg,-1), new RefType( className.toString(), classParaOrg,-1),
new RefType( superclassName, superclassParaOrg,-1) new RefType( superclassName.toString(), superclassParaOrg,-1)
); );
//PL 04-12-29 freshe Variablen ANFANG //PL 04-12-29 freshe Variablen ANFANG
RefType r1 = (RefType)P.getTA1Copy(); RefType r1 = (RefType)P.getTA1Copy();
RefType r2 = (RefType)P.getTA2Copy(); RefType r2 = (RefType)P.getTA2Copy();
// #JB# 05.04.2005 // #JB# 05.04.2005
// ########################################################### // ###########################################################
Hashtable<String,Type> substHash = new Hashtable<String,Type>(); //fuer jedes Paar komplett neue Variablen Hashtable<JavaClassName,Type> substHash = new Hashtable<JavaClassName,Type>(); //fuer jedes Paar komplett neue Variablen
Unify.varSubst(r1, substHash); Unify.varSubst(r1, substHash);
Unify.varSubst(r2, substHash); Unify.varSubst(r2, substHash);
// ########################################################### // ###########################################################
@ -330,7 +331,7 @@ public class SourceFile
Iterator<UsedId> interfaceIterator=tempKlasse.getSuperInterfaces().iterator(); Iterator<UsedId> interfaceIterator=tempKlasse.getSuperInterfaces().iterator();
while(interfaceIterator.hasNext()){ while(interfaceIterator.hasNext()){
UsedId intf=interfaceIterator.next(); UsedId intf=interfaceIterator.next();
String interfaceName=intf.getQualifiedName(); JavaClassName interfaceName=intf.getQualifiedName();
Pair P=createPairFromClassAndSuperclass(tempKlasse.getName(),interfaceName,tempKlasse.get_ParaList(),intf.get_ParaList()); Pair P=createPairFromClassAndSuperclass(tempKlasse.getName(),interfaceName,tempKlasse.get_ParaList(),intf.get_ParaList());
vFC.add( P ); vFC.add( P );
@ -343,7 +344,7 @@ public class SourceFile
Iterator<UsedId> interfaceIterator=intf.getSuperInterfaces().iterator(); Iterator<UsedId> interfaceIterator=intf.getSuperInterfaces().iterator();
while(interfaceIterator.hasNext()){ while(interfaceIterator.hasNext()){
UsedId superintf=interfaceIterator.next(); UsedId superintf=interfaceIterator.next();
String superinterfaceName=superintf.getQualifiedName(); JavaClassName superinterfaceName=superintf.getQualifiedName();
Pair P=createPairFromClassAndSuperclass(intf.getName(),superinterfaceName,intf.getParaList(), superintf.get_ParaList()); Pair P=createPairFromClassAndSuperclass(intf.getName(),superinterfaceName,intf.getParaList(), superintf.get_ParaList());
vFC.add( P ); vFC.add( P );
@ -456,7 +457,7 @@ public class SourceFile
//es werden alle Parameter in einem Typeterm, der //es werden alle Parameter in einem Typeterm, der
//der Argumente hat ersetzt PL 04-12-28 //der Argumente hat ersetzt PL 04-12-28
Hashtable<String,Type> hts = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> hts = new Hashtable<JavaClassName,Type>();
//for(int u = nSubstStelle; u < vPara.size(); u++) { //for(int u = nSubstStelle; u < vPara.size(); u++) {
for(int u = 0; u < vPara.size(); u++) { for(int u = 0; u < vPara.size(); u++) {
try { try {
@ -467,7 +468,7 @@ public class SourceFile
// ########################################################### // ###########################################################
inferencelog.debug("Typterm_Name: " + vPara.elementAt(u)); inferencelog.debug("Typterm_Name: " + vPara.elementAt(u));
inferencelog.debug("Typterm_Name: " + ((Type)vPara.elementAt(u)).Type2String()); inferencelog.debug("Typterm_Name: " + ((Type)vPara.elementAt(u)).Type2String());
hts.put(((RefType)PSuchen.TA1).getParaN(u), vPara.elementAt(u)); hts.put(new JavaClassName(((RefType)PSuchen.TA1).getParaN(u)), vPara.elementAt(u));
} }
catch( Exception E ) { catch( Exception E ) {
inferencelog.error(E.getMessage()); inferencelog.error(E.getMessage());
@ -532,7 +533,7 @@ public class SourceFile
RefType RSuch = (RefType)PSuch.TA1; RefType RSuch = (RefType)PSuch.TA1;
//if( R.getName().equals(RSuch.getName()) ) //if( R.getName().equals(RSuch.getName()) )
if (R.is_Equiv(RSuch, new Hashtable<String,Type>())) //eingefuegt PL 05-01-07 if (R.is_Equiv(RSuch, new Hashtable<JavaClassName,Type>())) //eingefuegt PL 05-01-07
{ {
// Paar einfuegen, falls noch nicht vorhanden // Paar einfuegen, falls noch nicht vorhanden
RefType L1 = (RefType)PTemp.getTA1Copy(); RefType L1 = (RefType)PTemp.getTA1Copy();
@ -543,10 +544,10 @@ public class SourceFile
//zunaechst Variablen disjunkt machen ANFANG //zunaechst Variablen disjunkt machen ANFANG
// #JB# 05.04.2005 // #JB# 05.04.2005
// ########################################################### // ###########################################################
Hashtable<String,Type> substHash1 = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> substHash1 = new Hashtable<JavaClassName,Type>();
Unify.varSubst(L1, substHash1); Unify.varSubst(L1, substHash1);
Unify.varSubst(L2, substHash1); Unify.varSubst(L2, substHash1);
Hashtable<String,Type> substHash2 = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> substHash2 = new Hashtable<JavaClassName,Type>();
Unify.varSubst(R1, substHash2); Unify.varSubst(R1, substHash2);
Unify.varSubst(R2, substHash2); Unify.varSubst(R2, substHash2);
// ########################################################### // ###########################################################
@ -557,9 +558,9 @@ public class SourceFile
// #JB# 05.04.2005 // #JB# 05.04.2005
// ########################################################### // ###########################################################
Hashtable<String,Type> h = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> h = new Hashtable<JavaClassName,Type>();
L2.Equiv2Equal(R1, h); L2.Equiv2Equal(R1, h);
Hashtable<String,Type> substHash3 = h; Hashtable<JavaClassName,Type> substHash3 = h;
Unify.varSubst(L1, substHash3); Unify.varSubst(L1, substHash3);
Unify.varSubst(R2, substHash3); Unify.varSubst(R2, substHash3);
// ########################################################### // ###########################################################
@ -689,7 +690,7 @@ public class SourceFile
} }
xConstraints.add(cons); xConstraints.add(cons);
} }
//typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints); typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints);
////////////////////////////// //////////////////////////////
// Unifizierung der Constraints: // Unifizierung der Constraints:
@ -958,7 +959,7 @@ public class SourceFile
// Properties laden // Properties laden
java.lang.Class<?> x; java.lang.Class<?> x;
try { try {
x = java.lang.Class.forName(importDecl.getQualifiedName()); x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl); throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl);
} }
@ -1050,7 +1051,7 @@ public class SourceFile
for(int k=0;k<gpt.length;k++){ for(int k=0;k<gpt.length;k++){
Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry); Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry);
// Fixme HOTI beachte overloaded id // Fixme HOTI beachte overloaded id
method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>())); method.addParaAssumption(new CParaTypeAssumption(className, methodName, pt.length,0,type.getName().toString(), type, MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector<Integer>()));
} }
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(method)); //basicAssumptions.addMethodIntersectionType(new CIntersectionType(method));
//ret.add(method); //auskommentiert von Andreas Stadelmeier //ret.add(method); //auskommentiert von Andreas Stadelmeier
@ -1107,7 +1108,7 @@ public class SourceFile
// Properties laden // Properties laden
java.lang.Class<?> x; java.lang.Class<?> x;
try { try {
x = java.lang.Class.forName(importDecl.getQualifiedName()); x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl); throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl);
} }
@ -1269,7 +1270,7 @@ public class SourceFile
boolean found = false; boolean found = false;
for(UsedId id : searchVector) for(UsedId id : searchVector)
{ {
String s = id.getQualifiedName(); String s = id.getQualifiedName().toString();
found |= s.equals(searchString); found |= s.equals(searchString);
} }
return found; return found;
@ -1283,7 +1284,7 @@ public class SourceFile
{ {
if(type instanceof TypeVariableImpl){ if(type instanceof TypeVariableImpl){
TypeVariableImpl tvi=((TypeVariableImpl)type); TypeVariableImpl tvi=((TypeVariableImpl)type);
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName(),-1)); return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName().toString(),-1));
}else{ }else{
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName()); //String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
String jccNameForClass=baseTypeTranslationTable.get(cl.getName()); String jccNameForClass=baseTypeTranslationTable.get(cl.getName());

View File

@ -65,6 +65,8 @@ import org.apache.log4j.Logger;
@ -88,6 +90,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.exceptions.DebugException;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.unify.FC_TTO; import de.dhbwstuttgart.typeinference.unify.FC_TTO;
import de.dhbwstuttgart.typeinference.unify.Unify; import de.dhbwstuttgart.typeinference.unify.Unify;
@ -119,9 +122,9 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
{ {
this.pkgName = pkgName; this.pkgName = pkgName;
} }
public String getName() public JavaClassName getName()
{ {
return name; return new JavaClassName((this.pkgName!=null ? this.pkgName.toString() +"." : "") +this.name);
} }
public void setName(String strName) public void setName(String strName)
{ {
@ -333,7 +336,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
* @param typeinferenceResult - Das ResultSet einer Typinferierung oder null, falls alle Typen eindeutig feststehen. * @param typeinferenceResult - Das ResultSet einer Typinferierung oder null, falls alle Typen eindeutig feststehen.
* @return * @return
* @throws JVMCodeException * @throws JVMCodeException
*/
// ino.method.codegen.23071.definition // ino.method.codegen.23071.definition
public ClassFile codegen(ResultSet typeinferenceResult) public ClassFile codegen(ResultSet typeinferenceResult)
throws JVMCodeException throws JVMCodeException
@ -359,7 +362,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
//geändert von Andreas Stadelmeier: pkgName wird nicht mehr aus dem SourceFile ausgelesen: //geändert von Andreas Stadelmeier: pkgName wird nicht mehr aus dem SourceFile ausgelesen:
String packageName = ""; String packageName = "";
if(pkgName != null) packageName = pkgName.get_Name_1Element(); if(pkgName != null) packageName = pkgName.get_Name_1Element();
classfile.add_class(getName(), packageName, superClass, getAccessFlags()); classfile.add_class(getName(), superClass, getAccessFlags());
// Handling fuer Superinterfaces // Handling fuer Superinterfaces
classfile.addSuperInterfaces(getSuperInterfaces()); classfile.addSuperInterfaces(getSuperInterfaces());
@ -383,7 +386,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
codegenlog.info("Compilierung erfolgreich abgeschlossen, "+ getName() + ".class erstellt."); codegenlog.info("Compilierung erfolgreich abgeschlossen, "+ getName() + ".class erstellt.");
return classfile; return classfile;
} }
*/
public void codegen(ClassFile classfile, Vector paralist) public void codegen(ClassFile classfile, Vector paralist)
throws JVMCodeException throws JVMCodeException
{ {
@ -459,7 +462,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
// ino.method.get_Superclass_Name.23086.definition // ino.method.get_Superclass_Name.23086.definition
public String get_Superclass_Name() public JavaClassName get_Superclass_Name()
// ino.end // ino.end
// ino.method.get_Superclass_Name.23086.body // ino.method.get_Superclass_Name.23086.body
{ {
@ -663,6 +666,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
// Und los geht's: // Und los geht's:
////////////////////////////// //////////////////////////////
inferencelog.info("Rufe TRStart()..."); inferencelog.info("Rufe TRStart()...");
typinferenzLog.debug("Erstellte FiniteClosure: "+supportData);
////////////////////////////// //////////////////////////////
// Ab hier ... // Ab hier ...
// @author A10023 - Andreas Stadelmeier: // @author A10023 - Andreas Stadelmeier:
@ -939,7 +944,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
* @param me * @param me
* @param V * @param V
* @return * @return
*/
// ino.end // ino.end
// ino.method.RetType.23119.definition // ino.method.RetType.23119.definition
private Type RetType(Method me, CTypeAssumptionSet V) private Type RetType(Method me, CTypeAssumptionSet V)
@ -954,6 +959,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
} }
// ino.end // ino.end
*/
// ino.method.toString.23125.defdescription type=javadoc // ino.method.toString.23125.defdescription type=javadoc
/** /**
* <br/>Author: Martin Pl�micke * <br/>Author: Martin Pl�micke
@ -1167,7 +1173,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
// ino.end // ino.end
// ino.method.getSimpleName.23140.body // ino.method.getSimpleName.23140.body
{ {
return UsedId.createFromQualifiedName(getName(),-1).getSimpleName(); return UsedId.createFromQualifiedName(getName().toString(),-1).getSimpleName();
} }
// ino.end // ino.end
@ -1289,7 +1295,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
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. 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.
} }
*/ */
return new RefType(this.getName(), this.get_ParaList(), 0); return new RefType(this.getName().toString(), this.get_ParaList(), 0);
} }
@ -1342,7 +1348,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
} }
} }
if(!constructorVorhanden){//Falls kein Konstruktor vorhanden ist, muss noch der Standardkonstruktor angefügt werden: if(!constructorVorhanden){//Falls kein Konstruktor vorhanden ist, muss noch der Standardkonstruktor angefügt werden:
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(this.getName(), this)); Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(this.getName().toString(), this));
this.addField(standardKonstruktor); this.addField(standardKonstruktor);
} }

View File

@ -162,7 +162,7 @@ throws SCClassBodyException
SCExcept e = new SCExcept(); SCExcept e = new SCExcept();
e.set_error("unbekannte Klasse "+t.getName()+"."); e.set_error("unbekannte Klasse "+t.getName()+".");
e.set_function("complete_parahashtable() --> is_declared()"); e.set_function("complete_parahashtable() --> is_declared()");
e.set_statement(t.getName()); e.set_statement(t.getName().toString());
ex.addException(e); ex.addException(e);
throw ex; throw ex;
} }

View File

@ -12,6 +12,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import mycompiler.mybytecode.AttributeInfo; import mycompiler.mybytecode.AttributeInfo;
import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.ClassFile;
@ -118,11 +119,11 @@ public class Constant extends Method
// ino.end // ino.end
// ino.method.getTypeName.23243.definition // ino.method.getTypeName.23243.definition
public String getTypeName() public JavaClassName getTypeName()
// ino.end // ino.end
// ino.method.getTypeName.23243.body // ino.method.getTypeName.23243.body
{ {
return name; return new JavaClassName(name);
} }
// ino.end // ino.end
@ -169,7 +170,7 @@ public class Constant extends Method
{ {
// Zugehoerigen Typ (I, Z, C, Ljava/lang/String;) fuer den Typ ermitteln // Zugehoerigen Typ (I, Z, C, Ljava/lang/String;) fuer den Typ ermitteln
String bcgType = JVMCode.get_codegen_Type(typ.getName(), paralist); String bcgType = JVMCode.get_codegen_Type(typ.getName().toString(), paralist);
if (getValue() == null || !(getValue() instanceof Literal) ) { if (getValue() == null || !(getValue() instanceof Literal) ) {
throw new JVMCodeException("Die Generierung der Konstante wird nicht unterstuetzt!"); throw new JVMCodeException("Die Generierung der Konstante wird nicht unterstuetzt!");

View File

@ -16,6 +16,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import mycompiler.mybytecode.ClassFile; import mycompiler.mybytecode.ClassFile;
import mycompiler.myexception.JVMCodeException; import mycompiler.myexception.JVMCodeException;
import mycompiler.mymodifier.Modifiers; import mycompiler.mymodifier.Modifiers;
@ -57,7 +58,7 @@ public class Constructor extends Method {
} }
@Override @Override
public String getTypeName() { public JavaClassName getTypeName() {
return this.getType().getName(); return this.getType().getName();
} }

View File

@ -142,7 +142,7 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
// ino.end // ino.end
// ino.method.getTypeName.23416.body // ino.method.getTypeName.23416.body
{ if(this.getType() == null)return ""; { if(this.getType() == null)return "";
return this.getType().getName(); return this.getType().getName().toString();
} }
// ino.end // ino.end

View File

@ -42,6 +42,7 @@ import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption; import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
@ -173,7 +174,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
// ino.end // ino.end
// ino.method.getTypeName.23533.definition // ino.method.getTypeName.23533.definition
public String getTypeName() public JavaClassName getTypeName()
// ino.end // ino.end
// ino.method.getTypeName.23533.body // ino.method.getTypeName.23533.body
{ {

View File

@ -212,7 +212,7 @@ public class DeclId
if (type instanceof RefType) if (type instanceof RefType)
codegen_type = ((RefType)type).get_codegen_Type(null); codegen_type = ((RefType)type).get_codegen_Type(null);
else else
codegen_type = JVMCode.get_codegen_Type(type.getName(), paralist); codegen_type = JVMCode.get_codegen_Type(type.getName().toString(), paralist);
// Instanzvariable genenerieren // Instanzvariable genenerieren
@ -223,7 +223,7 @@ public class DeclId
if(wert instanceof Expr) { if(wert instanceof Expr) {
classfile.add_field_ref(name, null, codegen_type); classfile.add_field_ref(name, null, codegen_type);
Assign assign = new Assign(getOffset(),name.length()); Assign assign = new Assign(getOffset(),name.length());
assign.set_Expr(new InstVar(name, type.getName(),getOffset()), (Expr)wert); assign.set_Expr(new InstVar(name, type.getName().toString(),getOffset()), (Expr)wert);
classfile.add_classblock_Element(assign); classfile.add_classblock_Element(assign);
} }
else throw new JVMCodeException("Wertzuweisung der Instanzvariable kann nicht uebersetzt werden!"); else throw new JVMCodeException("Wertzuweisung der Instanzvariable kann nicht uebersetzt werden!");

View File

@ -10,6 +10,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import mycompiler.mybytecode.JVMCode; import mycompiler.mybytecode.JVMCode;
@ -182,7 +183,7 @@ public class UsedId implements IItemWithOffset
// ino.end // ino.end
// ino.method.getSignatureUsedId.23717.body // ino.method.getSignatureUsedId.23717.body
{ {
String basis = JVMCode.get_codegen_Type(getQualifiedName(),null); String basis = JVMCode.get_codegen_Type(getQualifiedName().toString(),null);
if (paralist == null || paralist.size() ==0) if (paralist == null || paralist.size() ==0)
return basis; return basis;
@ -241,7 +242,7 @@ public class UsedId implements IItemWithOffset
// ino.end // ino.end
// ino.method.getQualifiedName.23726.definition // ino.method.getQualifiedName.23726.definition
public String getQualifiedName() public JavaClassName getQualifiedName()
// ino.end // ino.end
// ino.method.getQualifiedName.23726.body // ino.method.getQualifiedName.23726.body
{ {
@ -253,7 +254,7 @@ public class UsedId implements IItemWithOffset
sb.append("."); sb.append(".");
} }
} }
return(sb.toString()); return new JavaClassName(sb.toString());
} }
// ino.end // ino.end
@ -312,7 +313,7 @@ public class UsedId implements IItemWithOffset
public JavaCodeResult printJavaCode(ResultSet resultSet) { public JavaCodeResult printJavaCode(ResultSet resultSet) {
if(this.name.size()>1)throw new TypeinferenceException("Es kann maximal nur eine Superklasse pro Klasse geben", this); if(this.name.size()>1)throw new TypeinferenceException("Es kann maximal nur eine Superklasse pro Klasse geben", this);
JavaCodeResult ret = new JavaCodeResult(this.getQualifiedName()); JavaCodeResult ret = new JavaCodeResult(this.getQualifiedName().toString());
if(this.paralist != null){ if(this.paralist != null){
ret.attach( "<" ); ret.attach( "<" );
Iterator<Type> it = this.paralist.iterator(); Iterator<Type> it = this.paralist.iterator();

View File

@ -35,6 +35,7 @@ import org.apache.log4j.Logger;
import de.dhbwstuttgart.core.SyntaxTreeNode; import de.dhbwstuttgart.core.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
@ -48,6 +49,7 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.SingleConstraint;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.unify.Unify; import de.dhbwstuttgart.typeinference.unify.Unify;
@ -138,13 +140,13 @@ public class Assign extends Expr
// LocalVar // LocalVar
try try
{ {
String local_type = code.get_TypeOf_Var(local_name).getName(); JavaClassName local_type = code.get_TypeOf_Var(local_name).getName();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type.toString(), index));
} }
catch(JVMCodeException e) catch(JVMCodeException e)
{ {
// out of nload_n // out of nload_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }
@ -166,13 +168,13 @@ public class Assign extends Expr
// LocalVar // LocalVar
try try
{ {
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nstore_n(local_type, index)); code.add_code(JVMCode.nstore_n(local_type, index));
} }
catch(JVMCodeException e) catch(JVMCodeException e)
{ {
// out of nstore_n // out of nstore_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nstore(local_type)); code.add_code(JVMCode.nstore(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }

View File

@ -111,7 +111,7 @@ public class CastExpr extends UnaryExpr
// ino.end // ino.end
// ino.method.codegen.25154.body // ino.method.codegen.25154.body
{ {
int itype = JVMCode.get_nType(type.getName()); int itype = JVMCode.get_nType(type.getName().toString());
int iexpr = JVMCode.get_nType(expr.getTypeName()); int iexpr = JVMCode.get_nType(expr.getTypeName());
if(itype != iexpr) if(itype != iexpr)
{ {
@ -122,7 +122,7 @@ public class CastExpr extends UnaryExpr
else else
{ {
expr.set_Type(type); expr.set_Type(type);
code.add_code(JVMCode.n2n(expr.getTypeName(), type.getName())); code.add_code(JVMCode.n2n(expr.getTypeName(), type.getName().toString()));
} }
} }
else if(itype == 4) expr.set_Type(type); else if(itype == 4) expr.set_Type(type);

View File

@ -52,7 +52,7 @@ public abstract class ExprStmt extends Statement implements ITypeReplacementList
// ino.method.getTypeName.25279.body // ino.method.getTypeName.25279.body
{ {
if (getType()!=null) if (getType()!=null)
return getType().getName(); return getType().getName().toString();
else else
return null; return null;
} }

View File

@ -113,7 +113,7 @@ public class InstanceOf extends BinaryExpr
{ {
expr.codegen(classfile, code, paralist); expr.codegen(classfile, code, paralist);
code.add_code(JVMCode.instanceof_); code.add_code(JVMCode.instanceof_);
code.add_code_short(classfile.add_CONSTANT_Class_info(reftype.getName())); code.add_code_short(classfile.add_CONSTANT_Class_info(reftype.getName().toString()));
} }
// ino.end // ino.end

View File

@ -133,13 +133,13 @@ public class LocalOrFieldVar extends Expr
// LocalVar // LocalVar
try try
{ {
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type, index));
} }
catch(JVMCodeException e) catch(JVMCodeException e)
{ {
// out of nstore_n // out of nstore_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }
@ -162,7 +162,7 @@ public class LocalOrFieldVar extends Expr
RefType rt = (RefType) this.getType(); RefType rt = (RefType) this.getType();
if (! rt.getPrimitiveFlag()) return; if (! rt.getPrimitiveFlag()) return;
if (rt.getName().equalsIgnoreCase("java.lang.Integer")) { // Int Unboxen if (rt.getName().toString().equalsIgnoreCase("java.lang.Integer")) { // Int Unboxen
code.add_code(JVMCode.invokevirtual); code.add_code(JVMCode.invokevirtual);
code.add_code_short(classfile.add_method_ref("java/lang/Integer", "intValue", "()I")); code.add_code_short(classfile.add_method_ref("java/lang/Integer", "intValue", "()I"));
} }

View File

@ -174,7 +174,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
SCExcept e = new SCExcept(); SCExcept e = new SCExcept();
e.set_error("unbekannte Klasse "+t.getName()+"."); e.set_error("unbekannte Klasse "+t.getName()+".");
e.set_function("complete_parahashtable() --> is_declared()"); e.set_function("complete_parahashtable() --> is_declared()");
e.set_statement(t.getName()); e.set_statement(t.getName().toString());
ex.addException(e); ex.addException(e);
throw ex; throw ex;
} }
@ -224,7 +224,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
SCExcept e = new SCExcept(); SCExcept e = new SCExcept();
e.set_error("Klasse "+c.getName()+" ist falsch parametrisiert!"); e.set_error("Klasse "+c.getName()+" ist falsch parametrisiert!");
e.set_function("complete_parahashtable() --> check_anz()"); e.set_function("complete_parahashtable() --> check_anz()");
e.set_statement(type.getName()); e.set_statement(type.getName().toString());
ex.addException(e); ex.addException(e);
throw ex; throw ex;
} }
@ -234,7 +234,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
SCExcept e = new SCExcept(); SCExcept e = new SCExcept();
e.set_error("Klasse "+c.getName()+" ist nicht parametrisierbar!"); e.set_error("Klasse "+c.getName()+" ist nicht parametrisierbar!");
e.set_function("complete_parahashtable() --> check_anz()"); e.set_function("complete_parahashtable() --> check_anz()");
e.set_statement(type.getName()); e.set_statement(type.getName().toString());
ex.addException(e); ex.addException(e);
throw ex; throw ex;
} }
@ -245,7 +245,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
SCExcept e = new SCExcept(); SCExcept e = new SCExcept();
e.set_error("Klasse "+c.getName()+" <20>berhaupt garnicht parametrisiert!"); e.set_error("Klasse "+c.getName()+" <20>berhaupt garnicht parametrisiert!");
e.set_function("complete_parahashtable() --> check_anz()"); e.set_function("complete_parahashtable() --> check_anz()");
e.set_statement(type.getName()); e.set_statement(type.getName().toString());
ex.addException(e); ex.addException(e);
throw ex; throw ex;
@ -266,7 +266,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
e.set_error("Type " + type.getName()+ " falsche Parameter-Anzahl " + ((RefType)type).get_ParaList().size()); e.set_error("Type " + type.getName()+ " falsche Parameter-Anzahl " + ((RefType)type).get_ParaList().size());
} }
e.set_function("complete_parahashtable() --> check_anz()"); e.set_function("complete_parahashtable() --> check_anz()");
e.set_statement(type.getName()); e.set_statement(type.getName().toString());
ex.addException(e); ex.addException(e);
throw ex; throw ex;
} }

View File

@ -45,6 +45,7 @@ import org.apache.log4j.Logger;
import de.dhbwstuttgart.core.SyntaxTreeNode; import de.dhbwstuttgart.core.SyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.ClassBody; import de.dhbwstuttgart.syntaxtree.ClassBody;
@ -67,6 +68,7 @@ import de.dhbwstuttgart.typeinference.Overloading;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.unify.FC_TTO; import de.dhbwstuttgart.typeinference.unify.FC_TTO;
import de.dhbwstuttgart.typeinference.unify.Unify; import de.dhbwstuttgart.typeinference.unify.Unify;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
@ -290,13 +292,13 @@ public class MethodCall extends Expr
if (index != -1 ) { // Lokale Variable if (index != -1 ) { // Lokale Variable
try { try {
String local_type = code.get_TypeOf_Var(local_name) JavaClassName local_type = code.get_TypeOf_Var(local_name)
.getName(); .getName();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type.toString(), index));
} catch (JVMCodeException e) { // out of nload_n } catch (JVMCodeException e) { // out of nload_n
String local_type = code.get_TypeOf_Var(local_name) JavaClassName local_type = code.get_TypeOf_Var(local_name)
.getName(); .getName();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type.toString()));
code.add_code_byte((byte) index); code.add_code_byte((byte) index);
} }
} else { // FieldVariable } else { // FieldVariable
@ -417,11 +419,11 @@ public class MethodCall extends Expr
// Typannahme f<EFBFBD>r Methode heraussuchen: // Typannahme f<EFBFBD>r Methode heraussuchen:
// -------------------------- // --------------------------
String className; String className;
if(classType instanceof RefType){ if(classType instanceof RefType){
className=((RefType)classType).getTypeName(); className=((RefType)classType).getTypeName();
}else{ }else{
className=classType.getName(); className=classType.getName().toString();
} }
CMethodKey key = new CMethodKey( CMethodKey key = new CMethodKey(

View File

@ -137,10 +137,10 @@ public class NewArray extends Expr
// ino.end // ino.end
// ino.method.codegen.25818.body // ino.method.codegen.25818.body
{ {
if(JVMCode.get_nType(this.getType().getName()) == 4) { if(JVMCode.get_nType(this.getType().getName().toString()) == 4) {
for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist); for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist);
code.add_code(JVMCode.anewarray); code.add_code(JVMCode.anewarray);
code.add_code_short(classfile.add_CONSTANT_Class_info(this.getType().getName())); code.add_code_short(classfile.add_CONSTANT_Class_info(this.getType().getName().toString()));
} }
else { else {
for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist); for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist);

View File

@ -128,7 +128,7 @@ public class NewClass extends Expr
for(Enumeration<Class> el = classname.elements(); el.hasMoreElements();) for(Enumeration<Class> el = classname.elements(); el.hasMoreElements();)
{ {
cl = el.nextElement(); cl = el.nextElement();
next = (String)cl.getName(); next = (String)cl.getName().toString();
if(ext) if(ext)
parserlog.debug("Vergleiche "+usedid+" mit "+next); parserlog.debug("Vergleiche "+usedid+" mit "+next);
if(usedid.equals(next)) if(usedid.equals(next))

View File

@ -115,11 +115,11 @@ public class PostDecExpr extends UnaryExpr
index = code.get_indexOf_Var(local_name); index = code.get_indexOf_Var(local_name);
if(index != -1) { // LocalVar if(index != -1) { // LocalVar
try{ try{
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type, index));
} }
catch(JVMCodeException e) { // out of nload_n catch(JVMCodeException e) { // out of nload_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }

View File

@ -122,11 +122,11 @@ public class PostIncExpr extends UnaryExpr
index = code.get_indexOf_Var(local_name); index = code.get_indexOf_Var(local_name);
if(index != -1) { // LocalVar if(index != -1) { // LocalVar
try{ try{
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type, index));
} }
catch(JVMCodeException e) { // out of nload_n catch(JVMCodeException e) { // out of nload_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }

View File

@ -115,11 +115,11 @@ public class PreDecExpr extends UnaryExpr
index = code.get_indexOf_Var(local_name); index = code.get_indexOf_Var(local_name);
if(index != -1) { // LocalVar if(index != -1) { // LocalVar
try{ try{
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type, index));
} }
catch(JVMCodeException e) { // out of nload_n catch(JVMCodeException e) { // out of nload_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }

View File

@ -116,11 +116,11 @@ public class PreIncExpr extends UnaryExpr
index = code.get_indexOf_Var(local_name); index = code.get_indexOf_Var(local_name);
if(index != -1) { // LocalVar if(index != -1) { // LocalVar
try{ try{
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload_n(local_type, index)); code.add_code(JVMCode.nload_n(local_type, index));
} }
catch(JVMCodeException e) { // out of nload_n catch(JVMCodeException e) { // out of nload_n
String local_type = code.get_TypeOf_Var(local_name).getName(); String local_type = code.get_TypeOf_Var(local_name).getName().toString();
code.add_code(JVMCode.nload(local_type)); code.add_code(JVMCode.nload(local_type));
code.add_code_byte((byte)index); code.add_code_byte((byte)index);
} }

View File

@ -111,7 +111,7 @@ public class BoundedGenericTypeVar extends GenericTypeVar
// ino.end // ino.end
// ino.method.clone.26483.body // ino.method.clone.26483.body
{ {
return new BoundedGenericTypeVar(this.getName(), this.getBounds(), getOffset(), this.getEndOffset()); return new BoundedGenericTypeVar(this.getName().toString(), this.getBounds(), getOffset(), this.getEndOffset());
} }
// ino.end // ino.end

View File

@ -44,7 +44,7 @@ public class FreshExtendsWildcardType extends FreshWildcardType implements IMatc
*/ */
public FreshExtendsWildcardType clone() public FreshExtendsWildcardType clone()
{ {
return new FreshExtendsWildcardType(this.extendsBoundType.clone(),getOffset(),this.name); return new FreshExtendsWildcardType(this.extendsBoundType.clone(),getOffset(),this.name.toString());
} }
/** /**

View File

@ -44,7 +44,7 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
*/ */
public FreshSuperWildcardType clone() public FreshSuperWildcardType clone()
{ {
return new FreshSuperWildcardType(this.superBoundType.clone(),getOffset(),this.name); return new FreshSuperWildcardType(this.superBoundType.clone(),getOffset(),this.name.toString());
} }
/** /**

View File

@ -4,6 +4,7 @@ import java.util.Vector;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
public class FreshWildcardType extends Type { public class FreshWildcardType extends Type {
@ -29,7 +30,7 @@ public class FreshWildcardType extends Type {
protected FreshWildcardType(int offset, String name) protected FreshWildcardType(int offset, String name)
{ {
super(offset); super(offset);
this.name = name; this.name = new JavaClassName(name);
} }
/** /**
@ -60,7 +61,7 @@ public class FreshWildcardType extends Type {
*/ */
public FreshWildcardType clone() public FreshWildcardType clone()
{ {
return new FreshWildcardType(getOffset(),this.name); return new FreshWildcardType(getOffset(),this.name.toString());
} }
/** /**
@ -79,7 +80,7 @@ public class FreshWildcardType extends Type {
* Erzeugt einen neuen Namen, und gibt diesen zurück * Erzeugt einen neuen Namen, und gibt diesen zurück
* Methode aus TypePlaceholder kopiert * Methode aus TypePlaceholder kopiert
*/ */
private static String makeNewName() private static JavaClassName makeNewName()
{ {
// luar: Methode aus TypePlaceholder kopiert. // luar: Methode aus TypePlaceholder kopiert.
String strReturn = strNextName; String strReturn = strNextName;
@ -87,7 +88,7 @@ public class FreshWildcardType extends Type {
// ¿½chster Name berechnen und in strNextName speichern // ¿½chster Name berechnen und in strNextName speichern
inc( strNextName.length() - 1 ); inc( strNextName.length() - 1 );
return strReturn; return new JavaClassName(strReturn);
} }
/** /**
@ -165,7 +166,7 @@ public class FreshWildcardType extends Type {
} }
@Override @Override
public JavaCodeResult printJavaCode(ResultSet resultSet) { public JavaCodeResult printJavaCode(ResultSet resultSet) {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }

View File

@ -23,12 +23,14 @@ import java.util.Vector;
import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.ConstraintsSet;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.SingleConstraint;
import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
@ -80,7 +82,7 @@ public class GenericTypeVar extends Type
// ino.method.GenericTypeVar.26509.body // ino.method.GenericTypeVar.26509.body
{ {
super(offset); super(offset);
this.name = s; this.name = new JavaClassName(s);
} }
// ino.end // ino.end
@ -100,7 +102,7 @@ public class GenericTypeVar extends Type
// ino.end // ino.end
// ino.method.clone.26512.body // ino.method.clone.26512.body
{ {
return new GenericTypeVar(this.getName(),getOffset()); return new GenericTypeVar(this.getName().toString(),getOffset());
} }
// ino.end // ino.end
@ -182,12 +184,12 @@ public class GenericTypeVar extends Type
return ret; return ret;
} }
*/ */
return new JavaCodeResult(this.name); return new JavaCodeResult(this.name.toString());
} }
public TypePlaceholder getTypePlaceHolder() { public TypePlaceholder getTypePlaceHolder() {
if(!GenericTypeVar.tph.containsKey(this)){ if(!GenericTypeVar.tph.containsKey(this)){
GenericTypeVar.tph.put(this, TypePlaceholder.fresh(this.getName())); GenericTypeVar.tph.put(this, TypePlaceholder.fresh(this.getName().toString()));
} }
return GenericTypeVar.tph.get(this); return GenericTypeVar.tph.get(this);
//if(this.tph == null)this.tph = TypePlaceholder.fresh(); //if(this.tph == null)this.tph = TypePlaceholder.fresh();
@ -196,11 +198,11 @@ public class GenericTypeVar extends Type
@Override @Override
public String get_Name() { public String get_Name() {
return this.getName(); return this.getName().toString();
} }
@Override @Override
public String getName() { public JavaClassName getName() {
return this.name; return this.name;
} }
@ -221,7 +223,7 @@ public class GenericTypeVar extends Type
} }
public int getEndOffset() { public int getEndOffset() {
return this.getOffset() + this.name.length(); return this.getOffset() + this.name.toString().length();
} }
} }

View File

@ -6,6 +6,8 @@ import java.util.Hashtable;
import java.util.Vector; import java.util.Vector;
// ino.end // ino.end
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
@ -249,7 +251,7 @@ public class Pair
// ino.method.Pair_isEquiv.26582.body // ino.method.Pair_isEquiv.26582.body
{ {
//vergleicht Paare mit Reftype's, bis auf Variablenumbennung //vergleicht Paare mit Reftype's, bis auf Variablenumbennung
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
//System.out.println((((RefType)TA1).is_Equiv((RefType)p.TA1, ht))); //System.out.println((((RefType)TA1).is_Equiv((RefType)p.TA1, ht)));
//System.out.println(((RefType)TA2).is_Equiv((RefType)p.TA2, ht)); //System.out.println(((RefType)TA2).is_Equiv((RefType)p.TA2, ht));

View File

@ -29,6 +29,7 @@ import org.apache.log4j.Logger;
import de.dhbwstuttgart.core.IItemWithOffset; import de.dhbwstuttgart.core.IItemWithOffset;
import de.dhbwstuttgart.syntaxtree.misc.UsedId; import de.dhbwstuttgart.syntaxtree.misc.UsedId;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
@ -36,6 +37,7 @@ import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
@ -134,7 +136,7 @@ public class RefType extends Type implements IMatchable
*/ */
public RefType( Type baseType ){ public RefType( Type baseType ){
super(baseType.getOffset()); super(baseType.getOffset());
this.setName(baseType.name); this.setName(baseType.name.toString());
//this.parameter = null; //this.parameter = null;
} }
@ -145,7 +147,7 @@ public class RefType extends Type implements IMatchable
{ {
if(parameter==null) if(parameter==null)
{ {
return name; return name.toString();
} }
else else
{ {
@ -169,7 +171,7 @@ public class RefType extends Type implements IMatchable
{ {
if(parameter==null) if(parameter==null)
{ {
return name; return name.toString();
} }
else else
{ {
@ -276,20 +278,24 @@ public class RefType extends Type implements IMatchable
// ino.end // ino.end
// ino.method.setName.26655.body // ino.method.setName.26655.body
{ {
this.name = name; this.name = new JavaClassName(name);
} }
// ino.end // ino.end
public void setName( JavaClassName name ){
this.name = name;
}
@Override @Override
public String get_Name() public String get_Name()
{ {
return getName(); return getName().toString();
} }
// ino.method.getName.26658.definition // ino.method.getName.26658.definition
public String getName() public JavaClassName getName()
// ino.end // ino.end
// ino.method.getName.26658.body // ino.method.getName.26658.body
{ {
@ -335,8 +341,8 @@ public class RefType extends Type implements IMatchable
else paralist.add(t); else paralist.add(t);
}*/ }*/
this.parameter = v;//paralist; this.parameter = v;//paralist;
parserlog.debug("T->Type.java->set_ParaList->parameter: " + parameter); //parserlog.debug("T->Type.java->set_ParaList->parameter: " + parameter);
parserlog.debug("T->Type.java->get_Type: " + getName()); //parserlog.debug("T->Type.java->get_Type: " + getName());
} }
// ino.end // ino.end
@ -364,7 +370,7 @@ public class RefType extends Type implements IMatchable
// ino.method.getTypeName.26670.body // ino.method.getTypeName.26670.body
{ {
// otth: Liefert den Namen des Typs, ohne Parameter, z.B. Stapel bei Stapel<IntZahl> // otth: Liefert den Namen des Typs, ohne Parameter, z.B. Stapel bei Stapel<IntZahl>
return name; return name.toString();
} }
// ino.end // ino.end
@ -383,7 +389,7 @@ public class RefType extends Type implements IMatchable
if( n >= parameter.size() ) if( n >= parameter.size() )
return ""; return "";
return ((Type)parameter.elementAt(n)).getName(); return ((Type)parameter.elementAt(n)).getName().toString();
} }
// ino.end // ino.end
@ -402,7 +408,7 @@ public class RefType extends Type implements IMatchable
// GenericTypeVar ergaenzt PL 06-03-16 // GenericTypeVar ergaenzt PL 06-03-16
// ino.end // ino.end
// ino.method.is_Equiv.26679.definition // ino.method.is_Equiv.26679.definition
public boolean is_Equiv(RefType ty2, Hashtable<String,Type> ht) public boolean is_Equiv(RefType ty2, Hashtable<JavaClassName,Type> ht)
// ino.end // ino.end
// ino.method.is_Equiv.26679.body // ino.method.is_Equiv.26679.body
{ {
@ -469,7 +475,7 @@ public class RefType extends Type implements IMatchable
// ino.end // ino.end
// ino.method.Equiv2Equal.26682.definition // ino.method.Equiv2Equal.26682.definition
public boolean Equiv2Equal(RefType ty2, Hashtable<String,Type> ht) public boolean Equiv2Equal(RefType ty2, Hashtable<JavaClassName,Type> ht)
// ino.end // ino.end
// ino.method.Equiv2Equal.26682.body // ino.method.Equiv2Equal.26682.body
{ {
@ -499,7 +505,7 @@ public class RefType extends Type implements IMatchable
else { //Typvariablen gleich machen else { //Typvariablen gleich machen
// #JB# 11.04.2005 // #JB# 11.04.2005
// ########################################################### // ###########################################################
((TypePlaceholder)pty2).backdoorSetName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName()); ((TypePlaceholder)pty2).backdoorSetName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().toString());
//pty2.setName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName()); //pty2.setName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName());
// ########################################################### // ###########################################################
} }
@ -511,7 +517,7 @@ public class RefType extends Type implements IMatchable
ht.put(pty1.getName(), pty2); ht.put(pty1.getName(), pty2);
// #JB# 11.04.2005 // #JB# 11.04.2005
// ########################################################### // ###########################################################
((TypePlaceholder)pty2).backdoorSetName(pty1.getName()); ((TypePlaceholder)pty2).backdoorSetName(pty1.getName().toString());
//pty2.setName(pty1.getName()); //pty2.setName(pty1.getName());
// ########################################################### // ###########################################################
} }
@ -631,7 +637,7 @@ public class RefType extends Type implements IMatchable
para = para +", "+ t; para = para +", "+ t;
else para = " " + t; else para = " " + t;
} }
String ret = name; String ret = name.toString();
if(parameter.size()>0)ret += "<"+para + " >"; if(parameter.size()>0)ret += "<"+para + " >";
return ret + primitiveFlagMarker;//name + "<"+para + " >" +primitiveFlagMarker; return ret + primitiveFlagMarker;//name + "<"+para + " >" +primitiveFlagMarker;
} }
@ -643,7 +649,7 @@ public class RefType extends Type implements IMatchable
// ino.end // ino.end
// ino.method.modifyToGenericTypeVar.26694.body // ino.method.modifyToGenericTypeVar.26694.body
{ {
return new GenericTypeVar(this.name,getOffset()); return new GenericTypeVar(this.name.toString(),getOffset());
} }
// ino.end // ino.end
@ -742,7 +748,7 @@ public class RefType extends Type implements IMatchable
@Override @Override
public JavaCodeResult printJavaCode(ResultSet resultSet) { public JavaCodeResult printJavaCode(ResultSet resultSet) {
JavaCodeResult ret = new JavaCodeResult(this.name); JavaCodeResult ret = new JavaCodeResult(this.name.toString());
if(this.get_ParaList()!=null && this.get_ParaList().size()>0){ if(this.get_ParaList()!=null && this.get_ParaList().size()>0){
ret .attach( "<" ); ret .attach( "<" );
Iterator<Type> it = this.get_ParaList().iterator(); Iterator<Type> it = this.get_ParaList().iterator();

View File

@ -42,6 +42,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
*/ */
public String toString() public String toString()
{ {
System.out.println("!");
return "? super " + superType.toString(); return "? super " + superType.toString();
} }
@ -52,7 +53,6 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
*/ */
public SuperWildcardType clone() public SuperWildcardType clone()
{ {
//Hier ist unklar, ob der Supertyp auch geklont werden muss.
return new SuperWildcardType(getOffset(), superType.clone()); return new SuperWildcardType(getOffset(), superType.clone());
} }
@ -126,7 +126,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
@Override @Override
public JavaCodeResult printJavaCode(ResultSet result){ public JavaCodeResult printJavaCode(ResultSet result){
return new JavaCodeResult(this.toString()); return new JavaCodeResult("? super " + this.superType.printJavaCode(resultSet));
} }
} }

View File

@ -12,6 +12,7 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import mycompiler.mybytecode.JVMCode; import mycompiler.mybytecode.JVMCode;
@ -23,7 +24,7 @@ public class Type implements IItemWithOffset
// ino.class.Type.26716.body // ino.class.Type.26716.body
{ {
// ino.attribute.name.26720.declaration // ino.attribute.name.26720.declaration
protected String name; protected JavaClassName name;
// ino.end // ino.end
// ino.attribute.used.26723.declaration // ino.attribute.used.26723.declaration
protected UsedId used; protected UsedId used;
@ -38,7 +39,7 @@ public class Type implements IItemWithOffset
// ino.method.Type.26729.body // ino.method.Type.26729.body
{ {
this(offset); this(offset);
this.name = s; this.name = new JavaClassName(s);
} }
// ino.end // ino.end
@ -69,7 +70,7 @@ public class Type implements IItemWithOffset
// ino.end // ino.end
// ino.method.getVariableLength.26738.body // ino.method.getVariableLength.26738.body
{ {
if(this.name!=null){return this.name.length();} if(this.name!=null){return this.name.toString().length();}
else{return 1;} else{return 1;}
} }
// ino.end // ino.end
@ -116,7 +117,7 @@ public class Type implements IItemWithOffset
// ino.end // ino.end
// ino.method.get_codegen_Type.26750.body // ino.method.get_codegen_Type.26750.body
{ {
return JVMCode.get_codegen_Type(name, paralist); return JVMCode.get_codegen_Type(name.toString(), paralist);
} }
// ino.end // ino.end
@ -154,7 +155,7 @@ public class Type implements IItemWithOffset
// ino.end // ino.end
// ino.method.getName.26762.definition // ino.method.getName.26762.definition
public String getName() public JavaClassName getName()
// ino.end // ino.end
// ino.method.getName.26762.body // ino.method.getName.26762.body
{ {
@ -195,7 +196,7 @@ public class Type implements IItemWithOffset
// ino.end // ino.end
// ino.method.clone.26768.body // ino.method.clone.26768.body
{ {
return new Type(this.getName(),getOffset()); return new Type(this.getName().toString(),getOffset());
} }
// ino.end // ino.end
@ -210,7 +211,7 @@ public class Type implements IItemWithOffset
// ino.end // ino.end
// ino.method.toString.26771.body // ino.method.toString.26771.body
{ {
return getName(); return getName().toString();
} }
// ino.end // ino.end
@ -243,12 +244,12 @@ public class Type implements IItemWithOffset
// ino.end // ino.end
// ino.method.getSimpleName.26777.body // ino.method.getSimpleName.26777.body
{ {
return UsedId.createFromQualifiedName(getName(),getOffset()).getSimpleName(); return UsedId.createFromQualifiedName(getName().toString(),getOffset()).getSimpleName();
} }
// ino.end // ino.end
public JavaCodeResult printJavaCode(ResultSet resultSet){ public JavaCodeResult printJavaCode(ResultSet resultSet){
return new JavaCodeResult(this.name); return new JavaCodeResult(this.name.toString());
} }
/** /**

View File

@ -12,6 +12,7 @@ import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.JavaCodeResult;
import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.ResultSet;
import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.TypeInsertable;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
@ -38,7 +39,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
private static String strNextName = "A"; private static String strNextName = "A";
// ino.end // ino.end
// ino.attribute.m_TypePlaceholdersRegistry.26788.declaration // ino.attribute.m_TypePlaceholdersRegistry.26788.declaration
private static Hashtable<String, TypePlaceholder> m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>(); private static Hashtable<JavaClassName, TypePlaceholder> m_TypePlaceholdersRegistry = new Hashtable<JavaClassName, TypePlaceholder>();
// ino.end // ino.end
// ino.attribute.m_ReplacementListeners.26791.declaration // ino.attribute.m_ReplacementListeners.26791.declaration
@ -59,7 +60,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
// ino.method.TypePlaceholder.26794.body // ino.method.TypePlaceholder.26794.body
{ {
super(-1); super(-1);
this.name = typeName; this.name = new JavaClassName(typeName);
m_ReplacementListeners = new Vector<ITypeReplacementListener>(); m_ReplacementListeners = new Vector<ITypeReplacementListener>();
} }
// ino.end // ino.end
@ -114,7 +115,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
TypePlaceholder typeVar = new TypePlaceholder(name); TypePlaceholder typeVar = new TypePlaceholder(name);
TypePlaceholder oldTPH = m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar); TypePlaceholder oldTPH = m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar);
if(oldTPH != null){ if(oldTPH != null){
oldTPH.name = makeNewName(); oldTPH.name = new JavaClassName(makeNewName());
m_TypePlaceholdersRegistry.put(oldTPH.getName(), oldTPH); m_TypePlaceholdersRegistry.put(oldTPH.getName(), oldTPH);
} }
return typeVar; return typeVar;
@ -398,7 +399,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
// ino.method.deleteRegistry.26839.body // ino.method.deleteRegistry.26839.body
{ {
m_TypePlaceholdersRegistry.clear(); m_TypePlaceholdersRegistry.clear();
m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>(); m_TypePlaceholdersRegistry = new Hashtable<JavaClassName, TypePlaceholder>();
} }
// ino.end // ino.end
@ -419,7 +420,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
// ino.end // ino.end
// ino.method.clone.26842.body // ino.method.clone.26842.body
{ {
TypePlaceholder dolly = new TypePlaceholder(name); TypePlaceholder dolly = new TypePlaceholder(name.toString());
dolly.m_ReplacementListeners = (Vector<ITypeReplacementListener>)m_ReplacementListeners.clone(); dolly.m_ReplacementListeners = (Vector<ITypeReplacementListener>)m_ReplacementListeners.clone();
return dolly; return dolly;
} }
@ -431,7 +432,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
*/ */
@Override @Override
public String get_Name(){ public String get_Name(){
return getName(); return getName().toString();
} }
// ino.method.toString.26845.definition // ino.method.toString.26845.definition
@ -492,7 +493,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
// ino.end // ino.end
// ino.method.backdoorSetName.26851.body // ino.method.backdoorSetName.26851.body
{ {
name = varName; name = new JavaClassName(varName);
} }
// ino.end // ino.end
@ -532,7 +533,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
Type equalType = resultSet.getTypeEqualTo(this); Type equalType = resultSet.getTypeEqualTo(this);
if(equalType == null || equalType.equals(this)){ if(equalType == null || equalType.equals(this)){
//Für den Fall das der TPH nicht aufgelöst werden konnte. //Für den Fall das der TPH nicht aufgelöst werden konnte.
JavaCodeResult ret = new JavaCodeResult(this.getName()); JavaCodeResult ret = new JavaCodeResult(this.getName().toString());
//Jetzt muss eine nicht aufgelöste generische Variable dem JavaCodeResult-Set angefügt werden //Jetzt muss eine nicht aufgelöste generische Variable dem JavaCodeResult-Set angefügt werden
ret.addUnresolvedTPH(this); ret.addUnresolvedTPH(this);
return ret; return ret;

View File

@ -12,6 +12,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption;
@ -43,7 +44,7 @@ public class FunN extends RefType implements ITypeReplacementListener{
if(T==null || R == null)throw new NullPointerException(); if(T==null || R == null)throw new NullPointerException();
setT(T); setT(T);
setR(R); setR(R);
this.name = "Fun"+T.size();//getName(); this.name = new JavaClassName("Fun"+T.size());//getName();
} }
/** /**
@ -62,7 +63,7 @@ public class FunN extends RefType implements ITypeReplacementListener{
setR(TypePlaceholder.fresh(this)); setR(TypePlaceholder.fresh(this));
setT(t); setT(t);
this.name = "Fun"+parameterCount; this.name = new JavaClassName("Fun"+parameterCount);
/* /*
Vector<Type> t = new Vector<Type>(); Vector<Type> t = new Vector<Type>();
for(int i=0;i<parameterCount;i++){ for(int i=0;i<parameterCount;i++){

View File

@ -23,7 +23,7 @@ public class ClassAssumption{
} }
public String toString(){ public String toString(){
return this.classType.getName(); return this.classType.getName().toString();
} }
public boolean equals(Object obj){ public boolean equals(Object obj){

View File

@ -20,7 +20,7 @@ public class GenericVarAssumption extends Assumption{
} }
public JavaClassName getIdentifier(){ public JavaClassName getIdentifier(){
return new JavaClassName(genericVar.getName()); return genericVar.getName();
} }
public String toString(){ public String toString(){

View File

@ -13,6 +13,7 @@ import de.dhbwstuttgart.typeinference.FunN;
import de.dhbwstuttgart.typeinference.FunNInterface; import de.dhbwstuttgart.typeinference.FunNInterface;
import de.dhbwstuttgart.typeinference.FunNMethod; import de.dhbwstuttgart.typeinference.FunNMethod;
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
@ -43,7 +44,7 @@ public class TypeAssumptions {
*/ */
//private static CTypeAssumptionSet globalAssumptions = new CTypeAssumptionSet(); //private static CTypeAssumptionSet globalAssumptions = new CTypeAssumptionSet();
private String thisClassName; private JavaClassName thisClassName;
private Vector<MethodAssumption> methodAssumptions = new Vector<MethodAssumption>(); private Vector<MethodAssumption> methodAssumptions = new Vector<MethodAssumption>();
@ -62,7 +63,7 @@ public class TypeAssumptions {
//this.thisClassName = klassenname; //this.thisClassName = klassenname;
} }
public TypeAssumptions(String thisClassName){ public TypeAssumptions(JavaClassName thisClassName){
this(); this();
this.thisClassName = thisClassName; this.thisClassName = thisClassName;
} }
@ -188,7 +189,7 @@ public class TypeAssumptions {
* @param parameterCount * @param parameterCount
* @return * @return
*/ */
public Vector<MethodAssumption> getMethodAssumptions(String className, String methodName){ public Vector<MethodAssumption> getMethodAssumptions(JavaClassName className, String methodName){
Vector<MethodAssumption> ret = new Vector<MethodAssumption>(); Vector<MethodAssumption> ret = new Vector<MethodAssumption>();
for(FieldAssumption ass : this.getAssumptionsFor(className)){ for(FieldAssumption ass : this.getAssumptionsFor(className)){
//System.out.println(ass.getIdentifier()); //System.out.println(ass.getIdentifier());
@ -203,7 +204,7 @@ public class TypeAssumptions {
* @param className * @param className
* @return * @return
*/ */
private Vector<FieldAssumption> getAssumptionsFor(String className) { private Vector<FieldAssumption> getAssumptionsFor(JavaClassName className) {
Vector<FieldAssumption> ret = new Vector<FieldAssumption>(); Vector<FieldAssumption> ret = new Vector<FieldAssumption>();
for(Assumption a : this.getAllAssumptions()){ for(Assumption a : this.getAllAssumptions()){
if(a instanceof FieldAssumption){ if(a instanceof FieldAssumption){
@ -299,19 +300,11 @@ public class TypeAssumptions {
return t; //Handelt es sich um einen TypePlaceholder kann dieser nicht in den Assumptions vorkommen. return t; //Handelt es sich um einen TypePlaceholder kann dieser nicht in den Assumptions vorkommen.
//Alle bekannten Klassen nach diesem Typ durchsuchen: //Alle bekannten Klassen nach diesem Typ durchsuchen:
String typName = t.getName(); JavaClassName typName = t.getName();
String[] names = typName.split("[.]");
for(ClassAssumption ass : this.classAssumptions){ for(ClassAssumption ass : this.classAssumptions){
String name = ass.getAssumedClass().getName(); //Das kann auch java.util.Vector sein JavaClassName name = ass.getAssumedClass().getName(); //Das kann auch java.util.Vector sein
String[] assNames = name.split("[.]");
boolean match = true; boolean match = true;
if(names.length == 1){ match = name.equals(typName);
match = names[0].equals(assNames[assNames.length-1]);
}else if(names.length == 0 || names.length != assNames.length){
match = false;
}else for(int i = names.length-1; i>-1;i--){
if(!names[i].equals(assNames[i]))match = false;
}
if(match && t instanceof RefType){ if(match && t instanceof RefType){
RefType tr = (RefType)t; RefType tr = (RefType)t;
RefType ret = ass.getAssumedClass().getType(); //Dadurch erhält der RefType den vollen Namen (bsp. java.lang.Integer) RefType ret = ass.getAssumedClass().getType(); //Dadurch erhält der RefType den vollen Namen (bsp. java.lang.Integer)

View File

@ -20,6 +20,6 @@ public class BoundedClassIdentifierList extends Vector<Type>{
} }
public void addOffsetOff(RefType refType) { public void addOffsetOff(RefType refType) {
this.endOffset = refType.getOffset() + refType.getName().length(); this.endOffset = refType.getOffset() + refType.getName().toString().length();
} }
} }

View File

@ -20,7 +20,7 @@ public class JavaClassName {
String[] names = name.split("[.]"); String[] names = name.split("[.]");
boolean match = true; boolean match = true;
if(names.length == 1){ if(names.length == 1){
packageName = new PackageName(); //packageName = new PackageName();
this.name = name; this.name = name;
}else { }else {
name = names[names.length-1]; name = names[names.length-1];
@ -39,8 +39,8 @@ public class JavaClassName {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result //result = prime * result
+ ((packageName == null) ? 0 : packageName.hashCode()); // + ((packageName == null) ? 0 : packageName.hashCode()); //PackageName does not infect hashCode
return result; return result;
} }
@ -63,17 +63,16 @@ public class JavaClassName {
return false; return false;
} else if (!name.equals(other.name)) } else if (!name.equals(other.name))
return false; return false;
if (packageName == null) { if (packageName != null && other.packageName != null) {
if (other.packageName != null) if (!packageName.equals(other.packageName))
return false; return false;//Spezialfall, nicht beide Typen müssen eindeutig mit Packagenamen angegeben werden
} else if (!packageName.equals(other.packageName)) }
return false;
return true; return true;
} }
@Override @Override
public String toString() { public String toString() {
return packageName.toString() + name; return (packageName!=null ? packageName.toString() : "") + name;
} }
} }

View File

@ -1643,7 +1643,7 @@ case 111:
Vector<Type> vec=new Vector<Type>(); Vector<Type> vec=new Vector<Type>();
vec.addElement(((RefType)yyVals[0+yyTop])); vec.addElement(((RefType)yyVals[0+yyTop]));
containedTypes.addElement(((RefType)yyVals[0+yyTop])); containedTypes.addElement(((RefType)yyVals[0+yyTop]));
yyVal=new BoundedClassIdentifierList(vec, ((RefType)yyVals[0+yyTop]).getOffset()+((RefType)yyVals[0+yyTop]).getName().length()); yyVal=new BoundedClassIdentifierList(vec, ((RefType)yyVals[0+yyTop]).getOffset()+((RefType)yyVals[0+yyTop]).getName().toString().length());
} }
break; break;
case 112: case 112:
@ -2023,7 +2023,7 @@ case 155:
RefType RT = new RefType(uid.getOffset()); RefType RT = new RefType(uid.getOffset());
RT.set_ParaList(uid.get_RealParaList()); RT.set_ParaList(uid.get_RealParaList());
RT.setName(uid.getQualifiedName()); RT.setName(uid.getQualifiedName().toString());
/*PL 05-07-30 eingefuegt containedTypes ANFANG*/ /*PL 05-07-30 eingefuegt containedTypes ANFANG*/
@ -2043,7 +2043,7 @@ case 156:
/*RT.set_UsedId($1); */ /*RT.set_UsedId($1); */
/*RT.setName(RT.get_UsedId().get_Name_1Element());*/ /*RT.setName(RT.get_UsedId().get_Name_1Element());*/
RT.set_ParaList(((UsedId)yyVals[0+yyTop]).get_RealParaList()); RT.set_ParaList(((UsedId)yyVals[0+yyTop]).get_RealParaList());
RT.setName(((UsedId)yyVals[0+yyTop]).getQualifiedName()); RT.setName(((UsedId)yyVals[0+yyTop]).getQualifiedName().toString());
/*PL 05-07-30 eingefuegt containedTypes ANFANG*/ /*PL 05-07-30 eingefuegt containedTypes ANFANG*/

View File

@ -1071,7 +1071,7 @@ boundedclassidentifierlist : referencetype
Vector<Type> vec=new Vector<Type>(); Vector<Type> vec=new Vector<Type>();
vec.addElement($1); vec.addElement($1);
containedTypes.addElement($1); containedTypes.addElement($1);
$$=new BoundedClassIdentifierList(vec, $1.getOffset()+$1.getName().length()); $$=new BoundedClassIdentifierList(vec, $1.getOffset()+$1.getName().toString().length());
} }
| boundedclassidentifierlist '&' referencetype | boundedclassidentifierlist '&' referencetype
{ {

View File

@ -32,6 +32,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.WildcardType; import de.dhbwstuttgart.syntaxtree.type.WildcardType;
import de.dhbwstuttgart.syntaxtree.type.Pair.PairOperator; import de.dhbwstuttgart.syntaxtree.type.Pair.PairOperator;
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
// ino.end // ino.end
@ -370,7 +371,7 @@ public class Unify
for(Vector<Pair> pVec : unifyErgs) for(Vector<Pair> pVec : unifyErgs)
{ {
// Das Ergebnis in die linke Seite von p_fc einsetzen, und dort Smaller anwenden. // Das Ergebnis in die linke Seite von p_fc einsetzen, und dort Smaller anwenden.
Hashtable<String,Type> ht = VectorPair2SubstHashtableVectorPair(pVec); Hashtable<JavaClassName,Type> ht = VectorPair2SubstHashtableVectorPair(pVec);
//PL 07-07-04 smallerArg wird auf die linke Seite von p_FC nach subst angewandt //PL 07-07-04 smallerArg wird auf die linke Seite von p_FC nach subst angewandt
RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone(); RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone();
gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite
@ -488,7 +489,7 @@ public class Unify
for(Vector<Pair> pVec : unifyErgs) //unifyErgs enthaelt nur einen Unifier STIMMT NIRHT MEHR!!! for(Vector<Pair> pVec : unifyErgs) //unifyErgs enthaelt nur einen Unifier STIMMT NIRHT MEHR!!!
{ {
//Das Ergebnis in die linke Seite von p_fc einsetzen, und dort Smaller anwenden. //Das Ergebnis in die linke Seite von p_fc einsetzen, und dort Smaller anwenden.
Hashtable<String,Type> ht = VectorPair2SubstHashtableVectorPair(pVec); Hashtable<JavaClassName,Type> ht = VectorPair2SubstHashtableVectorPair(pVec);
//PL 07-07-04 smallerArg wird auf die linke Seite von p_FC nach subst angewandt //PL 07-07-04 smallerArg wird auf die linke Seite von p_FC nach subst angewandt
RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone(); RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone();
gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite
@ -642,7 +643,7 @@ public class Unify
for(Vector<Pair> pVec : unifyErgs) for(Vector<Pair> pVec : unifyErgs)
{ {
// Das Ergebnis in die linke Seite von p_fc einsetzen, und dort Smaller anwenden. // Das Ergebnis in die linke Seite von p_fc einsetzen, und dort Smaller anwenden.
Hashtable<String,Type> ht = VectorPair2SubstHashtableVectorPair(pVec); Hashtable<JavaClassName,Type> ht = VectorPair2SubstHashtableVectorPair(pVec);
//PL 07-07-04 smallerArg wird auf die linke Seite von p_FC nach subst angewandt //PL 07-07-04 smallerArg wird auf die linke Seite von p_FC nach subst angewandt
RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone(); RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone();
gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite
@ -996,7 +997,7 @@ public class Unify
for (int i = 0; i < gr1.size(); i++) { //gemeinsame obere Schranken suchen for (int i = 0; i < gr1.size(); i++) { //gemeinsame obere Schranken suchen
for (int j = 0; j < gr2.size(); j++){ for (int j = 0; j < gr2.size(); j++){
if (gr1.elementAt(i).is_Equiv(gr2.elementAt(j), new Hashtable<String,Type>())) { if (gr1.elementAt(i).is_Equiv(gr2.elementAt(j), new Hashtable<JavaClassName,Type>())) {
ub.addElement(gr1.elementAt(i)); ub.addElement(gr1.elementAt(i));
break; break;
} }
@ -1056,7 +1057,7 @@ public class Unify
// ino.end // ino.end
// ino.method.match.28064.definition // ino.method.match.28064.definition
public static Hashtable match(RefType FCtype, RefType tomatch, Hashtable<String, Type> ht) public static Hashtable match(RefType FCtype, RefType tomatch, Hashtable<JavaClassName, Type> ht)
throws MatchException throws MatchException
// ino.end // ino.end
// ino.method.match.28064.body // ino.method.match.28064.body
@ -1650,7 +1651,7 @@ throws MatchException
*/ */
private static void adapt(Vector<Pair> H, Pair PFC, RefType TA1, RefType TA2,FC_TTO fc_tto) private static void adapt(Vector<Pair> H, Pair PFC, RefType TA1, RefType TA2,FC_TTO fc_tto)
{ {
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2); RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2);
inferencelog.debug("TA1neu " + TA1neu.Type2String()); inferencelog.debug("TA1neu " + TA1neu.Type2String());
try try
@ -1677,7 +1678,7 @@ throws MatchException
*/ */
private static void adaptExt(Vector<Pair> H, Pair PFC, RefType TA1, RefType TA2, FC_TTO fc_tto) private static void adaptExt(Vector<Pair> H, Pair PFC, RefType TA1, RefType TA2, FC_TTO fc_tto)
{ {
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2); RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2);
inferencelog.debug("TA1neu " + TA1neu.Type2String()); inferencelog.debug("TA1neu " + TA1neu.Type2String());
try try
@ -1704,7 +1705,7 @@ throws MatchException
*/ */
private static void adaptSup(Vector<Pair> H, Pair PFC, RefType TA1, RefType TA2, FC_TTO fc_tto) private static void adaptSup(Vector<Pair> H, Pair PFC, RefType TA1, RefType TA2, FC_TTO fc_tto)
{ {
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2); RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2);
inferencelog.debug("TA1neu " + TA1neu.Type2String()); inferencelog.debug("TA1neu " + TA1neu.Type2String());
try try
@ -1729,10 +1730,10 @@ throws MatchException
/* luar 03-05-2007 /* luar 03-05-2007
* Diese Methode ersetzt alle Typen in der Hashtable durch deren CaptureConversion * Diese Methode ersetzt alle Typen in der Hashtable durch deren CaptureConversion
*/ */
private static Hashtable<String,Type> CaptureConversionHashtable(Hashtable<String,Type> ht, FC_TTO fc_tto) private static Hashtable<JavaClassName,Type> CaptureConversionHashtable(Hashtable<JavaClassName,Type> ht, FC_TTO fc_tto)
{ {
Hashtable<String,Type> retHT = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> retHT = new Hashtable<JavaClassName,Type>();
for(String s : ht.keySet()) for(JavaClassName s : ht.keySet())
{ {
Type t = ht.get(s); Type t = ht.get(s);
Type ccT = CaptureConversion(t,fc_tto); Type ccT = CaptureConversion(t,fc_tto);
@ -1854,14 +1855,14 @@ throws MatchException
// ino.end // ino.end
// ino.method.VectorPair2SubstHashtableVectorPair.28079.definition // ino.method.VectorPair2SubstHashtableVectorPair.28079.definition
public static Hashtable<String,Type> VectorPair2SubstHashtableVectorPair (Vector<Pair> v) public static Hashtable<JavaClassName,Type> VectorPair2SubstHashtableVectorPair (Vector<Pair> v)
// ino.end // ino.end
// ino.method.VectorPair2SubstHashtableVectorPair.28079.body // ino.method.VectorPair2SubstHashtableVectorPair.28079.body
{ {
//PL 05-01-23 wandelt einen Vector von Paaren (a, ty) von Substitutionen //PL 05-01-23 wandelt einen Vector von Paaren (a, ty) von Substitutionen
//in eine Hashtable um. //in eine Hashtable um.
Hashtable<String,Type> ret = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ret = new Hashtable<JavaClassName,Type>();
for(Enumeration<Pair> e=v.elements();e.hasMoreElements();) { for(Enumeration<Pair> e=v.elements();e.hasMoreElements();) {
Pair p = e.nextElement(); Pair p = e.nextElement();
ret.put(p.TA1.getName(), p.TA2); ret.put(p.TA1.getName(), p.TA2);
@ -1921,7 +1922,7 @@ throws MatchException
Hashtable<String,RefType> testht = new Hashtable<String,RefType>(); Hashtable<String,RefType> testht = new Hashtable<String,RefType>();
for (int i=0; i < FC.size(); i++) { for (int i=0; i < FC.size(); i++) {
// try { // try {
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
//HIER MOEGLICHERWEISE sub_unify MIT true IN DEN PAAREN AUFRUFEN //HIER MOEGLICHERWEISE sub_unify MIT true IN DEN PAAREN AUFRUFEN
//BEI INSTANZIERTEN TYPEN WEREDN KEINE SUBTYPEN GEBILDET //BEI INSTANZIERTEN TYPEN WEREDN KEINE SUBTYPEN GEBILDET
//VERGLEICHE pl1.1.1.3.jav //VERGLEICHE pl1.1.1.3.jav
@ -2004,7 +2005,7 @@ throws MatchException
inferencelog.debug("New allSmaller " + ty.Type2String()); inferencelog.debug("New allSmaller " + ty.Type2String());
//doppelte untere Typen von Paaren eleminieren //doppelte untere Typen von Paaren eleminieren
Hashtable<String, RefType> hht = new Hashtable<String, RefType>(); Hashtable<JavaClassName, RefType> hht = new Hashtable<JavaClassName, RefType>();
for (int i=0; i < FC.size(); i++) { for (int i=0; i < FC.size(); i++) {
if (hht.put(((RefType)(FC.elementAt(i).TA1)).getName(), (RefType)(FC.elementAt(i).TA1)) != null) { } if (hht.put(((RefType)(FC.elementAt(i).TA1)).getName(), (RefType)(FC.elementAt(i).TA1)) != null) { }
@ -2036,7 +2037,7 @@ throws MatchException
if (P != null) { if (P != null) {
//System.out.println("ISIN"); //System.out.println("ISIN");
RefType smaller = (RefType)Pair.copyType(P.TA1); RefType smaller = (RefType)Pair.copyType(P.TA1);
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
try { try {
match((RefType)P.TA2, ty, ht); match((RefType)P.TA2, ty, ht);
//Problem koennte sein, dass ein TypePlaceholder mehrere Typterme //Problem koennte sein, dass ein TypePlaceholder mehrere Typterme
@ -2090,7 +2091,7 @@ throws MatchException
if (testreftype == null) { if (testreftype == null) {
inferencelog.debug("ISIN" + ty.Type2String() + P.toString()+" "+(FC.elementAt(i)).toString()); inferencelog.debug("ISIN" + ty.Type2String() + P.toString()+" "+(FC.elementAt(i)).toString());
RefType greater = (RefType)Pair.copyType(P.TA2); RefType greater = (RefType)Pair.copyType(P.TA2);
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
try { try {
//Hier muessen GTV durch TLV ersetzt werden. //Hier muessen GTV durch TLV ersetzt werden.
//vgl. searchAndHandleMethod in MethodCall.java //vgl. searchAndHandleMethod in MethodCall.java
@ -2232,7 +2233,7 @@ throws MatchException
// otth: Prueft ob TV in RefType vorkommt, falls ja --> true // otth: Prueft ob TV in RefType vorkommt, falls ja --> true
// Name der Typvariablen // Name der Typvariablen
String strTV = TV.getName(); JavaClassName strTV = TV.getName();
// Parameterliste extrahieren // Parameterliste extrahieren
if( RT.get_ParaList() == null ) if( RT.get_ParaList() == null )
@ -2362,7 +2363,7 @@ throws MatchException
// ht enthaelt Elemente der (String, Type) // ht enthaelt Elemente der (String, Type)
// ino.end // ino.end
// ino.method.SubstHashtableGeneric.28109.definition // ino.method.SubstHashtableGeneric.28109.definition
public static void SubstHashtableGeneric(RefType typterm, Hashtable<String,Type> ht) public static void SubstHashtableGeneric(RefType typterm, Hashtable<JavaClassName,Type> ht)
// ino.end // ino.end
// ino.method.SubstHashtableGeneric.28109.body // ino.method.SubstHashtableGeneric.28109.body
{ {
@ -2389,7 +2390,7 @@ throws MatchException
// ht enthaelt Elemente der (String, Type) // ht enthaelt Elemente der (String, Type)
// ino.end // ino.end
// ino.method.SubstHashtable.28112.definition // ino.method.SubstHashtable.28112.definition
public static void SubstHashtable(RefType typterm, Hashtable<String,Type> ht) public static void SubstHashtable(RefType typterm, Hashtable<JavaClassName,Type> ht)
// ino.end // ino.end
// ino.method.SubstHashtable.28112.body // ino.method.SubstHashtable.28112.body
{ {
@ -2702,7 +2703,7 @@ tempKlasse.get_Superclass_Name() ); System.out.println( "P. S.:
// sie durch die selbe Variable ersetzt. // sie durch die selbe Variable ersetzt.
// ino.end // ino.end
// ino.method.varSubst.28130.definition // ino.method.varSubst.28130.definition
public static void varSubst(RefType typterm, Hashtable<String,Type> ht) public static void varSubst(RefType typterm, Hashtable<JavaClassName,Type> ht)
// ino.end // ino.end
// ino.method.varSubst.28130.body // ino.method.varSubst.28130.body
{ {
@ -3090,7 +3091,7 @@ tempKlasse.get_Superclass_Name() ); System.out.println( "P. S.:
* Für Jeden Typ aus greater1 durch die FC laufen, und auf der Linken seite einen Match versuchen. * Für Jeden Typ aus greater1 durch die FC laufen, und auf der Linken seite einen Match versuchen.
* Wenn das Funktioniert, dann ist der Typ auf der rechten Seite auch greater. * Wenn das Funktioniert, dann ist der Typ auf der rechten Seite auch greater.
* */ * */
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
for(Type t : greater1Erg) for(Type t : greater1Erg)
{ {
for(Pair p : fc_tto.getFC()) for(Pair p : fc_tto.getFC())
@ -3294,7 +3295,7 @@ tempKlasse.get_Superclass_Name() ); System.out.println( "P. S.:
* Für Jeden Typ aus Smaller12 durch die FC laufen, und auf der Rechten seite einen Match versuchen. * Für Jeden Typ aus Smaller12 durch die FC laufen, und auf der Rechten seite einen Match versuchen.
* Wenn das Funktioniert, dann ist der Typ auf der linken Seite auch smaller. * Wenn das Funktioniert, dann ist der Typ auf der linken Seite auch smaller.
* */ * */
Hashtable<String,Type> ht = new Hashtable<String,Type>(); Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
for(Type t : smaller12Erg) for(Type t : smaller12Erg)
{ {
for(Pair p : fc_tto.getFC()) for(Pair p : fc_tto.getFC())

View File

@ -191,7 +191,7 @@ public class CSubstitution
// ino.end // ino.end
// ino.method.execute.27045.body // ino.method.execute.27045.body
{ {
TypePlaceholder uniqueVar = TypePlaceholder.getInstance(m_TypeVar.getName()); TypePlaceholder uniqueVar = TypePlaceholder.getInstance(m_TypeVar.getName().toString());
if(uniqueVar==null){ if(uniqueVar==null){
throw new CTypeReconstructionException("CSubstitution.execute(): TypePlaceholder \""+m_TypeVar.getName()+"\" wurde nicht in der Registry gefunden!",null); throw new CTypeReconstructionException("CSubstitution.execute(): TypePlaceholder \""+m_TypeVar.getName()+"\" wurde nicht in der Registry gefunden!",null);
} }