forked from JavaTX/JavaCompilerCore
Konstruktor von Type muss mit Elternelement im Syntaxbaum aufgerufen werden
This commit is contained in:
parent
ca8145e4a2
commit
6505c985e0
@ -14,8 +14,10 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import de.dhbwstuttgart.myexception.JVMCodeException;
|
import de.dhbwstuttgart.myexception.JVMCodeException;
|
||||||
import de.dhbwstuttgart.parser.JavaClassName;
|
import de.dhbwstuttgart.parser.JavaClassName;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.Interface;
|
||||||
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
import de.dhbwstuttgart.syntaxtree.misc.UsedId;
|
||||||
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
import de.dhbwstuttgart.syntaxtree.modifier.Modifiers;
|
||||||
|
|
||||||
@ -35,8 +37,8 @@ public interface AClassOrInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
public JavaClassName getName();
|
public JavaClassName getName();
|
||||||
public Vector<UsedId> getSuperInterfaces();
|
public Vector<Interface> getSuperInterfaces();
|
||||||
public void setSuperInterfaces(Vector<UsedId> vector);
|
public void setSuperInterfaces(Vector<Interface> vector);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// ino.attribute.inferencelog.21189.decldescription type=javadoc
|
// ino.attribute.inferencelog.21189.decldescription type=javadoc
|
||||||
|
@ -51,7 +51,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
protected Modifiers modifiers;
|
protected Modifiers modifiers;
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
private Vector<UsedId> superif = new Vector<UsedId>();
|
private Vector<Interface> superif = new Vector<Interface>();
|
||||||
|
|
||||||
public UsedId getPackageName()
|
public UsedId getPackageName()
|
||||||
{
|
{
|
||||||
@ -88,11 +88,13 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
public Vector<UsedId> getSuperInterfaces()
|
|
||||||
|
public Vector<Interface> getSuperInterfaces()
|
||||||
{
|
{
|
||||||
return superif;
|
return superif;
|
||||||
}
|
}
|
||||||
public void setSuperInterfaces(Vector<UsedId> superif)
|
|
||||||
|
public void setSuperInterfaces(Vector<Interface> superif)
|
||||||
{
|
{
|
||||||
this.superif = superif;
|
this.superif = superif;
|
||||||
}
|
}
|
||||||
@ -142,6 +144,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
private Vector<Field> fielddecl = new Vector<Field>();
|
private Vector<Field> fielddecl = new Vector<Field>();
|
||||||
private GenericDeclarationList genericClassParameters;
|
private GenericDeclarationList genericClassParameters;
|
||||||
private int offset;
|
private int offset;
|
||||||
|
private Class superClass;
|
||||||
|
|
||||||
|
|
||||||
// ino.method.Class.23041.definition
|
// ino.method.Class.23041.definition
|
||||||
@ -154,9 +157,16 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
superclassid=null;
|
superclassid=null;
|
||||||
}
|
}
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
if(!name.equals("Object"))//Alle Klassen außer Object erben von Object:
|
||||||
|
this.superClass = new Class("Object", -1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
public Class(String name, Class superClass, int offset){
|
||||||
|
this(name,offset);
|
||||||
|
this.superClass = superClass;
|
||||||
|
}
|
||||||
|
|
||||||
// ino.method.Class.23044.definition
|
// ino.method.Class.23044.definition
|
||||||
public Class(String name, Modifiers mod, int offset)
|
public Class(String name, Modifiers mod, int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -179,7 +189,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.Class.23047.definition
|
// ino.method.Class.23047.definition
|
||||||
public Class(String name, Modifiers mod, ClassBody cb, Vector<Type> ct, Vector<UsedId> usedIdsToCheck,
|
public Class(String name, Modifiers mod, ClassBody cb, Vector<Type> ct, Vector<UsedId> usedIdsToCheck,
|
||||||
UsedId superclass, Vector<UsedId> superif, Vector<Type> paralist, int offset)
|
UsedId superclass, Vector<Interface> superif, Vector<Type> paralist, int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.Class.23047.body
|
// ino.method.Class.23047.body
|
||||||
{
|
{
|
||||||
@ -1072,7 +1082,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().toString(), this.get_ParaList(), 0);
|
return new RefType(this.getName().toString(), this.get_ParaList(),this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1208,6 +1218,12 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Die Super Klasse dieser Klasse.
|
||||||
|
* @return null für Klasse Object
|
||||||
|
*/
|
||||||
|
public Class getSuperClass(){
|
||||||
|
return this.superClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -248,7 +248,7 @@ public class SourceFile
|
|||||||
*/
|
*/
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.createPairFromClassAndSuperclass.21400.definition
|
// ino.method.createPairFromClassAndSuperclass.21400.definition
|
||||||
private Pair createPairFromClassAndSuperclass(JavaClassName className, JavaClassName superclassName, Vector classParaOrg, Vector superclassParaOrg)
|
private Pair createPairFromClassAndSuperclass(Class baseClass, Class superclass, Vector classParaOrg, Vector superclassParaOrg)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.createPairFromClassAndSuperclass.21400.body
|
// ino.method.createPairFromClassAndSuperclass.21400.body
|
||||||
{
|
{
|
||||||
@ -259,10 +259,13 @@ public class SourceFile
|
|||||||
if(superclassParaOrg!=null && superclassParaOrg.size()==0){
|
if(superclassParaOrg!=null && superclassParaOrg.size()==0){
|
||||||
superclassParaOrg=null;
|
superclassParaOrg=null;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
Pair P = new Pair(
|
Pair P = new Pair(
|
||||||
new RefType( className.toString(), classParaOrg,-1),
|
new RefType( className.toString(), classParaOrg,-1),
|
||||||
new RefType( superclassName.toString(), superclassParaOrg,-1)
|
new RefType( superclassName.toString(), superclassParaOrg,-1)
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
Pair P = new Pair(baseClass.getType(), superclass.getType());
|
||||||
//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();
|
||||||
@ -305,17 +308,16 @@ public class SourceFile
|
|||||||
{
|
{
|
||||||
Class tempKlasse = KlassenVektor.elementAt(i);
|
Class tempKlasse = KlassenVektor.elementAt(i);
|
||||||
inferencelog.debug("Verarbeite "+tempKlasse.getName());
|
inferencelog.debug("Verarbeite "+tempKlasse.getName());
|
||||||
|
//TODO: SuperKlasse erstellen, dies sollte am besten beim Konstruktoraufruf von Class geschehen. Diese kann dann mit getSuperClass abgefragt werden.
|
||||||
if( tempKlasse.superclassid != null ) { // Klasse hat Superklasse
|
if( tempKlasse.superclassid != null ) { // Klasse hat Superklasse
|
||||||
Pair P=createPairFromClassAndSuperclass(tempKlasse.getName(),tempKlasse.get_Superclass_Name(),tempKlasse.get_ParaList(),tempKlasse.superclassid.get_ParaList());
|
Pair P=createPairFromClassAndSuperclass(tempKlasse,tempKlasse.getSuperClass(),tempKlasse.get_ParaList(),tempKlasse.superclassid.get_ParaList());
|
||||||
vFC.add( P );
|
vFC.add( P );
|
||||||
}
|
}
|
||||||
if(tempKlasse.getSuperInterfaces()!=null){
|
if(tempKlasse.getSuperInterfaces()!=null){
|
||||||
Iterator<UsedId> interfaceIterator=tempKlasse.getSuperInterfaces().iterator();
|
Iterator<Interface> interfaceIterator=tempKlasse.getSuperInterfaces().iterator();
|
||||||
while(interfaceIterator.hasNext()){
|
while(interfaceIterator.hasNext()){
|
||||||
UsedId intf=interfaceIterator.next();
|
Interface intf=interfaceIterator.next();
|
||||||
JavaClassName interfaceName=intf.getQualifiedName();
|
Pair P=createPairFromClassAndSuperclass(tempKlasse,intf,tempKlasse.get_ParaList(),intf.get_ParaList());
|
||||||
Pair P=createPairFromClassAndSuperclass(tempKlasse.getName(),interfaceName,tempKlasse.get_ParaList(),intf.get_ParaList());
|
|
||||||
vFC.add( P );
|
vFC.add( P );
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -324,11 +326,10 @@ public class SourceFile
|
|||||||
for(int i=0; i<InterfaceVektor.size();i++){
|
for(int i=0; i<InterfaceVektor.size();i++){
|
||||||
Interface intf= InterfaceVektor.get(i);
|
Interface intf= InterfaceVektor.get(i);
|
||||||
if(intf.getSuperInterfaces()!=null){
|
if(intf.getSuperInterfaces()!=null){
|
||||||
Iterator<UsedId> interfaceIterator=intf.getSuperInterfaces().iterator();
|
Iterator<Interface> interfaceIterator=intf.getSuperInterfaces().iterator();
|
||||||
while(interfaceIterator.hasNext()){
|
while(interfaceIterator.hasNext()){
|
||||||
UsedId superintf=interfaceIterator.next();
|
Interface superintf=interfaceIterator.next();
|
||||||
JavaClassName superinterfaceName=superintf.getQualifiedName();
|
Pair P=createPairFromClassAndSuperclass(intf,superintf,intf.getParaList(), superintf.get_ParaList());
|
||||||
Pair P=createPairFromClassAndSuperclass(intf.getName(),superinterfaceName,intf.getParaList(), superintf.get_ParaList());
|
|
||||||
vFC.add( P );
|
vFC.add( P );
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1168,7 +1169,7 @@ public class SourceFile
|
|||||||
|
|
||||||
for(int j=0;j<fields.length;j++){
|
for(int j=0;j<fields.length;j++){
|
||||||
if(java.lang.reflect.Modifier.isPublic(fields[j].getModifiers())){
|
if(java.lang.reflect.Modifier.isPublic(fields[j].getModifiers())){
|
||||||
parentClass.addField(new FieldDeclaration(fields[j].getName(),new RefType(fields[j].getType().getName(),-1)));
|
parentClass.addField(new FieldDeclaration(fields[j].getName(),new RefType(fields[j].getType().getName(),parentClass,-1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int j=0;j<methods.length;j++){
|
for(int j=0;j<methods.length;j++){
|
||||||
@ -1204,19 +1205,20 @@ public class SourceFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(int j=0;j<constructors.length;j++){
|
for(int j=0;j<constructors.length;j++){
|
||||||
|
String methodName=className;
|
||||||
|
Method constructorMethod = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass);
|
||||||
|
|
||||||
if(java.lang.reflect.Modifier.isPublic(constructors[j].getModifiers())){
|
if(java.lang.reflect.Modifier.isPublic(constructors[j].getModifiers())){
|
||||||
String methodName=className;
|
|
||||||
ParameterList paraList = new ParameterList();
|
ParameterList paraList = new ParameterList();
|
||||||
for(int k=0;k<constructors[j].getParameterTypes().length;k++){
|
for(int k=0;k<constructors[j].getParameterTypes().length;k++){
|
||||||
String paraType=constructors[j].getParameterTypes()[k].getName();
|
String paraType=constructors[j].getParameterTypes()[k].getName();
|
||||||
//String paraType=constructors[j].getParameterTypes()[k].getSimpleName();
|
//String paraType=constructors[j].getParameterTypes()[k].getSimpleName();
|
||||||
// Fixme HOTI beachte overloaded id
|
// Fixme HOTI beachte overloaded id
|
||||||
FormalParameter fpara = new FormalParameter(new DeclId("p"+k));
|
FormalParameter fpara = new FormalParameter(new DeclId("p"+k));
|
||||||
fpara.setType(new RefType(paraType,-1));
|
fpara.setType(new RefType(paraType,constructorMethod,-1));
|
||||||
paraList.formalparameter.add(fpara);
|
paraList.formalparameter.add(fpara);
|
||||||
}
|
}
|
||||||
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor));
|
//basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor));
|
||||||
Method constructorMethod = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass);
|
|
||||||
constructorMethod.parameterlist = paraList;
|
constructorMethod.parameterlist = paraList;
|
||||||
parentClass.addField(new Constructor(constructorMethod));
|
parentClass.addField(new Constructor(constructorMethod));
|
||||||
}
|
}
|
||||||
@ -1271,14 +1273,14 @@ public class SourceFile
|
|||||||
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
|
//String jccNameForClass=baseTypeTranslationTable.get(cl.getSimpleName());
|
||||||
String jccNameForClass=baseTypeTranslationTable.get(cl.getName());
|
String jccNameForClass=baseTypeTranslationTable.get(cl.getName());
|
||||||
if(cl.getSimpleName().equalsIgnoreCase("void")){
|
if(cl.getSimpleName().equalsIgnoreCase("void")){
|
||||||
return(new Void(-1));
|
return(new Void(parentClass,-1));
|
||||||
}else if(jccNameForClass!=null){
|
}else if(jccNameForClass!=null){
|
||||||
RefType rt=new RefType(jccNameForClass,-1);
|
RefType rt=new RefType(jccNameForClass,parentClass,-1);
|
||||||
rt.setPrimitiveFlag(true);
|
rt.setPrimitiveFlag(true);
|
||||||
return(rt);
|
return(rt);
|
||||||
}else{
|
}else{
|
||||||
//return(new RefType(cl.getSimpleName()));
|
//return(new RefType(cl.getSimpleName()));
|
||||||
return(new RefType(cl.getName(),-1));
|
return(new RefType(cl.getName(),parentClass,-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,11 @@ public abstract class AddOp extends Operator
|
|||||||
protected Hashtable<RefType,RefType> getOperatorTypes() {
|
protected Hashtable<RefType,RefType> getOperatorTypes() {
|
||||||
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
||||||
|
|
||||||
types.put(new RefType("java.lang.Integer",-1),new RefType("java.lang.Integer",-1));
|
types.put(new RefType("java.lang.Integer",this,-1),new RefType("java.lang.Integer",this,-1));
|
||||||
types.put(new RefType("java.lang.Double",-1),new RefType("java.lang.Double",-1));
|
types.put(new RefType("java.lang.Double",this,-1),new RefType("java.lang.Double",this,-1));
|
||||||
types.put(new RefType("java.lang.Float",-1), new RefType("java.lang.Float",-1));
|
types.put(new RefType("java.lang.Float",this,-1), new RefType("java.lang.Float",this,-1));
|
||||||
types.put(new RefType("java.lang.Long",-1), new RefType("java.lang.Long",-1));
|
types.put(new RefType("java.lang.Long",this,-1), new RefType("java.lang.Long",this,-1));
|
||||||
types.put(new RefType("java.lang.String",-1), new RefType("java.lang.String",-1));
|
types.put(new RefType("java.lang.String",this,-1), new RefType("java.lang.String",this,-1));
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
@ -62,11 +62,11 @@ public abstract class AddOp extends Operator
|
|||||||
@Override
|
@Override
|
||||||
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
||||||
HashMap<ConstraintType,ConstraintType> ret = new HashMap<ConstraintType,ConstraintType>();
|
HashMap<ConstraintType,ConstraintType> ret = new HashMap<ConstraintType,ConstraintType>();
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Integer",-1), this), ass.getTypeFor(new RefType("java.lang.Integer",-1),this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Integer",this,-1), this), ass.getTypeFor(new RefType("java.lang.Integer",this,-1),this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Double",-1), this), ass.getTypeFor(new RefType("java.lang.Double",-1),this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Double",this,-1), this), ass.getTypeFor(new RefType("java.lang.Double",this,-1),this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Float",-1), this), ass.getTypeFor(new RefType("java.lang.Float",-1),this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Float",this,-1), this), ass.getTypeFor(new RefType("java.lang.Float",this,-1),this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Long",-1), this), ass.getTypeFor(new RefType("java.lang.Long",-1),this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Long",this,-1), this), ass.getTypeFor(new RefType("java.lang.Long",this,-1),this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.String",-1),this), ass.getTypeFor(new RefType("java.lang.String",-1),this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.String",this,-1),this), ass.getTypeFor(new RefType("java.lang.String",this,-1),this));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ public abstract class LogOp extends Operator
|
|||||||
protected Hashtable<RefType, RefType> getOperatorTypes() {
|
protected Hashtable<RefType, RefType> getOperatorTypes() {
|
||||||
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
||||||
|
|
||||||
types.put(new RefType("java.lang.Boolean",-1), new RefType("java.lang.Boolean",-1));
|
types.put(new RefType("java.lang.Boolean",this,-1), new RefType("java.lang.Boolean",this,-1));
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ public abstract class LogOp extends Operator
|
|||||||
@Override
|
@Override
|
||||||
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
||||||
HashMap<ConstraintType,ConstraintType> ret = new HashMap<>();
|
HashMap<ConstraintType,ConstraintType> ret = new HashMap<>();
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",-1), this), ass.getTypeFor(new RefType("java.lang.Boolean",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",this,-1), this), ass.getTypeFor(new RefType("java.lang.Boolean",this,-1), this));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ public abstract class MulOp extends Operator
|
|||||||
@Override
|
@Override
|
||||||
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
||||||
HashMap<ConstraintType,ConstraintType> ret = new HashMap<>();
|
HashMap<ConstraintType,ConstraintType> ret = new HashMap<>();
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Integer",-1), this), ass.getTypeFor(new RefType("java.lang.Integer",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Integer",this,-1), this), ass.getTypeFor(new RefType("java.lang.Integer",this,-1), this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Double",-1), this), ass.getTypeFor(new RefType("java.lang.Double",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Double",this,-1), this), ass.getTypeFor(new RefType("java.lang.Double",this,-1), this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Float",-1), this), ass.getTypeFor(new RefType("java.lang.Float",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Float",this,-1), this), ass.getTypeFor(new RefType("java.lang.Float",this,-1), this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Long",-1), this), ass.getTypeFor(new RefType("java.lang.Long",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Long",this,-1), this), ass.getTypeFor(new RefType("java.lang.Long",this,-1), this));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ public abstract class RelOp extends Operator
|
|||||||
protected Hashtable<RefType, RefType> getOperatorTypes() {
|
protected Hashtable<RefType, RefType> getOperatorTypes() {
|
||||||
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
Hashtable<RefType, RefType> types = new Hashtable<RefType, RefType>();
|
||||||
|
|
||||||
types.put(new RefType("java.lang.Integer",-1), new RefType("java.lang.Boolean",-1));
|
types.put(new RefType("java.lang.Integer",this,-1), new RefType("java.lang.Boolean",this,-1));
|
||||||
types.put(new RefType("java.lang.Double",-1), new RefType("java.lang.Boolean",-1));
|
types.put(new RefType("java.lang.Double",this,-1), new RefType("java.lang.Boolean",this,-1));
|
||||||
types.put(new RefType("java.lang.Float",-1), new RefType("java.lang.Boolean",-1));
|
types.put(new RefType("java.lang.Float",this,-1), new RefType("java.lang.Boolean",this,-1));
|
||||||
types.put(new RefType("java.lang.Long",-1), new RefType("java.lang.Boolean",-1));
|
types.put(new RefType("java.lang.Long",this,-1), new RefType("java.lang.Boolean",this,-1));
|
||||||
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
@ -54,10 +54,10 @@ public abstract class RelOp extends Operator
|
|||||||
@Override
|
@Override
|
||||||
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
public HashMap<ConstraintType,ConstraintType> getReturnTypes(TypeAssumptions ass) {
|
||||||
HashMap<ConstraintType,ConstraintType> ret = new HashMap<>();
|
HashMap<ConstraintType,ConstraintType> ret = new HashMap<>();
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",-1), this), ass.getTypeFor(new RefType("java.lang.Integer",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",this,-1), this), ass.getTypeFor(new RefType("java.lang.Integer",this,-1), this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",-1), this), ass.getTypeFor(new RefType("java.lang.Double",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",this,-1), this), ass.getTypeFor(new RefType("java.lang.Double",this,-1), this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",-1), this), ass.getTypeFor(new RefType("java.lang.Float",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",this,-1), this), ass.getTypeFor(new RefType("java.lang.Float",this,-1), this));
|
||||||
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",-1), this), ass.getTypeFor(new RefType("java.lang.Long",-1), this));
|
ret.put(ass.getTypeFor(new RefType("java.lang.Boolean",this,-1), this), ass.getTypeFor(new RefType("java.lang.Long",this,-1), this));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.Pair;
|
import de.dhbwstuttgart.typeinference.Pair;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
@ -203,7 +202,7 @@ public class Assign extends Expr
|
|||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
|
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
|
||||||
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
|
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
|
||||||
this.setType(new Void(0)); //Typ des Statments auf Void setzen.
|
this.setType(new Void(this,0)); //Typ des Statments auf Void setzen.
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintType;
|
import de.dhbwstuttgart.typeinference.ConstraintType;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
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;
|
||||||
@ -169,7 +168,7 @@ public class Block extends Statement
|
|||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
||||||
ConstraintsSet ret = new ConstraintsSet();
|
ConstraintsSet ret = new ConstraintsSet();
|
||||||
if(statements.size()==0)this.setType(new Void(0));
|
if(statements.size()==0)this.setType(new Void(this,0));
|
||||||
/* this.setTypeVariable(TypePlaceholder.fresh(this)); */
|
/* this.setTypeVariable(TypePlaceholder.fresh(this)); */
|
||||||
for(Statement stmt : statements){
|
for(Statement stmt : statements){
|
||||||
typinferenceLog.debug("Prozessing statement: "+stmt);
|
typinferenceLog.debug("Prozessing statement: "+stmt);
|
||||||
@ -199,7 +198,7 @@ public class Block extends Statement
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
this.setType(new Void(0));
|
this.setType(new Void(this,0));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class BoolLiteral extends Literal
|
|||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
// #JB# 20.04.2005
|
// #JB# 20.04.2005
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
this.setType(new BooleanType());
|
this.setType(new BooleanType(this));
|
||||||
//this.setType(new Type("boolean"));
|
//this.setType(new Type("boolean"));
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ public class BoolLiteral extends Literal
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||||
this.type = assumptions.getTypeFor(new RefType("java.lang.Boolean",-1), this).getType();
|
this.type = assumptions.getTypeFor(new RefType("java.lang.Boolean",this,-1), this).getType();
|
||||||
return new ConstraintsSet();
|
return new ConstraintsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class CharLiteral extends Literal
|
|||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
// #JB# 20.04.2005
|
// #JB# 20.04.2005
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
this.setType(new CharacterType());
|
this.setType(new CharacterType(this));
|
||||||
//this.setType(new Type("char"));
|
//this.setType(new Type("char"));
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class DoubleLiteral extends Literal
|
|||||||
{
|
{
|
||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
|
|
||||||
this.setType(new DoubleType());
|
this.setType(new DoubleType(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -164,7 +164,7 @@ public class DoubleLiteral extends Literal
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||||
this.setType(assumptions.getTypeFor(new RefType("Double",this.getOffset()), this).getType());
|
this.setType(assumptions.getTypeFor(new RefType("Double",this,this.getOffset()), this).getType());
|
||||||
return new ConstraintsSet();
|
return new ConstraintsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public class FloatLiteral extends Literal
|
|||||||
{
|
{
|
||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
|
|
||||||
this.setType(new FloatType());
|
this.setType(new FloatType(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -28,7 +28,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.Pair;
|
import de.dhbwstuttgart.typeinference.Pair;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
@ -259,10 +258,10 @@ public class IfStmt extends Statement
|
|||||||
ret.add(this.else_block.TYPEStmt(assumptions));
|
ret.add(this.else_block.TYPEStmt(assumptions));
|
||||||
if(!(else_block.getType() instanceof Void))ret.add(new SingleConstraint(else_block.getType().TYPE(assumptions, this),this.getType().TYPE(assumptions, this)));
|
if(!(else_block.getType() instanceof Void))ret.add(new SingleConstraint(else_block.getType().TYPE(assumptions, this),this.getType().TYPE(assumptions, this)));
|
||||||
}
|
}
|
||||||
ret.add(new SingleConstraint(expr.getType().TYPE(assumptions, this),assumptions.getTypeFor(new RefType("Boolean",0), this))); //(expressionDesIfStmt)<.boolean
|
ret.add(new SingleConstraint(expr.getType().TYPE(assumptions, this),assumptions.getTypeFor(new RefType("Boolean",this,0), this))); //(expressionDesIfStmt)<.boolean
|
||||||
if(!(then_block.getType() instanceof Void))ret.add(new SingleConstraint(then_block.getType().TYPE(assumptions, this),this.getType().TYPE(assumptions, this)));
|
if(!(then_block.getType() instanceof Void))ret.add(new SingleConstraint(then_block.getType().TYPE(assumptions, this),this.getType().TYPE(assumptions, this)));
|
||||||
if(then_block.getType() instanceof Void &&
|
if(then_block.getType() instanceof Void &&
|
||||||
(else_block == null || else_block.getType() instanceof Void))this.setType(new Void(this.getOffset()));
|
(else_block == null || else_block.getType() instanceof Void))this.setType(new Void(this,this.getOffset()));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.OderConstraint;
|
import de.dhbwstuttgart.typeinference.OderConstraint;
|
||||||
import de.dhbwstuttgart.typeinference.Pair;
|
import de.dhbwstuttgart.typeinference.Pair;
|
||||||
|
@ -56,7 +56,7 @@ public class InstanceOf extends BinaryExpr
|
|||||||
super(offset,variableLength);
|
super(offset,variableLength);
|
||||||
// #JB# 20.04.2005
|
// #JB# 20.04.2005
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
this.setType(new BooleanType());
|
this.setType(new BooleanType(this));
|
||||||
//this.setType(new Type("boolean"));
|
//this.setType(new Type("boolean"));
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class IntLiteral extends Literal
|
|||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
// #JB# 20.04.2005
|
// #JB# 20.04.2005
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
this.setType(new IntegerType());
|
this.setType(new IntegerType(this));
|
||||||
//this.setType(new Type("int"));
|
//this.setType(new Type("int"));
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ public class IntLiteral extends Literal
|
|||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||||
ConstraintsSet ret = new ConstraintsSet();
|
ConstraintsSet ret = new ConstraintsSet();
|
||||||
//this.setType(new IntegerType());
|
//this.setType(new IntegerType());
|
||||||
this.set_Type(assumptions.getTypeFor(new RefType("java.lang.Integer",-1), this).getType());
|
this.set_Type(assumptions.getTypeFor(new RefType("java.lang.Integer",this,-1), this).getType());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
import de.dhbwstuttgart.typeinference.FunN;
|
import de.dhbwstuttgart.typeinference.FunN;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
@ -22,7 +22,6 @@ import de.dhbwstuttgart.syntaxtree.type.RefType;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
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;
|
||||||
|
@ -24,7 +24,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
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;
|
||||||
@ -385,7 +384,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
|
|||||||
assumptions.addAssumption(new LocalVarAssumption(this, this.getType())); //Bevor der Typ auf Void gesetzt wird.
|
assumptions.addAssumption(new LocalVarAssumption(this, this.getType())); //Bevor der Typ auf Void gesetzt wird.
|
||||||
ret.add(new SingleConstraint(this.getType().TYPE(assumptions, this), this.getType().TYPE(assumptions, this)));
|
ret.add(new SingleConstraint(this.getType().TYPE(assumptions, this), this.getType().TYPE(assumptions, this)));
|
||||||
//assumptions.remove(null); // falls Variable mit diesem Namen bereits vorhanden.
|
//assumptions.remove(null); // falls Variable mit diesem Namen bereits vorhanden.
|
||||||
this.setReturnType(new Void(0)); //Return typ einer Variablendeklaration ist Void
|
this.setReturnType(new Void(this,0)); //Return typ einer Variablendeklaration ist Void
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class LongLiteral extends Literal
|
|||||||
{
|
{
|
||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
|
|
||||||
this.setType(new LongType());
|
this.setType(new LongType(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -209,7 +209,7 @@ public class MethodCall extends Expr
|
|||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
|
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
|
||||||
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
|
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
|
||||||
this.setType(new Void(0)); //Typ des Statments auf Void setzen, da als alleinstehendes Statement
|
this.setType(new Void(this,0)); //Typ des Statments auf Void setzen, da als alleinstehendes Statement
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Void;
|
import de.dhbwstuttgart.syntaxtree.type.Void;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
import de.dhbwstuttgart.typeinference.FunN;
|
import de.dhbwstuttgart.typeinference.FunN;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.Overloading;
|
import de.dhbwstuttgart.typeinference.Overloading;
|
||||||
@ -108,7 +107,7 @@ public class NewClass extends Expr
|
|||||||
parserlog.debug("Vergleiche "+usedid+" mit "+next);
|
parserlog.debug("Vergleiche "+usedid+" mit "+next);
|
||||||
if(usedid.equals(next))
|
if(usedid.equals(next))
|
||||||
{
|
{
|
||||||
this.set_Type(new Type(next,getOffset()));
|
this.set_Type(new Type(next,this,getOffset()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else next = null;
|
else next = null;
|
||||||
@ -225,7 +224,7 @@ public class NewClass extends Expr
|
|||||||
// ret.add(arg.TYPEExpr(assumptions));
|
// ret.add(arg.TYPEExpr(assumptions));
|
||||||
//}
|
//}
|
||||||
|
|
||||||
this.setType(assumptions.getTypeFor(new RefType(this.get_Name(),0), this).getType());
|
this.setType(assumptions.getTypeFor(new RefType(this.get_Name(),this,0), this).getType());
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -249,7 +248,7 @@ public class NewClass extends Expr
|
|||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
|
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){
|
||||||
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
|
ConstraintsSet ret = this.TYPEExpr(assumptions); //TypeExpr aufrufen
|
||||||
this.setType(new Void(0)); //Typ des Statments auf Void setzen.
|
this.setType(new Void(this,0)); //Typ des Statments auf Void setzen.
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class NotExpr extends UnaryExpr
|
|||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||||
ConstraintsSet ret = new ConstraintsSet();
|
ConstraintsSet ret = new ConstraintsSet();
|
||||||
OderConstraint constraint = new OderConstraint();
|
OderConstraint constraint = new OderConstraint();
|
||||||
constraint.addConstraint(this.getType().TYPE(assumptions, this), assumptions.getTypeFor(new RefType("Boolean",-1),this));
|
constraint.addConstraint(this.getType().TYPE(assumptions, this), assumptions.getTypeFor(new RefType("Boolean",this,-1),this));
|
||||||
ret.add(constraint);
|
ret.add(constraint);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class Null extends Literal
|
|||||||
// ino.method.Null.25926.body
|
// ino.method.Null.25926.body
|
||||||
{
|
{
|
||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
this.setType(new Type("__NULL__",getOffset()));
|
this.setType(new Type("__NULL__",this,getOffset()));
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
import de.dhbwstuttgart.typeinference.ConstraintsSet;
|
||||||
import de.dhbwstuttgart.typeinference.FreshTypeVariable;
|
|
||||||
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;
|
||||||
|
@ -128,7 +128,7 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Type getReturnType(){
|
public Type getReturnType(){
|
||||||
return new de.dhbwstuttgart.syntaxtree.type.Void(-1);
|
return new de.dhbwstuttgart.syntaxtree.type.Void(this,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
@ -49,7 +49,7 @@ public class StringLiteral extends Literal
|
|||||||
super(-1,-1);
|
super(-1,-1);
|
||||||
// #JB# 20.04.2005
|
// #JB# 20.04.2005
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
this.setType(new RefType("java.lang.String",getOffset()));
|
this.setType(new RefType("java.lang.String",this,getOffset()));
|
||||||
//this.setType(new Type("String"));
|
//this.setType(new Type("String"));
|
||||||
// ###########################################################
|
// ###########################################################
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ public class StringLiteral extends Literal
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) {
|
||||||
this.set_Type(assumptions.getTypeFor(new RefType("String",0), this).getType());
|
this.set_Type(assumptions.getTypeFor(new RefType("String",this,0), this).getType());
|
||||||
return new ConstraintsSet();
|
return new ConstraintsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +40,9 @@ public abstract class UnaryExpr extends Expr
|
|||||||
|
|
||||||
private Vector<RefType> getNumericTypes(){
|
private Vector<RefType> getNumericTypes(){
|
||||||
Vector<RefType> ret = new Vector<>();
|
Vector<RefType> ret = new Vector<>();
|
||||||
ret.add(new RefType("Integer",-1));
|
ret.add(new RefType("Integer",this,-1));
|
||||||
ret.add(new RefType("Long",-1));
|
ret.add(new RefType("Long",this,-1));
|
||||||
ret.add(new RefType("Double",-1));
|
ret.add(new RefType("Double",this,-1));
|
||||||
return ret ;
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ public class WhileStmt extends Statement
|
|||||||
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) {
|
||||||
ConstraintsSet ret = new ConstraintsSet();
|
ConstraintsSet ret = new ConstraintsSet();
|
||||||
ret.add(expr.TYPEExpr(assumptions));
|
ret.add(expr.TYPEExpr(assumptions));
|
||||||
SingleConstraint exprMustBeBool = new SingleConstraint(expr.getType().TYPE(assumptions, this), assumptions.getTypeFor(new RefType("Boolean", 0), this)); // while(expr){}; expr <. boolean
|
SingleConstraint exprMustBeBool = new SingleConstraint(expr.getType().TYPE(assumptions, this), assumptions.getTypeFor(new RefType("Boolean",this, 0), this)); // while(expr){}; expr <. boolean
|
||||||
ret.add(exprMustBeBool);
|
ret.add(exprMustBeBool);
|
||||||
ret.add(this.loop_block.TYPEStmt(assumptions));
|
ret.add(this.loop_block.TYPEStmt(assumptions));
|
||||||
this.setType(loop_block.getType());
|
this.setType(loop_block.getType());
|
||||||
|
@ -21,20 +21,20 @@ public abstract class BaseType extends Type
|
|||||||
private boolean IsArray = false;
|
private boolean IsArray = false;
|
||||||
|
|
||||||
// ino.method.BaseType.26439.definition
|
// ino.method.BaseType.26439.definition
|
||||||
public BaseType(int offset)
|
public BaseType(SyntaxTreeNode parent, int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.BaseType.26439.body
|
// ino.method.BaseType.26439.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent, offset);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.BaseType.26442.definition
|
// ino.method.BaseType.26442.definition
|
||||||
public BaseType(String name,int offset)
|
public BaseType(String name,SyntaxTreeNode parent,int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.BaseType.26442.body
|
// ino.method.BaseType.26442.body
|
||||||
{
|
{
|
||||||
super(name, offset);
|
super(name,parent, offset);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// ino.module.BooleanType.8668.package
|
// ino.module.BooleanType.8668.package
|
||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -11,11 +12,11 @@ public class BooleanType extends BaseType
|
|||||||
// ino.class.BooleanType.26451.body
|
// ino.class.BooleanType.26451.body
|
||||||
{
|
{
|
||||||
// ino.method.BooleanType.26455.definition
|
// ino.method.BooleanType.26455.definition
|
||||||
public BooleanType()
|
public BooleanType(SyntaxTreeNode parent)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.BooleanType.26455.body
|
// ino.method.BooleanType.26455.body
|
||||||
{
|
{
|
||||||
super("boolean",-1);
|
super("boolean",parent, -1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class BooleanType extends BaseType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26461.body
|
// ino.method.clone.26461.body
|
||||||
{
|
{
|
||||||
return new BooleanType();
|
return new BooleanType(this.getParent());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// ino.module.CharacterType.8670.package
|
// ino.module.CharacterType.8670.package
|
||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -11,11 +12,11 @@ public class CharacterType extends BaseType
|
|||||||
// ino.class.CharacterType.26492.body
|
// ino.class.CharacterType.26492.body
|
||||||
{
|
{
|
||||||
// ino.method.CharacterType.26496.definition
|
// ino.method.CharacterType.26496.definition
|
||||||
public CharacterType()
|
public CharacterType(SyntaxTreeNode parent)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.CharacterType.26496.body
|
// ino.method.CharacterType.26496.body
|
||||||
{
|
{
|
||||||
super("char",-1);
|
super("char",parent,-1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class CharacterType extends BaseType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26502.body
|
// ino.method.clone.26502.body
|
||||||
{
|
{
|
||||||
return new CharacterType();
|
return new CharacterType(this.getParent());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// ino.module.IntegerType.8672.package
|
// ino.module.IntegerType.8672.package
|
||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -11,11 +12,11 @@ public class DoubleType extends BaseType
|
|||||||
// ino.class.IntegerType.26527.body
|
// ino.class.IntegerType.26527.body
|
||||||
{
|
{
|
||||||
// ino.method.IntegerType.26531.definition
|
// ino.method.IntegerType.26531.definition
|
||||||
public DoubleType()
|
public DoubleType(SyntaxTreeNode parent)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.IntegerType.26531.body
|
// ino.method.IntegerType.26531.body
|
||||||
{
|
{
|
||||||
super("double",-1);
|
super("double",parent,-1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class DoubleType extends BaseType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26537.body
|
// ino.method.clone.26537.body
|
||||||
{
|
{
|
||||||
return new DoubleType();
|
return new DoubleType(this.getParent());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -22,7 +23,7 @@ public class ExtendsWildcardType extends WildcardType implements ITypeContainer,
|
|||||||
*/
|
*/
|
||||||
public ExtendsWildcardType (int offset, Type extendsType)
|
public ExtendsWildcardType (int offset, Type extendsType)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(extendsType.getParent(), offset);
|
||||||
this.extendsType = extendsType;
|
this.extendsType = extendsType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ public class ExtendsWildcardType extends WildcardType implements ITypeContainer,
|
|||||||
*/
|
*/
|
||||||
public FreshExtendsWildcardType GetFreshWildcardType()
|
public FreshExtendsWildcardType GetFreshWildcardType()
|
||||||
{
|
{
|
||||||
return new FreshExtendsWildcardType(this.extendsType,-1);
|
return new FreshExtendsWildcardType(this.extendsType,this.getParent(),-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// ino.module.IntegerType.8672.package
|
// ino.module.IntegerType.8672.package
|
||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -11,11 +12,11 @@ public class FloatType extends BaseType
|
|||||||
// ino.class.IntegerType.26527.body
|
// ino.class.IntegerType.26527.body
|
||||||
{
|
{
|
||||||
// ino.method.IntegerType.26531.definition
|
// ino.method.IntegerType.26531.definition
|
||||||
public FloatType()
|
public FloatType(SyntaxTreeNode parent)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.IntegerType.26531.body
|
// ino.method.IntegerType.26531.body
|
||||||
{
|
{
|
||||||
super("float",-1);
|
super("float", parent,-1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class FloatType extends BaseType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26537.body
|
// ino.method.clone.26537.body
|
||||||
{
|
{
|
||||||
return new FloatType();
|
return new FloatType(this.getParent());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
|
|
||||||
public class FreshExtendsWildcardType extends FreshWildcardType implements IMatchable {
|
public class FreshExtendsWildcardType extends FreshWildcardType implements IMatchable {
|
||||||
|
|
||||||
private Type extendsBoundType;
|
private Type extendsBoundType;
|
||||||
@ -8,9 +10,9 @@ public class FreshExtendsWildcardType extends FreshWildcardType implements IMatc
|
|||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Standard Konstruktor für eine FreshExtendsWildcard
|
* Standard Konstruktor für eine FreshExtendsWildcard
|
||||||
*/
|
*/
|
||||||
public FreshExtendsWildcardType(Type extendsBound ,int offset)
|
public FreshExtendsWildcardType(Type extendsBound,SyntaxTreeNode parent ,int offset)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
this.extendsBoundType = extendsBound;
|
this.extendsBoundType = extendsBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,9 +20,9 @@ public class FreshExtendsWildcardType extends FreshWildcardType implements IMatc
|
|||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Privater Konstruktor für clone
|
* Privater Konstruktor für clone
|
||||||
*/
|
*/
|
||||||
private FreshExtendsWildcardType(Type extendsBound ,int offset, String name)
|
private FreshExtendsWildcardType(Type extendsBound ,SyntaxTreeNode parent,int offset, String name)
|
||||||
{
|
{
|
||||||
super(offset,name);
|
super(parent,offset,name);
|
||||||
this.extendsBoundType = extendsBound;
|
this.extendsBoundType = extendsBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ public class FreshExtendsWildcardType extends FreshWildcardType implements IMatc
|
|||||||
*/
|
*/
|
||||||
public FreshExtendsWildcardType clone()
|
public FreshExtendsWildcardType clone()
|
||||||
{
|
{
|
||||||
return new FreshExtendsWildcardType(this.extendsBoundType.clone(),getOffset(),this.name.toString());
|
return new FreshExtendsWildcardType(this.extendsBoundType.clone(),this.getParent(),getOffset(),this.name.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
|
|
||||||
public class FreshSuperWildcardType extends FreshWildcardType implements IMatchable {
|
public class FreshSuperWildcardType extends FreshWildcardType implements IMatchable {
|
||||||
|
|
||||||
private Type superBoundType;
|
private Type superBoundType;
|
||||||
@ -8,9 +10,9 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
|
|||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Standard Konstruktor für eine FreshSuperWildcard
|
* Standard Konstruktor für eine FreshSuperWildcard
|
||||||
*/
|
*/
|
||||||
public FreshSuperWildcardType(Type superBound ,int offset)
|
public FreshSuperWildcardType(Type superBound ,SyntaxTreeNode parent, int offset)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
this.superBoundType = superBound;
|
this.superBoundType = superBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,9 +20,9 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
|
|||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Privater Konstruktor für clone
|
* Privater Konstruktor für clone
|
||||||
*/
|
*/
|
||||||
private FreshSuperWildcardType(Type superBound,int offset, String name)
|
private FreshSuperWildcardType(Type superBound,SyntaxTreeNode parent,int offset, String name)
|
||||||
{
|
{
|
||||||
super(offset,name);
|
super(parent,offset,name);
|
||||||
this.superBoundType = superBound;
|
this.superBoundType = superBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +46,7 @@ public class FreshSuperWildcardType extends FreshWildcardType implements IMatcha
|
|||||||
*/
|
*/
|
||||||
public FreshSuperWildcardType clone()
|
public FreshSuperWildcardType clone()
|
||||||
{
|
{
|
||||||
return new FreshSuperWildcardType(this.superBoundType.clone(),getOffset(),this.name.toString());
|
return new FreshSuperWildcardType(this.superBoundType.clone(),this.getParent(),getOffset(),this.name.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,6 +3,7 @@ package de.dhbwstuttgart.syntaxtree.type;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import de.dhbwstuttgart.parser.JavaClassName;
|
import de.dhbwstuttgart.parser.JavaClassName;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
@ -16,9 +17,9 @@ public class FreshWildcardType extends Type {
|
|||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Standard Konstruktor für eine FreshWildcard
|
* Standard Konstruktor für eine FreshWildcard
|
||||||
*/
|
*/
|
||||||
public FreshWildcardType(int offset)
|
public FreshWildcardType(SyntaxTreeNode parent, int offset)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent, offset);
|
||||||
this.name = makeNewName();
|
this.name = makeNewName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,9 +28,9 @@ public class FreshWildcardType extends Type {
|
|||||||
* Protected Konstruktor für clone.
|
* Protected Konstruktor für clone.
|
||||||
* Protected, da vererbte Klassen ihn verwenden müssen.
|
* Protected, da vererbte Klassen ihn verwenden müssen.
|
||||||
*/
|
*/
|
||||||
protected FreshWildcardType(int offset, String name)
|
protected FreshWildcardType(SyntaxTreeNode parent, int offset, String name)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent, offset);
|
||||||
this.name = new JavaClassName(name);
|
this.name = new JavaClassName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ public class FreshWildcardType extends Type {
|
|||||||
*/
|
*/
|
||||||
public FreshWildcardType clone()
|
public FreshWildcardType clone()
|
||||||
{
|
{
|
||||||
return new FreshWildcardType(getOffset(),this.name.toString());
|
return new FreshWildcardType(this.getParent(),getOffset(),this.name.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +147,7 @@ public class FreshWildcardType extends Type {
|
|||||||
*/
|
*/
|
||||||
public WildcardType get_WildcardType()
|
public WildcardType get_WildcardType()
|
||||||
{
|
{
|
||||||
return new WildcardType(this.getOffset());
|
return new WildcardType(this.getParent(),this.getOffset());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
|
@ -66,9 +66,8 @@ public class GenericTypeVar extends Type
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.GenericTypeVar.26509.body
|
// ino.method.GenericTypeVar.26509.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parentClass,offset);
|
||||||
this.name = new JavaClassName(s);
|
this.name = new JavaClassName(s);
|
||||||
this.parent = parentClass;
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// ino.module.IntegerType.8672.package
|
// ino.module.IntegerType.8672.package
|
||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -11,11 +12,11 @@ public class IntegerType extends BaseType
|
|||||||
// ino.class.IntegerType.26527.body
|
// ino.class.IntegerType.26527.body
|
||||||
{
|
{
|
||||||
// ino.method.IntegerType.26531.definition
|
// ino.method.IntegerType.26531.definition
|
||||||
public IntegerType()
|
public IntegerType(SyntaxTreeNode parent)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.IntegerType.26531.body
|
// ino.method.IntegerType.26531.body
|
||||||
{
|
{
|
||||||
super("int",-1);
|
super("int",parent,-1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class IntegerType extends BaseType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26537.body
|
// ino.method.clone.26537.body
|
||||||
{
|
{
|
||||||
return new IntegerType();
|
return new IntegerType(this.getParent());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// ino.module.IntegerType.8672.package
|
// ino.module.IntegerType.8672.package
|
||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -11,11 +12,11 @@ public class LongType extends BaseType
|
|||||||
// ino.class.IntegerType.26527.body
|
// ino.class.IntegerType.26527.body
|
||||||
{
|
{
|
||||||
// ino.method.IntegerType.26531.definition
|
// ino.method.IntegerType.26531.definition
|
||||||
public LongType()
|
public LongType(SyntaxTreeNode parent)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.IntegerType.26531.body
|
// ino.method.IntegerType.26531.body
|
||||||
{
|
{
|
||||||
super("long",-1);
|
super("long", parent,-1);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ public class LongType extends BaseType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26537.body
|
// ino.method.clone.26537.body
|
||||||
{
|
{
|
||||||
return new LongType();
|
return new LongType(this.getParent());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -66,20 +66,20 @@ public class RefType extends Type implements IMatchable
|
|||||||
|
|
||||||
|
|
||||||
// ino.method.RefType.26634.definition
|
// ino.method.RefType.26634.definition
|
||||||
public RefType(int offset)
|
public RefType(SyntaxTreeNode parent, int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.RefType.26634.body
|
// ino.method.RefType.26634.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.RefType.26637.definition
|
// ino.method.RefType.26637.definition
|
||||||
public RefType(String fullyQualifiedName, int offset)
|
public RefType(String fullyQualifiedName,SyntaxTreeNode parent, int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.RefType.26637.body
|
// ino.method.RefType.26637.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
this.setName(fullyQualifiedName);
|
this.setName(fullyQualifiedName);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -93,22 +93,22 @@ public class RefType extends Type implements IMatchable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ino.method.RefType.26640.definition
|
// ino.method.RefType.26640.definition
|
||||||
public RefType(String fullyQualifiedName, Vector parameter, int offset)
|
public RefType(String fullyQualifiedName, Vector parameter,SyntaxTreeNode parent, int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.RefType.26640.body
|
// ino.method.RefType.26640.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
this.setName(fullyQualifiedName);
|
this.setName(fullyQualifiedName);
|
||||||
if(parameter != null && parameter.size()>0)this.set_ParaList(parameter);
|
if(parameter != null && parameter.size()>0)this.set_ParaList(parameter);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.method.RefType.26643.definition
|
// ino.method.RefType.26643.definition
|
||||||
public RefType( RefType R, int offset )
|
public RefType( RefType R, SyntaxTreeNode parent,int offset )
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.RefType.26643.body
|
// ino.method.RefType.26643.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
// otth: Copy-Konstruktor
|
// otth: Copy-Konstruktor
|
||||||
this.setName(R.getTypeName());
|
this.setName(R.getTypeName());
|
||||||
this.set_ParaList(R.getParaList());
|
this.set_ParaList(R.getParaList());
|
||||||
@ -120,8 +120,8 @@ public class RefType extends Type implements IMatchable
|
|||||||
* Dabei wird der Name und der Offset des baseType's übernommen.
|
* Dabei wird der Name und der Offset des baseType's übernommen.
|
||||||
* @param baseType
|
* @param baseType
|
||||||
*/
|
*/
|
||||||
public RefType( Type baseType ){
|
public RefType( Type baseType){
|
||||||
super(baseType.getOffset());
|
super(baseType.getParent(),baseType.getOffset());
|
||||||
this.setName(baseType.name.toString());
|
this.setName(baseType.name.toString());
|
||||||
//this.parameter = null;
|
//this.parameter = null;
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ public class RefType extends Type implements IMatchable
|
|||||||
{
|
{
|
||||||
clonepara.addElement(((Type)para.elementAt(i)).clone());
|
clonepara.addElement(((Type)para.elementAt(i)).clone());
|
||||||
}
|
}
|
||||||
RefType newRefType=new RefType(this.getTypeName(), clonepara,getOffset());
|
RefType newRefType=new RefType(this.getTypeName(), clonepara,this.getParent(),getOffset());
|
||||||
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
|
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
|
||||||
return newRefType;
|
return newRefType;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ public class ReturnType extends Type
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.ReturnType.26707.body
|
// ino.method.ReturnType.26707.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(null,offset);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
|||||||
*/
|
*/
|
||||||
public SuperWildcardType(int offset, Type superType)
|
public SuperWildcardType(int offset, Type superType)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(superType.getParent(),offset);
|
||||||
this.superType = superType;
|
this.superType = superType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ public class SuperWildcardType extends WildcardType implements ITypeContainer, I
|
|||||||
*/
|
*/
|
||||||
public FreshSuperWildcardType GetFreshWildcardType()
|
public FreshSuperWildcardType GetFreshWildcardType()
|
||||||
{
|
{
|
||||||
return new FreshSuperWildcardType(this.superType,-1);
|
return new FreshSuperWildcardType(this.superType,this.getParent(),-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +50,7 @@ public class Type extends SyntaxTreeNode implements IItemWithOffset
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.Type.26732.body
|
// ino.method.Type.26732.body
|
||||||
{
|
{
|
||||||
|
this.parent = parent;
|
||||||
this.offset=offset;
|
this.offset=offset;
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -199,7 +200,7 @@ public class Type extends SyntaxTreeNode implements IItemWithOffset
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26768.body
|
// ino.method.clone.26768.body
|
||||||
{
|
{
|
||||||
return new Type(this.getName().toString(),getOffset());
|
return new Type(this.getName().toString(), this.getParent(),getOffset());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -53,9 +53,8 @@ public class TypePlaceholder extends Type
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.TypePlaceholder.26794.body
|
// ino.method.TypePlaceholder.26794.body
|
||||||
{
|
{
|
||||||
super(-1);
|
super(parent, -1);
|
||||||
this.name = new JavaClassName(typeName);
|
this.name = new JavaClassName(typeName);
|
||||||
this.parent = parent;
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ public class Void extends RefType
|
|||||||
// ino.class.Void.26857.body
|
// ino.class.Void.26857.body
|
||||||
{
|
{
|
||||||
// ino.method.Void.26861.definition
|
// ino.method.Void.26861.definition
|
||||||
public Void(int offset)
|
public Void(SyntaxTreeNode parent,int offset)
|
||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.Void.26861.body
|
// ino.method.Void.26861.body
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent,offset);
|
||||||
super.setName("void");
|
super.setName("void");
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
@ -66,7 +66,7 @@ public class Void extends RefType
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.clone.26867.body
|
// ino.method.clone.26867.body
|
||||||
{
|
{
|
||||||
return new Void(getOffset());
|
return new Void(this.getParent(),getOffset());
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.dhbwstuttgart.syntaxtree.type;
|
package de.dhbwstuttgart.syntaxtree.type;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||||
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
import de.dhbwstuttgart.typeinference.JavaCodeResult;
|
||||||
import de.dhbwstuttgart.typeinference.ResultSet;
|
import de.dhbwstuttgart.typeinference.ResultSet;
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
@ -17,9 +18,9 @@ public class WildcardType extends Type{
|
|||||||
* Author: Arne Lüdtke<br/>
|
* Author: Arne Lüdtke<br/>
|
||||||
* Standard Konstruktor für eine Wildcard
|
* Standard Konstruktor für eine Wildcard
|
||||||
*/
|
*/
|
||||||
public WildcardType(int offset)
|
public WildcardType(SyntaxTreeNode parent, int offset)
|
||||||
{
|
{
|
||||||
super(offset);
|
super(parent, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +38,7 @@ public class WildcardType extends Type{
|
|||||||
*/
|
*/
|
||||||
public WildcardType clone()
|
public WildcardType clone()
|
||||||
{
|
{
|
||||||
return new WildcardType(getOffset());
|
return new WildcardType(this.getParent(), getOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +66,7 @@ public class WildcardType extends Type{
|
|||||||
*/
|
*/
|
||||||
public FreshWildcardType GetFreshWildcardType()
|
public FreshWildcardType GetFreshWildcardType()
|
||||||
{
|
{
|
||||||
return new FreshWildcardType(-1);
|
return new FreshWildcardType(this.getParent(),-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package de.dhbwstuttgart.typeinference;
|
|
||||||
|
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
|
||||||
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
|
||||||
|
|
||||||
public class FreshTypeVariable extends Type{
|
|
||||||
|
|
||||||
private String hint = "";
|
|
||||||
|
|
||||||
public FreshTypeVariable(int offset) {
|
|
||||||
super(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Aufruf für Debug-Zwecke.
|
|
||||||
* @param hint - Eine Message die von der toString - Methode ausgegeben wird.
|
|
||||||
*/
|
|
||||||
public FreshTypeVariable(String hint){
|
|
||||||
this(0);
|
|
||||||
this.hint = hint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FreshTypeVariable(){
|
|
||||||
this(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString(){
|
|
||||||
if(hint.length()>0)return hint+" : a";
|
|
||||||
return "FreshTypeVariable";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
|
|
||||||
public JavaCodeResult printJavaCode(ResultSet resultSet) {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
@ -273,8 +273,8 @@ public class Pair
|
|||||||
hilfsvector3.addElement(p.TA1);
|
hilfsvector3.addElement(p.TA1);
|
||||||
hilfsvector4.addElement(p.TA2);
|
hilfsvector4.addElement(p.TA2);
|
||||||
//return (((RefType)TA1).is_Equiv((RefType)p.TA1, ht) && ((RefType)TA2).is_Equiv((RefType)p.TA2, ht));
|
//return (((RefType)TA1).is_Equiv((RefType)p.TA1, ht) && ((RefType)TA2).is_Equiv((RefType)p.TA2, ht));
|
||||||
return (new RefType("dummy", hilfsvector3,-1)).is_Equiv(new RefType("dummy", hilfsvector1,-1), ht) &&
|
return (new RefType("dummy", hilfsvector3,null,-1)).is_Equiv(new RefType("dummy", hilfsvector1,null,-1), ht) &&
|
||||||
(new RefType("dummy", hilfsvector4,-1)).is_Equiv(new RefType("dummy", hilfsvector2,-1), ht);
|
(new RefType("dummy", hilfsvector4,null,-1)).is_Equiv(new RefType("dummy", hilfsvector2,null,-1), ht);
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user