forked from JavaTX/JavaCompilerCore
JavaClassName implementiert
This commit is contained in:
parent
01c6a934ed
commit
37d33b7a31
5
bin/.gitignore
vendored
5
bin/.gitignore
vendored
@ -1,8 +1,7 @@
|
||||
/mycompiler
|
||||
/userinterface
|
||||
/bytecode
|
||||
/de
|
||||
/myJvmDisassembler
|
||||
/bytecode
|
||||
/mycompiler
|
||||
/parser
|
||||
/plugindevelopment
|
||||
/syntaxTree
|
||||
|
@ -13,7 +13,9 @@ import org.apache.log4j.Logger;
|
||||
// ino.end
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
|
||||
// ino.class.AClassOrInterface.21186.description type=javadoc
|
||||
/**
|
||||
@ -30,7 +32,7 @@ public interface AClassOrInterface
|
||||
// ino.class.AClassOrInterface.21186.body
|
||||
{
|
||||
|
||||
public String getName();
|
||||
public JavaClassName getName();
|
||||
public Vector<UsedId> getSuperInterfaces();
|
||||
public void setSuperInterfaces(Vector<UsedId> vector);
|
||||
|
||||
|
@ -174,7 +174,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
// Klasse existiert, darf aber keine Parameterliste in der Definition haben
|
||||
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 );
|
||||
// i-te Stelle ersetzen
|
||||
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.
|
||||
* @throws NullPointerException Wenn noch kein abstrakter Syntaxbaum vorhanden
|
||||
* ist.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Vector<ClassFile> codeGeneration(ResultSet result)
|
||||
throws NullPointerException, JVMCodeException
|
||||
@ -579,7 +579,8 @@ public class MyCompiler implements MyCompilerAPI
|
||||
|
||||
codegenlog.info("Codegenerierung beendet!");
|
||||
return ret;
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
// ino.method.main.21313.defdescription type=javadoc
|
||||
/**
|
||||
@ -668,7 +669,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
for(int j=0;j<declarations.size();j++){
|
||||
UsedId impDecl=declarations.elementAt(j);
|
||||
if(impDecl.getSimpleName().equals(typ)){
|
||||
ret=(impDecl.getQualifiedName());
|
||||
ret=(impDecl.getQualifiedName().toString());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -736,7 +737,7 @@ public class MyCompiler implements MyCompilerAPI
|
||||
if(tt instanceof GenericTypeVar)
|
||||
{
|
||||
GenericTypeVar gtv = (GenericTypeVar)tt;
|
||||
paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName()));
|
||||
paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName().toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -853,5 +854,12 @@ public class MyCompiler implements MyCompilerAPI
|
||||
this.m_AbstractSyntaxTree.add(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector<ClassFile> codeGeneration(ResultSet result)
|
||||
throws NullPointerException, JVMCodeException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// ino.end
|
||||
|
@ -58,6 +58,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.unify.FC_TTO;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||
import mycompiler.myclass.*;
|
||||
@ -231,7 +232,7 @@ public class SourceFile
|
||||
* Startet die Bytecodegenerierung fuer alle in der Datei
|
||||
* enthaltenen Klassen und Interfaces.
|
||||
*
|
||||
*/
|
||||
|
||||
// ino.end
|
||||
// ino.method.codegen.21397.definition
|
||||
public Vector<ClassFile> codegen(ResultSet result)
|
||||
@ -254,7 +255,7 @@ public class SourceFile
|
||||
return ret;
|
||||
}
|
||||
// ino.end
|
||||
|
||||
*/
|
||||
// ino.method.createPairFromClassAndSuperclass.21400.defdescription type=javadoc
|
||||
/**
|
||||
* Erstellt ein Typ-Paar, welches im 1. Durchlauf in die Menge der Finite Closure
|
||||
@ -264,7 +265,7 @@ public class SourceFile
|
||||
*/
|
||||
// ino.end
|
||||
// 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.method.createPairFromClassAndSuperclass.21400.body
|
||||
{
|
||||
@ -276,15 +277,15 @@ public class SourceFile
|
||||
superclassParaOrg=null;
|
||||
}
|
||||
Pair P = new Pair(
|
||||
new RefType( className, classParaOrg,-1),
|
||||
new RefType( superclassName, superclassParaOrg,-1)
|
||||
new RefType( className.toString(), classParaOrg,-1),
|
||||
new RefType( superclassName.toString(), superclassParaOrg,-1)
|
||||
);
|
||||
//PL 04-12-29 freshe Variablen ANFANG
|
||||
RefType r1 = (RefType)P.getTA1Copy();
|
||||
RefType r2 = (RefType)P.getTA2Copy();
|
||||
// #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(r2, substHash);
|
||||
// ###########################################################
|
||||
@ -330,7 +331,7 @@ public class SourceFile
|
||||
Iterator<UsedId> interfaceIterator=tempKlasse.getSuperInterfaces().iterator();
|
||||
while(interfaceIterator.hasNext()){
|
||||
UsedId intf=interfaceIterator.next();
|
||||
String interfaceName=intf.getQualifiedName();
|
||||
JavaClassName interfaceName=intf.getQualifiedName();
|
||||
Pair P=createPairFromClassAndSuperclass(tempKlasse.getName(),interfaceName,tempKlasse.get_ParaList(),intf.get_ParaList());
|
||||
vFC.add( P );
|
||||
|
||||
@ -343,7 +344,7 @@ public class SourceFile
|
||||
Iterator<UsedId> interfaceIterator=intf.getSuperInterfaces().iterator();
|
||||
while(interfaceIterator.hasNext()){
|
||||
UsedId superintf=interfaceIterator.next();
|
||||
String superinterfaceName=superintf.getQualifiedName();
|
||||
JavaClassName superinterfaceName=superintf.getQualifiedName();
|
||||
Pair P=createPairFromClassAndSuperclass(intf.getName(),superinterfaceName,intf.getParaList(), superintf.get_ParaList());
|
||||
vFC.add( P );
|
||||
|
||||
@ -456,7 +457,7 @@ public class SourceFile
|
||||
|
||||
//es werden alle Parameter in einem Typeterm, der
|
||||
//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 = 0; u < vPara.size(); u++) {
|
||||
try {
|
||||
@ -467,7 +468,7 @@ public class SourceFile
|
||||
// ###########################################################
|
||||
inferencelog.debug("Typterm_Name: " + vPara.elementAt(u));
|
||||
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 ) {
|
||||
inferencelog.error(E.getMessage());
|
||||
@ -532,7 +533,7 @@ public class SourceFile
|
||||
RefType RSuch = (RefType)PSuch.TA1;
|
||||
|
||||
//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
|
||||
RefType L1 = (RefType)PTemp.getTA1Copy();
|
||||
@ -543,10 +544,10 @@ public class SourceFile
|
||||
//zunaechst Variablen disjunkt machen ANFANG
|
||||
// #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(L2, substHash1);
|
||||
Hashtable<String,Type> substHash2 = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> substHash2 = new Hashtable<JavaClassName,Type>();
|
||||
Unify.varSubst(R1, substHash2);
|
||||
Unify.varSubst(R2, substHash2);
|
||||
// ###########################################################
|
||||
@ -557,9 +558,9 @@ public class SourceFile
|
||||
|
||||
// #JB# 05.04.2005
|
||||
// ###########################################################
|
||||
Hashtable<String,Type> h = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> h = new Hashtable<JavaClassName,Type>();
|
||||
L2.Equiv2Equal(R1, h);
|
||||
Hashtable<String,Type> substHash3 = h;
|
||||
Hashtable<JavaClassName,Type> substHash3 = h;
|
||||
Unify.varSubst(L1, substHash3);
|
||||
Unify.varSubst(R2, substHash3);
|
||||
// ###########################################################
|
||||
@ -689,7 +690,7 @@ public class SourceFile
|
||||
}
|
||||
xConstraints.add(cons);
|
||||
}
|
||||
//typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints);
|
||||
typinferenzLog.debug("Karthesisches Produkt der Constraints: "+xConstraints);
|
||||
|
||||
//////////////////////////////
|
||||
// Unifizierung der Constraints:
|
||||
@ -958,7 +959,7 @@ public class SourceFile
|
||||
// Properties laden
|
||||
java.lang.Class<?> x;
|
||||
try {
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName());
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl);
|
||||
}
|
||||
@ -1050,7 +1051,7 @@ public class SourceFile
|
||||
for(int k=0;k<gpt.length;k++){
|
||||
Type type=createTypeFromJavaGenericType(gpt[k],pt[k],jreSpiderRegistry);
|
||||
// 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));
|
||||
//ret.add(method); //auskommentiert von Andreas Stadelmeier
|
||||
@ -1107,7 +1108,7 @@ public class SourceFile
|
||||
// Properties laden
|
||||
java.lang.Class<?> x;
|
||||
try {
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName());
|
||||
x = java.lang.Class.forName(importDecl.getQualifiedName().toString());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new CTypeReconstructionException("Fehlerhafte Import-Declaration: "+e.getMessage(),importDecl);
|
||||
}
|
||||
@ -1269,7 +1270,7 @@ public class SourceFile
|
||||
boolean found = false;
|
||||
for(UsedId id : searchVector)
|
||||
{
|
||||
String s = id.getQualifiedName();
|
||||
String s = id.getQualifiedName().toString();
|
||||
found |= s.equals(searchString);
|
||||
}
|
||||
return found;
|
||||
@ -1283,7 +1284,7 @@ public class SourceFile
|
||||
{
|
||||
if(type instanceof TypeVariableImpl){
|
||||
TypeVariableImpl tvi=((TypeVariableImpl)type);
|
||||
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName(),-1));
|
||||
return(new GenericTypeVar(jreSpiderRegistry.get(tvi.getName()).getName().toString(),-1));
|
||||
}else{
|
||||
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
|
||||
String jccNameForClass=baseTypeTranslationTable.get(cl.getName());
|
||||
|
@ -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.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.typeinference.unify.FC_TTO;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||
@ -119,9 +122,9 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -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.
|
||||
* @return
|
||||
* @throws JVMCodeException
|
||||
*/
|
||||
|
||||
// ino.method.codegen.23071.definition
|
||||
public ClassFile codegen(ResultSet typeinferenceResult)
|
||||
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:
|
||||
String packageName = "";
|
||||
if(pkgName != null) packageName = pkgName.get_Name_1Element();
|
||||
classfile.add_class(getName(), packageName, superClass, getAccessFlags());
|
||||
classfile.add_class(getName(), superClass, getAccessFlags());
|
||||
|
||||
// Handling fuer Superinterfaces
|
||||
classfile.addSuperInterfaces(getSuperInterfaces());
|
||||
@ -383,7 +386,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
codegenlog.info("Compilierung erfolgreich abgeschlossen, "+ getName() + ".class erstellt.");
|
||||
return classfile;
|
||||
}
|
||||
|
||||
*/
|
||||
public void codegen(ClassFile classfile, Vector paralist)
|
||||
throws JVMCodeException
|
||||
{
|
||||
@ -459,7 +462,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
|
||||
|
||||
// ino.method.get_Superclass_Name.23086.definition
|
||||
public String get_Superclass_Name()
|
||||
public JavaClassName get_Superclass_Name()
|
||||
// ino.end
|
||||
// ino.method.get_Superclass_Name.23086.body
|
||||
{
|
||||
@ -663,6 +666,8 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
// Und los geht's:
|
||||
//////////////////////////////
|
||||
inferencelog.info("Rufe TRStart()...");
|
||||
|
||||
typinferenzLog.debug("Erstellte FiniteClosure: "+supportData);
|
||||
//////////////////////////////
|
||||
// Ab hier ...
|
||||
// @author A10023 - Andreas Stadelmeier:
|
||||
@ -939,7 +944,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
* @param me
|
||||
* @param V
|
||||
* @return
|
||||
*/
|
||||
|
||||
// ino.end
|
||||
// ino.method.RetType.23119.definition
|
||||
private Type RetType(Method me, CTypeAssumptionSet V)
|
||||
@ -954,6 +959,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
}
|
||||
// ino.end
|
||||
|
||||
*/
|
||||
// ino.method.toString.23125.defdescription type=javadoc
|
||||
/**
|
||||
* <br/>Author: Martin Pl�micke
|
||||
@ -1167,7 +1173,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
||||
// ino.end
|
||||
// ino.method.getSimpleName.23140.body
|
||||
{
|
||||
return UsedId.createFromQualifiedName(getName(),-1).getSimpleName();
|
||||
return UsedId.createFromQualifiedName(getName().toString(),-1).getSimpleName();
|
||||
}
|
||||
// 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.
|
||||
}
|
||||
*/
|
||||
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:
|
||||
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(this.getName(), this));
|
||||
Constructor standardKonstruktor = new Constructor(Method.createEmptyMethod(this.getName().toString(), this));
|
||||
this.addField(standardKonstruktor);
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ throws SCClassBodyException
|
||||
SCExcept e = new SCExcept();
|
||||
e.set_error("unbekannte Klasse "+t.getName()+".");
|
||||
e.set_function("complete_parahashtable() --> is_declared()");
|
||||
e.set_statement(t.getName());
|
||||
e.set_statement(t.getName().toString());
|
||||
ex.addException(e);
|
||||
throw ex;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import mycompiler.mybytecode.AttributeInfo;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
@ -118,11 +119,11 @@ public class Constant extends Method
|
||||
// ino.end
|
||||
|
||||
// ino.method.getTypeName.23243.definition
|
||||
public String getTypeName()
|
||||
public JavaClassName getTypeName()
|
||||
// ino.end
|
||||
// ino.method.getTypeName.23243.body
|
||||
{
|
||||
return name;
|
||||
return new JavaClassName(name);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -169,7 +170,7 @@ public class Constant extends Method
|
||||
{
|
||||
|
||||
// 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) ) {
|
||||
throw new JVMCodeException("Die Generierung der Konstante wird nicht unterstuetzt!");
|
||||
|
@ -16,6 +16,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import mycompiler.mybytecode.ClassFile;
|
||||
import mycompiler.myexception.JVMCodeException;
|
||||
import mycompiler.mymodifier.Modifiers;
|
||||
@ -57,7 +58,7 @@ public class Constructor extends Method {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
public JavaClassName getTypeName() {
|
||||
|
||||
return this.getType().getName();
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL
|
||||
// ino.end
|
||||
// ino.method.getTypeName.23416.body
|
||||
{ if(this.getType() == null)return "";
|
||||
return this.getType().getName();
|
||||
return this.getType().getName().toString();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
|
@ -42,6 +42,7 @@ import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
|
||||
|
||||
@ -173,7 +174,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
||||
// ino.end
|
||||
|
||||
// ino.method.getTypeName.23533.definition
|
||||
public String getTypeName()
|
||||
public JavaClassName getTypeName()
|
||||
// ino.end
|
||||
// ino.method.getTypeName.23533.body
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ public class DeclId
|
||||
if (type instanceof RefType)
|
||||
codegen_type = ((RefType)type).get_codegen_Type(null);
|
||||
else
|
||||
codegen_type = JVMCode.get_codegen_Type(type.getName(), paralist);
|
||||
codegen_type = JVMCode.get_codegen_Type(type.getName().toString(), paralist);
|
||||
|
||||
|
||||
// Instanzvariable genenerieren
|
||||
@ -223,7 +223,7 @@ public class DeclId
|
||||
if(wert instanceof Expr) {
|
||||
classfile.add_field_ref(name, null, codegen_type);
|
||||
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);
|
||||
}
|
||||
else throw new JVMCodeException("Wertzuweisung der Instanzvariable kann nicht uebersetzt werden!");
|
||||
|
@ -10,6 +10,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import mycompiler.mybytecode.JVMCode;
|
||||
|
||||
|
||||
@ -182,7 +183,7 @@ public class UsedId implements IItemWithOffset
|
||||
// ino.end
|
||||
// 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)
|
||||
return basis;
|
||||
@ -241,7 +242,7 @@ public class UsedId implements IItemWithOffset
|
||||
// ino.end
|
||||
|
||||
// ino.method.getQualifiedName.23726.definition
|
||||
public String getQualifiedName()
|
||||
public JavaClassName getQualifiedName()
|
||||
// ino.end
|
||||
// ino.method.getQualifiedName.23726.body
|
||||
{
|
||||
@ -253,7 +254,7 @@ public class UsedId implements IItemWithOffset
|
||||
sb.append(".");
|
||||
}
|
||||
}
|
||||
return(sb.toString());
|
||||
return new JavaClassName(sb.toString());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -312,7 +313,7 @@ public class UsedId implements IItemWithOffset
|
||||
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
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){
|
||||
ret.attach( "<" );
|
||||
Iterator<Type> it = this.paralist.iterator();
|
||||
|
@ -35,6 +35,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.core.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.syntaxtree.Class;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
@ -48,6 +49,7 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||
|
||||
|
||||
@ -138,13 +140,13 @@ public class Assign extends Expr
|
||||
// LocalVar
|
||||
try
|
||||
{
|
||||
String local_type = code.get_TypeOf_Var(local_name).getName();
|
||||
code.add_code(JVMCode.nload_n(local_type, index));
|
||||
JavaClassName local_type = code.get_TypeOf_Var(local_name).getName();
|
||||
code.add_code(JVMCode.nload_n(local_type.toString(), index));
|
||||
}
|
||||
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_byte((byte)index);
|
||||
}
|
||||
@ -166,13 +168,13 @@ public class Assign extends Expr
|
||||
// LocalVar
|
||||
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));
|
||||
}
|
||||
catch(JVMCodeException e)
|
||||
{
|
||||
// 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_byte((byte)index);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class CastExpr extends UnaryExpr
|
||||
// ino.end
|
||||
// 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());
|
||||
if(itype != iexpr)
|
||||
{
|
||||
@ -122,7 +122,7 @@ public class CastExpr extends UnaryExpr
|
||||
else
|
||||
{
|
||||
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);
|
||||
|
@ -52,7 +52,7 @@ public abstract class ExprStmt extends Statement implements ITypeReplacementList
|
||||
// ino.method.getTypeName.25279.body
|
||||
{
|
||||
if (getType()!=null)
|
||||
return getType().getName();
|
||||
return getType().getName().toString();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class InstanceOf extends BinaryExpr
|
||||
{
|
||||
expr.codegen(classfile, code, paralist);
|
||||
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
|
||||
|
||||
|
@ -133,13 +133,13 @@ public class LocalOrFieldVar extends Expr
|
||||
// LocalVar
|
||||
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));
|
||||
}
|
||||
catch(JVMCodeException e)
|
||||
{
|
||||
// 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_byte((byte)index);
|
||||
}
|
||||
@ -162,7 +162,7 @@ public class LocalOrFieldVar extends Expr
|
||||
RefType rt = (RefType) this.getType();
|
||||
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_short(classfile.add_method_ref("java/lang/Integer", "intValue", "()I"));
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
|
||||
SCExcept e = new SCExcept();
|
||||
e.set_error("unbekannte Klasse "+t.getName()+".");
|
||||
e.set_function("complete_parahashtable() --> is_declared()");
|
||||
e.set_statement(t.getName());
|
||||
e.set_statement(t.getName().toString());
|
||||
ex.addException(e);
|
||||
throw ex;
|
||||
}
|
||||
@ -224,7 +224,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
|
||||
SCExcept e = new SCExcept();
|
||||
e.set_error("Klasse "+c.getName()+" ist falsch parametrisiert!");
|
||||
e.set_function("complete_parahashtable() --> check_anz()");
|
||||
e.set_statement(type.getName());
|
||||
e.set_statement(type.getName().toString());
|
||||
ex.addException(e);
|
||||
throw ex;
|
||||
}
|
||||
@ -234,7 +234,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
|
||||
SCExcept e = new SCExcept();
|
||||
e.set_error("Klasse "+c.getName()+" ist nicht parametrisierbar!");
|
||||
e.set_function("complete_parahashtable() --> check_anz()");
|
||||
e.set_statement(type.getName());
|
||||
e.set_statement(type.getName().toString());
|
||||
ex.addException(e);
|
||||
throw ex;
|
||||
}
|
||||
@ -245,7 +245,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
|
||||
SCExcept e = new SCExcept();
|
||||
e.set_error("Klasse "+c.getName()+" <20>berhaupt garnicht parametrisiert!");
|
||||
e.set_function("complete_parahashtable() --> check_anz()");
|
||||
e.set_statement(type.getName());
|
||||
e.set_statement(type.getName().toString());
|
||||
ex.addException(e);
|
||||
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_function("complete_parahashtable() --> check_anz()");
|
||||
e.set_statement(type.getName());
|
||||
e.set_statement(type.getName().toString());
|
||||
ex.addException(e);
|
||||
throw ex;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.core.SyntaxTreeNode;
|
||||
import de.dhbwstuttgart.syntaxtree.Class;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassBody;
|
||||
@ -67,6 +68,7 @@ import de.dhbwstuttgart.typeinference.Overloading;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.unify.FC_TTO;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
@ -290,13 +292,13 @@ public class MethodCall extends Expr
|
||||
|
||||
if (index != -1 ) { // Lokale Variable
|
||||
try {
|
||||
String local_type = code.get_TypeOf_Var(local_name)
|
||||
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) { // out of nload_n
|
||||
String local_type = code.get_TypeOf_Var(local_name)
|
||||
JavaClassName local_type = code.get_TypeOf_Var(local_name)
|
||||
.getName();
|
||||
code.add_code(JVMCode.nload(local_type));
|
||||
code.add_code(JVMCode.nload(local_type.toString()));
|
||||
code.add_code_byte((byte) index);
|
||||
}
|
||||
} else { // FieldVariable
|
||||
@ -417,11 +419,11 @@ public class MethodCall extends Expr
|
||||
// Typannahme f<EFBFBD>r Methode heraussuchen:
|
||||
// --------------------------
|
||||
|
||||
String className;
|
||||
String className;
|
||||
if(classType instanceof RefType){
|
||||
className=((RefType)classType).getTypeName();
|
||||
}else{
|
||||
className=classType.getName();
|
||||
className=classType.getName().toString();
|
||||
}
|
||||
|
||||
CMethodKey key = new CMethodKey(
|
||||
|
@ -137,10 +137,10 @@ public class NewArray extends Expr
|
||||
// ino.end
|
||||
// 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);
|
||||
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 {
|
||||
for(int i = 0; i < expr.size(); i++) ((Expr)expr.elementAt(i)).codegen(classfile, code, paralist);
|
||||
|
@ -128,7 +128,7 @@ public class NewClass extends Expr
|
||||
for(Enumeration<Class> el = classname.elements(); el.hasMoreElements();)
|
||||
{
|
||||
cl = el.nextElement();
|
||||
next = (String)cl.getName();
|
||||
next = (String)cl.getName().toString();
|
||||
if(ext)
|
||||
parserlog.debug("Vergleiche "+usedid+" mit "+next);
|
||||
if(usedid.equals(next))
|
||||
|
@ -115,11 +115,11 @@ public class PostDecExpr extends UnaryExpr
|
||||
index = code.get_indexOf_Var(local_name);
|
||||
if(index != -1) { // LocalVar
|
||||
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));
|
||||
}
|
||||
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_byte((byte)index);
|
||||
}
|
||||
|
@ -122,11 +122,11 @@ public class PostIncExpr extends UnaryExpr
|
||||
index = code.get_indexOf_Var(local_name);
|
||||
if(index != -1) { // LocalVar
|
||||
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));
|
||||
}
|
||||
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_byte((byte)index);
|
||||
}
|
||||
|
@ -115,11 +115,11 @@ public class PreDecExpr extends UnaryExpr
|
||||
index = code.get_indexOf_Var(local_name);
|
||||
if(index != -1) { // LocalVar
|
||||
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));
|
||||
}
|
||||
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_byte((byte)index);
|
||||
}
|
||||
|
@ -116,11 +116,11 @@ public class PreIncExpr extends UnaryExpr
|
||||
index = code.get_indexOf_Var(local_name);
|
||||
if(index != -1) { // LocalVar
|
||||
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));
|
||||
}
|
||||
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_byte((byte)index);
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public class BoundedGenericTypeVar extends GenericTypeVar
|
||||
// ino.end
|
||||
// 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
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class FreshExtendsWildcardType extends FreshWildcardType implements IMatc
|
||||
*/
|
||||
public FreshExtendsWildcardType clone()
|
||||
{
|
||||
return new FreshExtendsWildcardType(this.extendsBoundType.clone(),getOffset(),this.name);
|
||||
return new FreshExtendsWildcardType(this.extendsBoundType.clone(),getOffset(),this.name.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
|
||||
*/
|
||||
public FreshSuperWildcardType clone()
|
||||
{
|
||||
return new FreshSuperWildcardType(this.superBoundType.clone(),getOffset(),this.name);
|
||||
return new FreshSuperWildcardType(this.superBoundType.clone(),getOffset(),this.name.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@ import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
public class FreshWildcardType extends Type {
|
||||
@ -29,7 +30,7 @@ public class FreshWildcardType extends Type {
|
||||
protected FreshWildcardType(int offset, String name)
|
||||
{
|
||||
super(offset);
|
||||
this.name = name;
|
||||
this.name = new JavaClassName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +61,7 @@ public class FreshWildcardType extends Type {
|
||||
*/
|
||||
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
|
||||
* Methode aus TypePlaceholder kopiert
|
||||
*/
|
||||
private static String makeNewName()
|
||||
private static JavaClassName makeNewName()
|
||||
{
|
||||
// luar: Methode aus TypePlaceholder kopiert.
|
||||
String strReturn = strNextName;
|
||||
@ -87,7 +88,7 @@ public class FreshWildcardType extends Type {
|
||||
// n�chster Name berechnen und in strNextName speichern
|
||||
inc( strNextName.length() - 1 );
|
||||
|
||||
return strReturn;
|
||||
return new JavaClassName(strReturn);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,7 +166,7 @@ public class FreshWildcardType extends Type {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,14 @@ import java.util.Vector;
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.SingleConstraint;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
||||
@ -80,7 +82,7 @@ public class GenericTypeVar extends Type
|
||||
// ino.method.GenericTypeVar.26509.body
|
||||
{
|
||||
super(offset);
|
||||
this.name = s;
|
||||
this.name = new JavaClassName(s);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -100,7 +102,7 @@ public class GenericTypeVar extends Type
|
||||
// ino.end
|
||||
// ino.method.clone.26512.body
|
||||
{
|
||||
return new GenericTypeVar(this.getName(),getOffset());
|
||||
return new GenericTypeVar(this.getName().toString(),getOffset());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -182,12 +184,12 @@ public class GenericTypeVar extends Type
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
return new JavaCodeResult(this.name);
|
||||
return new JavaCodeResult(this.name.toString());
|
||||
}
|
||||
|
||||
public TypePlaceholder getTypePlaceHolder() {
|
||||
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);
|
||||
//if(this.tph == null)this.tph = TypePlaceholder.fresh();
|
||||
@ -196,11 +198,11 @@ public class GenericTypeVar extends Type
|
||||
|
||||
@Override
|
||||
public String get_Name() {
|
||||
return this.getName();
|
||||
return this.getName().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public JavaClassName getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@ -221,7 +223,7 @@ public class GenericTypeVar extends Type
|
||||
}
|
||||
|
||||
public int getEndOffset() {
|
||||
return this.getOffset() + this.name.length();
|
||||
return this.getOffset() + this.name.toString().length();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import java.util.Hashtable;
|
||||
import java.util.Vector;
|
||||
// ino.end
|
||||
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -249,7 +251,7 @@ public class Pair
|
||||
// ino.method.Pair_isEquiv.26582.body
|
||||
{
|
||||
//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)TA2).is_Equiv((RefType)p.TA2, ht));
|
||||
|
||||
|
@ -29,6 +29,7 @@ import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
|
||||
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
@ -36,6 +37,7 @@ import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
|
||||
|
||||
@ -134,7 +136,7 @@ public class RefType extends Type implements IMatchable
|
||||
*/
|
||||
public RefType( Type baseType ){
|
||||
super(baseType.getOffset());
|
||||
this.setName(baseType.name);
|
||||
this.setName(baseType.name.toString());
|
||||
//this.parameter = null;
|
||||
}
|
||||
|
||||
@ -145,7 +147,7 @@ public class RefType extends Type implements IMatchable
|
||||
{
|
||||
if(parameter==null)
|
||||
{
|
||||
return name;
|
||||
return name.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -169,7 +171,7 @@ public class RefType extends Type implements IMatchable
|
||||
{
|
||||
if(parameter==null)
|
||||
{
|
||||
return name;
|
||||
return name.toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -276,20 +278,24 @@ public class RefType extends Type implements IMatchable
|
||||
// ino.end
|
||||
// ino.method.setName.26655.body
|
||||
{
|
||||
this.name = name;
|
||||
this.name = new JavaClassName(name);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
public void setName( JavaClassName name ){
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get_Name()
|
||||
{
|
||||
return getName();
|
||||
return getName().toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ino.method.getName.26658.definition
|
||||
public String getName()
|
||||
public JavaClassName getName()
|
||||
// ino.end
|
||||
// ino.method.getName.26658.body
|
||||
{
|
||||
@ -335,8 +341,8 @@ public class RefType extends Type implements IMatchable
|
||||
else paralist.add(t);
|
||||
}*/
|
||||
this.parameter = v;//paralist;
|
||||
parserlog.debug("T->Type.java->set_ParaList->parameter: " + parameter);
|
||||
parserlog.debug("T->Type.java->get_Type: " + getName());
|
||||
//parserlog.debug("T->Type.java->set_ParaList->parameter: " + parameter);
|
||||
//parserlog.debug("T->Type.java->get_Type: " + getName());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -364,7 +370,7 @@ public class RefType extends Type implements IMatchable
|
||||
// ino.method.getTypeName.26670.body
|
||||
{
|
||||
// otth: Liefert den Namen des Typs, ohne Parameter, z.B. Stapel bei Stapel<IntZahl>
|
||||
return name;
|
||||
return name.toString();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -383,7 +389,7 @@ public class RefType extends Type implements IMatchable
|
||||
if( n >= parameter.size() )
|
||||
return "";
|
||||
|
||||
return ((Type)parameter.elementAt(n)).getName();
|
||||
return ((Type)parameter.elementAt(n)).getName().toString();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -402,7 +408,7 @@ public class RefType extends Type implements IMatchable
|
||||
// GenericTypeVar ergaenzt PL 06-03-16
|
||||
// ino.end
|
||||
// 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.method.is_Equiv.26679.body
|
||||
{
|
||||
@ -469,7 +475,7 @@ public class RefType extends Type implements IMatchable
|
||||
// ino.end
|
||||
|
||||
// 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.method.Equiv2Equal.26682.body
|
||||
{
|
||||
@ -499,7 +505,7 @@ public class RefType extends Type implements IMatchable
|
||||
else { //Typvariablen gleich machen
|
||||
// #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());
|
||||
// ###########################################################
|
||||
}
|
||||
@ -511,7 +517,7 @@ public class RefType extends Type implements IMatchable
|
||||
ht.put(pty1.getName(), pty2);
|
||||
// #JB# 11.04.2005
|
||||
// ###########################################################
|
||||
((TypePlaceholder)pty2).backdoorSetName(pty1.getName());
|
||||
((TypePlaceholder)pty2).backdoorSetName(pty1.getName().toString());
|
||||
//pty2.setName(pty1.getName());
|
||||
// ###########################################################
|
||||
}
|
||||
@ -631,7 +637,7 @@ public class RefType extends Type implements IMatchable
|
||||
para = para +", "+ t;
|
||||
else para = " " + t;
|
||||
}
|
||||
String ret = name;
|
||||
String ret = name.toString();
|
||||
if(parameter.size()>0)ret += "<"+para + " >";
|
||||
return ret + primitiveFlagMarker;//name + "<"+para + " >" +primitiveFlagMarker;
|
||||
}
|
||||
@ -643,7 +649,7 @@ public class RefType extends Type implements IMatchable
|
||||
// ino.end
|
||||
// ino.method.modifyToGenericTypeVar.26694.body
|
||||
{
|
||||
return new GenericTypeVar(this.name,getOffset());
|
||||
return new GenericTypeVar(this.name.toString(),getOffset());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -742,7 +748,7 @@ public class RefType extends Type implements IMatchable
|
||||
|
||||
@Override
|
||||
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){
|
||||
ret .attach( "<" );
|
||||
Iterator<Type> it = this.get_ParaList().iterator();
|
||||
|
@ -42,6 +42,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
System.out.println("!");
|
||||
return "? super " + superType.toString();
|
||||
}
|
||||
|
||||
@ -52,7 +53,6 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
||||
*/
|
||||
public SuperWildcardType clone()
|
||||
{
|
||||
//Hier ist unklar, ob der Supertyp auch geklont werden muss.
|
||||
return new SuperWildcardType(getOffset(), superType.clone());
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
||||
|
||||
@Override
|
||||
public JavaCodeResult printJavaCode(ResultSet result){
|
||||
return new JavaCodeResult(this.toString());
|
||||
return new JavaCodeResult("? super " + this.superType.printJavaCode(resultSet));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import mycompiler.mybytecode.JVMCode;
|
||||
|
||||
|
||||
@ -23,7 +24,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.class.Type.26716.body
|
||||
{
|
||||
// ino.attribute.name.26720.declaration
|
||||
protected String name;
|
||||
protected JavaClassName name;
|
||||
// ino.end
|
||||
// ino.attribute.used.26723.declaration
|
||||
protected UsedId used;
|
||||
@ -38,7 +39,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.method.Type.26729.body
|
||||
{
|
||||
this(offset);
|
||||
this.name = s;
|
||||
this.name = new JavaClassName(s);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -69,7 +70,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.end
|
||||
// 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;}
|
||||
}
|
||||
// ino.end
|
||||
@ -116,7 +117,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.end
|
||||
// ino.method.get_codegen_Type.26750.body
|
||||
{
|
||||
return JVMCode.get_codegen_Type(name, paralist);
|
||||
return JVMCode.get_codegen_Type(name.toString(), paralist);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -154,7 +155,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.end
|
||||
|
||||
// ino.method.getName.26762.definition
|
||||
public String getName()
|
||||
public JavaClassName getName()
|
||||
// ino.end
|
||||
// ino.method.getName.26762.body
|
||||
{
|
||||
@ -195,7 +196,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.end
|
||||
// ino.method.clone.26768.body
|
||||
{
|
||||
return new Type(this.getName(),getOffset());
|
||||
return new Type(this.getName().toString(),getOffset());
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -210,7 +211,7 @@ public class Type implements IItemWithOffset
|
||||
// ino.end
|
||||
// ino.method.toString.26771.body
|
||||
{
|
||||
return getName();
|
||||
return getName().toString();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -243,12 +244,12 @@ public class Type implements IItemWithOffset
|
||||
// ino.end
|
||||
// ino.method.getSimpleName.26777.body
|
||||
{
|
||||
return UsedId.createFromQualifiedName(getName(),getOffset()).getSimpleName();
|
||||
return UsedId.createFromQualifiedName(getName().toString(),getOffset()).getSimpleName();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
public JavaCodeResult printJavaCode(ResultSet resultSet){
|
||||
return new JavaCodeResult(this.name);
|
||||
return new JavaCodeResult(this.name.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -12,6 +12,7 @@ import de.dhbwstuttgart.core.MyCompiler;
|
||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.TypeInsertable;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint;
|
||||
import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
@ -38,7 +39,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
private static String strNextName = "A";
|
||||
// ino.end
|
||||
// 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.attribute.m_ReplacementListeners.26791.declaration
|
||||
@ -59,7 +60,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
// ino.method.TypePlaceholder.26794.body
|
||||
{
|
||||
super(-1);
|
||||
this.name = typeName;
|
||||
this.name = new JavaClassName(typeName);
|
||||
m_ReplacementListeners = new Vector<ITypeReplacementListener>();
|
||||
}
|
||||
// ino.end
|
||||
@ -114,7 +115,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
TypePlaceholder typeVar = new TypePlaceholder(name);
|
||||
TypePlaceholder oldTPH = m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar);
|
||||
if(oldTPH != null){
|
||||
oldTPH.name = makeNewName();
|
||||
oldTPH.name = new JavaClassName(makeNewName());
|
||||
m_TypePlaceholdersRegistry.put(oldTPH.getName(), oldTPH);
|
||||
}
|
||||
return typeVar;
|
||||
@ -398,7 +399,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
// ino.method.deleteRegistry.26839.body
|
||||
{
|
||||
m_TypePlaceholdersRegistry.clear();
|
||||
m_TypePlaceholdersRegistry = new Hashtable<String, TypePlaceholder>();
|
||||
m_TypePlaceholdersRegistry = new Hashtable<JavaClassName, TypePlaceholder>();
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -419,7 +420,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
// ino.end
|
||||
// ino.method.clone.26842.body
|
||||
{
|
||||
TypePlaceholder dolly = new TypePlaceholder(name);
|
||||
TypePlaceholder dolly = new TypePlaceholder(name.toString());
|
||||
dolly.m_ReplacementListeners = (Vector<ITypeReplacementListener>)m_ReplacementListeners.clone();
|
||||
return dolly;
|
||||
}
|
||||
@ -431,7 +432,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
*/
|
||||
@Override
|
||||
public String get_Name(){
|
||||
return getName();
|
||||
return getName().toString();
|
||||
}
|
||||
|
||||
// ino.method.toString.26845.definition
|
||||
@ -492,7 +493,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
// ino.end
|
||||
// ino.method.backdoorSetName.26851.body
|
||||
{
|
||||
name = varName;
|
||||
name = new JavaClassName(varName);
|
||||
}
|
||||
// ino.end
|
||||
|
||||
@ -532,7 +533,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider
|
||||
Type equalType = resultSet.getTypeEqualTo(this);
|
||||
if(equalType == null || equalType.equals(this)){
|
||||
//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
|
||||
ret.addUnresolvedTPH(this);
|
||||
return ret;
|
||||
|
@ -12,6 +12,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption;
|
||||
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
|
||||
import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption;
|
||||
@ -43,7 +44,7 @@ public class FunN extends RefType implements ITypeReplacementListener{
|
||||
if(T==null || R == null)throw new NullPointerException();
|
||||
setT(T);
|
||||
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));
|
||||
setT(t);
|
||||
|
||||
this.name = "Fun"+parameterCount;
|
||||
this.name = new JavaClassName("Fun"+parameterCount);
|
||||
/*
|
||||
Vector<Type> t = new Vector<Type>();
|
||||
for(int i=0;i<parameterCount;i++){
|
||||
|
@ -23,7 +23,7 @@ public class ClassAssumption{
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return this.classType.getName();
|
||||
return this.classType.getName().toString();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj){
|
||||
|
@ -20,7 +20,7 @@ public class GenericVarAssumption extends Assumption{
|
||||
}
|
||||
|
||||
public JavaClassName getIdentifier(){
|
||||
return new JavaClassName(genericVar.getName());
|
||||
return genericVar.getName();
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
|
@ -13,6 +13,7 @@ import de.dhbwstuttgart.typeinference.FunN;
|
||||
import de.dhbwstuttgart.typeinference.FunNInterface;
|
||||
import de.dhbwstuttgart.typeinference.FunNMethod;
|
||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||
import mycompiler.mytypereconstruction.set.CTypeAssumptionSet;
|
||||
import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption;
|
||||
@ -43,7 +44,7 @@ public class TypeAssumptions {
|
||||
*/
|
||||
|
||||
//private static CTypeAssumptionSet globalAssumptions = new CTypeAssumptionSet();
|
||||
private String thisClassName;
|
||||
private JavaClassName thisClassName;
|
||||
|
||||
|
||||
private Vector<MethodAssumption> methodAssumptions = new Vector<MethodAssumption>();
|
||||
@ -62,7 +63,7 @@ public class TypeAssumptions {
|
||||
//this.thisClassName = klassenname;
|
||||
}
|
||||
|
||||
public TypeAssumptions(String thisClassName){
|
||||
public TypeAssumptions(JavaClassName thisClassName){
|
||||
this();
|
||||
this.thisClassName = thisClassName;
|
||||
}
|
||||
@ -188,7 +189,7 @@ public class TypeAssumptions {
|
||||
* @param parameterCount
|
||||
* @return
|
||||
*/
|
||||
public Vector<MethodAssumption> getMethodAssumptions(String className, String methodName){
|
||||
public Vector<MethodAssumption> getMethodAssumptions(JavaClassName className, String methodName){
|
||||
Vector<MethodAssumption> ret = new Vector<MethodAssumption>();
|
||||
for(FieldAssumption ass : this.getAssumptionsFor(className)){
|
||||
//System.out.println(ass.getIdentifier());
|
||||
@ -203,7 +204,7 @@ public class TypeAssumptions {
|
||||
* @param className
|
||||
* @return
|
||||
*/
|
||||
private Vector<FieldAssumption> getAssumptionsFor(String className) {
|
||||
private Vector<FieldAssumption> getAssumptionsFor(JavaClassName className) {
|
||||
Vector<FieldAssumption> ret = new Vector<FieldAssumption>();
|
||||
for(Assumption a : this.getAllAssumptions()){
|
||||
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.
|
||||
|
||||
//Alle bekannten Klassen nach diesem Typ durchsuchen:
|
||||
String typName = t.getName();
|
||||
String[] names = typName.split("[.]");
|
||||
JavaClassName typName = t.getName();
|
||||
for(ClassAssumption ass : this.classAssumptions){
|
||||
String name = ass.getAssumedClass().getName(); //Das kann auch java.util.Vector sein
|
||||
String[] assNames = name.split("[.]");
|
||||
JavaClassName name = ass.getAssumedClass().getName(); //Das kann auch java.util.Vector sein
|
||||
boolean match = true;
|
||||
if(names.length == 1){
|
||||
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;
|
||||
}
|
||||
match = name.equals(typName);
|
||||
if(match && t instanceof RefType){
|
||||
RefType tr = (RefType)t;
|
||||
RefType ret = ass.getAssumedClass().getType(); //Dadurch erhält der RefType den vollen Namen (bsp. java.lang.Integer)
|
||||
|
@ -20,6 +20,6 @@ public class BoundedClassIdentifierList extends Vector<Type>{
|
||||
}
|
||||
|
||||
public void addOffsetOff(RefType refType) {
|
||||
this.endOffset = refType.getOffset() + refType.getName().length();
|
||||
this.endOffset = refType.getOffset() + refType.getName().toString().length();
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class JavaClassName {
|
||||
String[] names = name.split("[.]");
|
||||
boolean match = true;
|
||||
if(names.length == 1){
|
||||
packageName = new PackageName();
|
||||
//packageName = new PackageName();
|
||||
this.name = name;
|
||||
}else {
|
||||
name = names[names.length-1];
|
||||
@ -39,8 +39,8 @@ public class JavaClassName {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result
|
||||
+ ((packageName == null) ? 0 : packageName.hashCode());
|
||||
//result = prime * result
|
||||
// + ((packageName == null) ? 0 : packageName.hashCode()); //PackageName does not infect hashCode
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -63,17 +63,16 @@ public class JavaClassName {
|
||||
return false;
|
||||
} else if (!name.equals(other.name))
|
||||
return false;
|
||||
if (packageName == null) {
|
||||
if (other.packageName != null)
|
||||
return false;
|
||||
} else if (!packageName.equals(other.packageName))
|
||||
return false;
|
||||
if (packageName != null && other.packageName != null) {
|
||||
if (!packageName.equals(other.packageName))
|
||||
return false;//Spezialfall, nicht beide Typen müssen eindeutig mit Packagenamen angegeben werden
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return packageName.toString() + name;
|
||||
return (packageName!=null ? packageName.toString() : "") + name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ case 111:
|
||||
Vector<Type> vec=new Vector<Type>();
|
||||
vec.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;
|
||||
case 112:
|
||||
@ -2023,7 +2023,7 @@ case 155:
|
||||
RefType RT = new RefType(uid.getOffset());
|
||||
|
||||
RT.set_ParaList(uid.get_RealParaList());
|
||||
RT.setName(uid.getQualifiedName());
|
||||
RT.setName(uid.getQualifiedName().toString());
|
||||
|
||||
|
||||
/*PL 05-07-30 eingefuegt containedTypes ANFANG*/
|
||||
@ -2043,7 +2043,7 @@ case 156:
|
||||
/*RT.set_UsedId($1); */
|
||||
/*RT.setName(RT.get_UsedId().get_Name_1Element());*/
|
||||
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*/
|
||||
|
@ -1071,7 +1071,7 @@ boundedclassidentifierlist : referencetype
|
||||
Vector<Type> vec=new Vector<Type>();
|
||||
vec.addElement($1);
|
||||
containedTypes.addElement($1);
|
||||
$$=new BoundedClassIdentifierList(vec, $1.getOffset()+$1.getName().length());
|
||||
$$=new BoundedClassIdentifierList(vec, $1.getOffset()+$1.getName().toString().length());
|
||||
}
|
||||
| boundedclassidentifierlist '&' referencetype
|
||||
{
|
||||
|
@ -32,6 +32,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Pair.PairOperator;
|
||||
import de.dhbwstuttgart.typeinference.parser.JavaClassName;
|
||||
|
||||
// ino.end
|
||||
|
||||
@ -370,7 +371,7 @@ public class Unify
|
||||
for(Vector<Pair> pVec : unifyErgs)
|
||||
{
|
||||
// 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
|
||||
RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone();
|
||||
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!!!
|
||||
{
|
||||
//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
|
||||
RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone();
|
||||
gtv2tv.applyThisSubstitutionSet(p_fc_TA1_new); //auf der linken Seite
|
||||
@ -642,7 +643,7 @@ public class Unify
|
||||
for(Vector<Pair> pVec : unifyErgs)
|
||||
{
|
||||
// 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
|
||||
RefType p_fc_TA1_new = (RefType)p_fc.TA1.clone();
|
||||
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 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));
|
||||
break;
|
||||
}
|
||||
@ -1056,7 +1057,7 @@ public class Unify
|
||||
// ino.end
|
||||
|
||||
// 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
|
||||
// ino.end
|
||||
// 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)
|
||||
{
|
||||
Hashtable<String,Type> ht = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
|
||||
RefType TA1neu = (RefType)Pair.copyType((RefType)PFC.TA2);
|
||||
inferencelog.debug("TA1neu " + TA1neu.Type2String());
|
||||
try
|
||||
@ -1677,7 +1678,7 @@ throws MatchException
|
||||
*/
|
||||
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);
|
||||
inferencelog.debug("TA1neu " + TA1neu.Type2String());
|
||||
try
|
||||
@ -1704,7 +1705,7 @@ throws MatchException
|
||||
*/
|
||||
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);
|
||||
inferencelog.debug("TA1neu " + TA1neu.Type2String());
|
||||
try
|
||||
@ -1729,10 +1730,10 @@ throws MatchException
|
||||
/* luar 03-05-2007
|
||||
* 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>();
|
||||
for(String s : ht.keySet())
|
||||
Hashtable<JavaClassName,Type> retHT = new Hashtable<JavaClassName,Type>();
|
||||
for(JavaClassName s : ht.keySet())
|
||||
{
|
||||
Type t = ht.get(s);
|
||||
Type ccT = CaptureConversion(t,fc_tto);
|
||||
@ -1854,14 +1855,14 @@ throws MatchException
|
||||
// ino.end
|
||||
|
||||
// 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.method.VectorPair2SubstHashtableVectorPair.28079.body
|
||||
{
|
||||
//PL 05-01-23 wandelt einen Vector von Paaren (a, ty) von Substitutionen
|
||||
//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();) {
|
||||
Pair p = e.nextElement();
|
||||
ret.put(p.TA1.getName(), p.TA2);
|
||||
@ -1921,7 +1922,7 @@ throws MatchException
|
||||
Hashtable<String,RefType> testht = new Hashtable<String,RefType>();
|
||||
for (int i=0; i < FC.size(); i++) {
|
||||
// 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
|
||||
//BEI INSTANZIERTEN TYPEN WEREDN KEINE SUBTYPEN GEBILDET
|
||||
//VERGLEICHE pl1.1.1.3.jav
|
||||
@ -2004,7 +2005,7 @@ throws MatchException
|
||||
inferencelog.debug("New allSmaller " + ty.Type2String());
|
||||
|
||||
//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++) {
|
||||
if (hht.put(((RefType)(FC.elementAt(i).TA1)).getName(), (RefType)(FC.elementAt(i).TA1)) != null) { }
|
||||
@ -2036,7 +2037,7 @@ throws MatchException
|
||||
if (P != null) {
|
||||
//System.out.println("ISIN");
|
||||
RefType smaller = (RefType)Pair.copyType(P.TA1);
|
||||
Hashtable<String,Type> ht = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
|
||||
try {
|
||||
match((RefType)P.TA2, ty, ht);
|
||||
//Problem koennte sein, dass ein TypePlaceholder mehrere Typterme
|
||||
@ -2090,7 +2091,7 @@ throws MatchException
|
||||
if (testreftype == null) {
|
||||
inferencelog.debug("ISIN" + ty.Type2String() + P.toString()+" "+(FC.elementAt(i)).toString());
|
||||
RefType greater = (RefType)Pair.copyType(P.TA2);
|
||||
Hashtable<String,Type> ht = new Hashtable<String,Type>();
|
||||
Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
|
||||
try {
|
||||
//Hier muessen GTV durch TLV ersetzt werden.
|
||||
//vgl. searchAndHandleMethod in MethodCall.java
|
||||
@ -2232,7 +2233,7 @@ throws MatchException
|
||||
// otth: Prueft ob TV in RefType vorkommt, falls ja --> true
|
||||
|
||||
// Name der Typvariablen
|
||||
String strTV = TV.getName();
|
||||
JavaClassName strTV = TV.getName();
|
||||
|
||||
// Parameterliste extrahieren
|
||||
if( RT.get_ParaList() == null )
|
||||
@ -2362,7 +2363,7 @@ throws MatchException
|
||||
// ht enthaelt Elemente der (String, Type)
|
||||
// ino.end
|
||||
// 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.method.SubstHashtableGeneric.28109.body
|
||||
{
|
||||
@ -2389,7 +2390,7 @@ throws MatchException
|
||||
// ht enthaelt Elemente der (String, Type)
|
||||
// ino.end
|
||||
// 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.method.SubstHashtable.28112.body
|
||||
{
|
||||
@ -2702,7 +2703,7 @@ tempKlasse.get_Superclass_Name() ); System.out.println( "P. S.:
|
||||
// sie durch die selbe Variable ersetzt.
|
||||
// ino.end
|
||||
// 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.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.
|
||||
* 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(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.
|
||||
* 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(Pair p : fc_tto.getFC())
|
||||
|
@ -191,7 +191,7 @@ public class CSubstitution
|
||||
// ino.end
|
||||
// ino.method.execute.27045.body
|
||||
{
|
||||
TypePlaceholder uniqueVar = TypePlaceholder.getInstance(m_TypeVar.getName());
|
||||
TypePlaceholder uniqueVar = TypePlaceholder.getInstance(m_TypeVar.getName().toString());
|
||||
if(uniqueVar==null){
|
||||
throw new CTypeReconstructionException("CSubstitution.execute(): TypePlaceholder \""+m_TypeVar.getName()+"\" wurde nicht in der Registry gefunden!",null);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user