diff --git a/bin/.gitignore b/bin/.gitignore index 79da6df7..4ce50fc9 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,7 +1,6 @@ -/bytecode /de -/myJvmDisassembler -/mycompiler -/parser /plugindevelopment +/mycompiler +/mytypereconstruction /syntaxTree +/userinterface diff --git a/bin/bytecode/FieldTest.jav b/bin/bytecode/FieldTest.jav new file mode 100644 index 00000000..57f1614a --- /dev/null +++ b/bin/bytecode/FieldTest.jav @@ -0,0 +1,6 @@ +class FieldTest{ + String var; + String methode(String para1){ + return var; + } +} \ No newline at end of file diff --git a/bin/parser/BoundedParameter.jav b/bin/parser/BoundedParameter.jav new file mode 100644 index 00000000..6d7518a9 --- /dev/null +++ b/bin/parser/BoundedParameter.jav @@ -0,0 +1,3 @@ +class Matrix{ + String op = "String"; +} diff --git a/bin/parser/FieldInitializationTest.jav b/bin/parser/FieldInitializationTest.jav new file mode 100644 index 00000000..302667b9 --- /dev/null +++ b/bin/parser/FieldInitializationTest.jav @@ -0,0 +1,3 @@ +class FieldInitializationTest{ + String var = "hallo"; +} \ No newline at end of file diff --git a/bin/parser/GenericFieldVarTest.jav b/bin/parser/GenericFieldVarTest.jav new file mode 100644 index 00000000..a47b41eb --- /dev/null +++ b/bin/parser/GenericFieldVarTest.jav @@ -0,0 +1,3 @@ +class Test{ + A var; +} diff --git a/bin/parser/ImportTest.jav b/bin/parser/ImportTest.jav new file mode 100644 index 00000000..2de55cee --- /dev/null +++ b/bin/parser/ImportTest.jav @@ -0,0 +1,4 @@ +import java.util.*; + +class ImportTest{ +} \ No newline at end of file diff --git a/bin/myJvmDisassembler/.cvsignore b/src/de/dhbwstuttgart/JvmDisassembler/.cvsignore similarity index 100% rename from bin/myJvmDisassembler/.cvsignore rename to src/de/dhbwstuttgart/JvmDisassembler/.cvsignore diff --git a/src/myJvmDisassembler/GenericsTest.java b/src/de/dhbwstuttgart/JvmDisassembler/GenericsTest.java similarity index 83% rename from src/myJvmDisassembler/GenericsTest.java rename to src/de/dhbwstuttgart/JvmDisassembler/GenericsTest.java index 954fad1f..5185f056 100755 --- a/src/myJvmDisassembler/GenericsTest.java +++ b/src/de/dhbwstuttgart/JvmDisassembler/GenericsTest.java @@ -1,4 +1,4 @@ -package myJvmDisassembler; +package de.dhbwstuttgart.JvmDisassembler; diff --git a/src/myJvmDisassembler/jvmDisassembler.java b/src/de/dhbwstuttgart/JvmDisassembler/jvmDisassembler.java similarity index 99% rename from src/myJvmDisassembler/jvmDisassembler.java rename to src/de/dhbwstuttgart/JvmDisassembler/jvmDisassembler.java index 19bb41ba..6988d70a 100755 --- a/src/myJvmDisassembler/jvmDisassembler.java +++ b/src/de/dhbwstuttgart/JvmDisassembler/jvmDisassembler.java @@ -1,4 +1,4 @@ -package myJvmDisassembler; +package de.dhbwstuttgart.JvmDisassembler; import java.util.*; import java.io.*; diff --git a/src/de/dhbwstuttgart/core/AClassOrInterface.java b/src/de/dhbwstuttgart/core/AClassOrInterface.java index 7b9d3091..93323e79 100755 --- a/src/de/dhbwstuttgart/core/AClassOrInterface.java +++ b/src/de/dhbwstuttgart/core/AClassOrInterface.java @@ -6,17 +6,18 @@ package de.dhbwstuttgart.core; // ino.module.AClassOrInterface.8526.import import java.util.Vector; -import mycompiler.mymodifier.Modifiers; - import org.apache.log4j.Logger; // ino.end + + import de.dhbwstuttgart.myexception.JVMCodeException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.misc.UsedId; -import de.dhbwstuttgart.typeinference.parser.JavaClassName; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; // ino.class.AClassOrInterface.21186.description type=javadoc /** diff --git a/src/userinterface/ConsoleInterface.java b/src/de/dhbwstuttgart/core/ConsoleInterface.java similarity index 94% rename from src/userinterface/ConsoleInterface.java rename to src/de/dhbwstuttgart/core/ConsoleInterface.java index 8bd5e028..576077d7 100755 --- a/src/userinterface/ConsoleInterface.java +++ b/src/de/dhbwstuttgart/core/ConsoleInterface.java @@ -1,16 +1,13 @@ -package userinterface; +package de.dhbwstuttgart.core; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; -import java.util.Vector; import java.util.*; import org.apache.log4j.Logger; import org.apache.log4j.varia.NullAppender; -import de.dhbwstuttgart.core.MyCompiler; -import de.dhbwstuttgart.core.MyCompilerAPI; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; public class ConsoleInterface { diff --git a/src/de/dhbwstuttgart/core/MyCompiler.java b/src/de/dhbwstuttgart/core/MyCompiler.java index c8f2d43b..2eb043b0 100755 --- a/src/de/dhbwstuttgart/core/MyCompiler.java +++ b/src/de/dhbwstuttgart/core/MyCompiler.java @@ -22,6 +22,9 @@ import com.sun.org.apache.xerces.internal.impl.xs.identity.Field; import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; +import de.dhbwstuttgart.parser.JavaParser; +import de.dhbwstuttgart.parser.Scanner; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.ClassBody; import de.dhbwstuttgart.syntaxtree.FormalParameter; @@ -45,9 +48,6 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.exceptions.ParserError; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; -import de.dhbwstuttgart.typeinference.parser.JavaParser; -import de.dhbwstuttgart.typeinference.parser.Scanner; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; diff --git a/src/de/dhbwstuttgart/core/MyCompilerAPI.java b/src/de/dhbwstuttgart/core/MyCompilerAPI.java index fcfb8450..e774618f 100755 --- a/src/de/dhbwstuttgart/core/MyCompilerAPI.java +++ b/src/de/dhbwstuttgart/core/MyCompilerAPI.java @@ -11,12 +11,12 @@ import java.util.Vector; import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; +import de.dhbwstuttgart.parser.JavaParser; import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.exceptions.ParserError; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; -import de.dhbwstuttgart.typeinference.parser.JavaParser; // ino.class.MyCompilerAPI.21328.description type=javadoc /** diff --git a/src/de/dhbwstuttgart/typeinference/parser/.cvsignore b/src/de/dhbwstuttgart/parser/.cvsignore similarity index 100% rename from src/de/dhbwstuttgart/typeinference/parser/.cvsignore rename to src/de/dhbwstuttgart/parser/.cvsignore diff --git a/src/de/dhbwstuttgart/typeinference/parser/BoundedClassIdentifierList.java b/src/de/dhbwstuttgart/parser/BoundedClassIdentifierList.java similarity index 92% rename from src/de/dhbwstuttgart/typeinference/parser/BoundedClassIdentifierList.java rename to src/de/dhbwstuttgart/parser/BoundedClassIdentifierList.java index f3713403..6a41d80d 100644 --- a/src/de/dhbwstuttgart/typeinference/parser/BoundedClassIdentifierList.java +++ b/src/de/dhbwstuttgart/parser/BoundedClassIdentifierList.java @@ -1,4 +1,4 @@ -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; import java.util.Vector; diff --git a/src/de/dhbwstuttgart/typeinference/parser/ClassAndParameter.java b/src/de/dhbwstuttgart/parser/ClassAndParameter.java similarity index 98% rename from src/de/dhbwstuttgart/typeinference/parser/ClassAndParameter.java rename to src/de/dhbwstuttgart/parser/ClassAndParameter.java index ef928aee..87441788 100755 --- a/src/de/dhbwstuttgart/typeinference/parser/ClassAndParameter.java +++ b/src/de/dhbwstuttgart/parser/ClassAndParameter.java @@ -1,5 +1,5 @@ // ino.module.ClassAndParameter.8613.package -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; // ino.end // ino.module.ClassAndParameter.8613.import diff --git a/src/de/dhbwstuttgart/typeinference/parser/GenericVarDeclarationList.java b/src/de/dhbwstuttgart/parser/GenericVarDeclarationList.java similarity index 92% rename from src/de/dhbwstuttgart/typeinference/parser/GenericVarDeclarationList.java rename to src/de/dhbwstuttgart/parser/GenericVarDeclarationList.java index 0833d370..ef1ad7c8 100644 --- a/src/de/dhbwstuttgart/typeinference/parser/GenericVarDeclarationList.java +++ b/src/de/dhbwstuttgart/parser/GenericVarDeclarationList.java @@ -1,4 +1,4 @@ -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; import java.util.Vector; diff --git a/src/de/dhbwstuttgart/typeinference/parser/InterfaceAndParameter.java b/src/de/dhbwstuttgart/parser/InterfaceAndParameter.java similarity index 98% rename from src/de/dhbwstuttgart/typeinference/parser/InterfaceAndParameter.java rename to src/de/dhbwstuttgart/parser/InterfaceAndParameter.java index b13858d9..1aa50b6f 100755 --- a/src/de/dhbwstuttgart/typeinference/parser/InterfaceAndParameter.java +++ b/src/de/dhbwstuttgart/parser/InterfaceAndParameter.java @@ -1,5 +1,5 @@ // ino.module.InterfaceAndParameter.8614.package -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; // ino.end // ino.module.InterfaceAndParameter.8614.import diff --git a/src/de/dhbwstuttgart/typeinference/parser/InterfaceList.java b/src/de/dhbwstuttgart/parser/InterfaceList.java similarity index 95% rename from src/de/dhbwstuttgart/typeinference/parser/InterfaceList.java rename to src/de/dhbwstuttgart/parser/InterfaceList.java index 3e20555f..3277b359 100755 --- a/src/de/dhbwstuttgart/typeinference/parser/InterfaceList.java +++ b/src/de/dhbwstuttgart/parser/InterfaceList.java @@ -1,5 +1,5 @@ // ino.module.InterfaceList.8615.package -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; // ino.end // ino.module.InterfaceList.8615.import diff --git a/src/de/dhbwstuttgart/typeinference/parser/JavaClassName.java b/src/de/dhbwstuttgart/parser/JavaClassName.java similarity index 98% rename from src/de/dhbwstuttgart/typeinference/parser/JavaClassName.java rename to src/de/dhbwstuttgart/parser/JavaClassName.java index 0cfd41ab..1f99511a 100644 --- a/src/de/dhbwstuttgart/typeinference/parser/JavaClassName.java +++ b/src/de/dhbwstuttgart/parser/JavaClassName.java @@ -1,4 +1,4 @@ -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; import java.util.Vector; diff --git a/src/de/dhbwstuttgart/typeinference/parser/JavaLexer.java b/src/de/dhbwstuttgart/parser/JavaLexer.java similarity index 99% rename from src/de/dhbwstuttgart/typeinference/parser/JavaLexer.java rename to src/de/dhbwstuttgart/parser/JavaLexer.java index 92f09f6a..4c5ccab1 100644 --- a/src/de/dhbwstuttgart/typeinference/parser/JavaLexer.java +++ b/src/de/dhbwstuttgart/parser/JavaLexer.java @@ -6,7 +6,7 @@ * * ********************************************/ // user code: -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; public class JavaLexer { diff --git a/src/de/dhbwstuttgart/typeinference/parser/JavaLexer.lex b/src/de/dhbwstuttgart/parser/JavaLexer.lex similarity index 100% rename from src/de/dhbwstuttgart/typeinference/parser/JavaLexer.lex rename to src/de/dhbwstuttgart/parser/JavaLexer.lex diff --git a/src/de/dhbwstuttgart/typeinference/parser/JavaParser.java b/src/de/dhbwstuttgart/parser/JavaParser.java similarity index 99% rename from src/de/dhbwstuttgart/typeinference/parser/JavaParser.java rename to src/de/dhbwstuttgart/parser/JavaParser.java index 607328c7..188af602 100644 --- a/src/de/dhbwstuttgart/typeinference/parser/JavaParser.java +++ b/src/de/dhbwstuttgart/parser/JavaParser.java @@ -6,7 +6,7 @@ Backup von JavaParser.jay 10.April 17 Uhr */ -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; import java.util.Vector; @@ -28,6 +28,14 @@ import de.dhbwstuttgart.syntaxtree.ParameterList; import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.syntaxtree.misc.DeclId; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Abstract; +import de.dhbwstuttgart.syntaxtree.modifier.Final; +import de.dhbwstuttgart.syntaxtree.modifier.Modifier; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; +import de.dhbwstuttgart.syntaxtree.modifier.Private; +import de.dhbwstuttgart.syntaxtree.modifier.Protected; +import de.dhbwstuttgart.syntaxtree.modifier.Public; +import de.dhbwstuttgart.syntaxtree.modifier.Static; import de.dhbwstuttgart.syntaxtree.operator.AndOp; import de.dhbwstuttgart.syntaxtree.operator.DivideOp; import de.dhbwstuttgart.syntaxtree.operator.EqualOp; @@ -98,14 +106,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.Void; import de.dhbwstuttgart.syntaxtree.type.WildcardType; -import mycompiler.mymodifier.Abstract; -import mycompiler.mymodifier.Final; -import mycompiler.mymodifier.Modifier; -import mycompiler.mymodifier.Modifiers; -import mycompiler.mymodifier.Private; -import mycompiler.mymodifier.Protected; -import mycompiler.mymodifier.Public; -import mycompiler.mymodifier.Static; public class JavaParser{ public Vector path = new Vector(); diff --git a/src/de/dhbwstuttgart/typeinference/parser/JavaParser.jay b/src/de/dhbwstuttgart/parser/JavaParser.jay similarity index 100% rename from src/de/dhbwstuttgart/typeinference/parser/JavaParser.jay rename to src/de/dhbwstuttgart/parser/JavaParser.jay diff --git a/src/de/dhbwstuttgart/typeinference/parser/JavaParser_old.jay b/src/de/dhbwstuttgart/parser/JavaParser_old.jay similarity index 100% rename from src/de/dhbwstuttgart/typeinference/parser/JavaParser_old.jay rename to src/de/dhbwstuttgart/parser/JavaParser_old.jay diff --git a/src/de/dhbwstuttgart/typeinference/parser/Scanner.java b/src/de/dhbwstuttgart/parser/Scanner.java similarity index 96% rename from src/de/dhbwstuttgart/typeinference/parser/Scanner.java rename to src/de/dhbwstuttgart/parser/Scanner.java index e8a0f9b9..d8eef5c0 100755 --- a/src/de/dhbwstuttgart/typeinference/parser/Scanner.java +++ b/src/de/dhbwstuttgart/parser/Scanner.java @@ -1,5 +1,5 @@ // ino.module.Scanner.8618.package -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; // ino.end // ino.class.Scanner.24842.declaration public class Scanner extends JavaLexer implements JavaParser.yyInput diff --git a/src/de/dhbwstuttgart/typeinference/parser/Token.java b/src/de/dhbwstuttgart/parser/Token.java similarity index 98% rename from src/de/dhbwstuttgart/typeinference/parser/Token.java rename to src/de/dhbwstuttgart/parser/Token.java index 4c433d08..a371818e 100755 --- a/src/de/dhbwstuttgart/typeinference/parser/Token.java +++ b/src/de/dhbwstuttgart/parser/Token.java @@ -1,5 +1,5 @@ // ino.module.Token.8619.package -package de.dhbwstuttgart.typeinference.parser; +package de.dhbwstuttgart.parser; // ino.end // ino.class.Token.24859.declaration public class Token diff --git a/src/de/dhbwstuttgart/syntaxtree/BasicAssumptionClass.java b/src/de/dhbwstuttgart/syntaxtree/BasicAssumptionClass.java index 81c082ef..e6a319b7 100755 --- a/src/de/dhbwstuttgart/syntaxtree/BasicAssumptionClass.java +++ b/src/de/dhbwstuttgart/syntaxtree/BasicAssumptionClass.java @@ -3,8 +3,7 @@ package de.dhbwstuttgart.syntaxtree; // ino.end // ino.module.BasicAssumptionClass.8552.import -import mycompiler.mymodifier.Modifiers; -// ino.end +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; // ino.class.BasicAssumptionClass.23000.declaration public class BasicAssumptionClass extends Class diff --git a/src/de/dhbwstuttgart/syntaxtree/Class.java b/src/de/dhbwstuttgart/syntaxtree/Class.java index 2dba6720..9a7b8ffc 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Class.java +++ b/src/de/dhbwstuttgart/syntaxtree/Class.java @@ -9,72 +9,13 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mybytecode.ClassFile; -import mycompiler.myexception.CTypeReconstructionException; -import mycompiler.myexception.JVMCodeException; -import mycompiler.myexception.SCClassBodyException; -import mycompiler.myexception.SCClassException; -import mycompiler.myexception.SCExcept; -import mycompiler.mymodifier.Modifiers; -import mycompiler.mystatement.*; -import mycompiler.mytypereconstruction.CReconstructionTuple; -import mycompiler.mytypereconstruction.CSubstitution; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CReconstructionTupleSet; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.set.IHashSetKey; -import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -import mycompiler.mytypereconstruction.typeassumptionkey.CMethodKey; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.core.AClassOrInterface; import de.dhbwstuttgart.core.IItemWithOffset; -import de.dhbwstuttgart.core.SourceFile; -import de.dhbwstuttgart.core.SyntaxTreeNode; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.statement.Block; import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.statement.Statement; @@ -90,7 +31,6 @@ 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; @@ -387,24 +327,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit return classfile; } */ - public void codegen(ClassFile classfile, Vector paralist) - throws JVMCodeException - { - for(int i=0 ; i < this.getFields().size() ; i++) - { - /* - * if(this.fielddecl.elementAt(i) instanceof InstVarDecl) - { - ((InstVarDecl)this.fielddecl.elementAt(i)).codegen(classfile, paralist); - } - else - */ - { - this.fielddecl.elementAt(i).codegen(classfile, paralist); - } - } - } - + public void set_UsedId (UsedId uid) // ino.end // ino.method.set_UsedId.23074.body @@ -655,7 +578,6 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit // ino.end // ino.method.TRProg.23110.definition public ConstraintsSet typeReconstruction(FC_TTO supportData, TypeAssumptions globalAssumptions) - throws CTypeReconstructionException // ino.end // ino.method.TRProg.23110.body { @@ -911,30 +833,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit return ret; } */ - // ino.method.clear.23113.defdescription type=javadoc - /** - * Entfernt Annahmen f�r lokale Variablen, die f�r Methodenparameter erzeugt - * worden sind. (siehe Algorithmus 5.17 TRProg, Martin Pl�micke) - *
Author: J�rg B�uerle - * @param V - * @param locals - */ - // ino.end - // ino.method.clear.23113.definition - void clear(CTypeAssumptionSet V, Vector locals) - // ino.end - // ino.method.clear.23113.body - { - Iterator localsIt = locals.iterator(); - while(localsIt.hasNext()){ - CTypeAssumption local = localsIt.next(); - CTypeAssumption assum = V.getElement(local.getHashSetKey()); - if(assum!=null){ - V.removeElement(local.getHashSetKey()); - } - } - } - // ino.end + // ino.method.RetType.23119.defdescription type=javadoc /** @@ -1037,128 +936,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface, IItemWit // // } - // ino.method.addOffsetsToAssumption.23131.defdescription type=javadoc - /** - * Methode f�gt zu einer CTypeAssumption alle - * Offsets hinzu, wo die Variable benutzt wird. - *
Author: Thomas Hornberger 07.04.2006 - *
Author: Arne Lüdtke 20.01.2007, Auf Polymorphie erweitert. - * Wird nicht mehr verwendet. In Block ausgelagert. - * @return - */ - // ino.end - // ino.method.addOffsetsToAssumption.23131.definition - public static void addOffsetsToAssumption(CTypeAssumption localAssumption, Block localBlock,String NameVariable,boolean isMemberVariable) - // ino.end - // ino.method.addOffsetsToAssumption.23131.body - { - /*if(localBlock!=null){ - for(Object vectorObjekt : localBlock.statements) //durchlaufe alle Statements dieses Blocks - { - if(vectorObjekt instanceof Block) //Bei Block - { - Block b = (Block)vectorObjekt; - addOffsetsToAssumption(localAssumption,b,NameVariable,isMemberVariable);//rekursiver Aufruf - } - else - { - String Name_Superklasse = vectorObjekt.getClass().getSuperclass().getSimpleName(); - if(Name_Superklasse.equals("Statement")) //Bei Statement - { - Statement s = (Statement)vectorObjekt; - try{ - if(addOffsetsToStatement(localAssumption,s,NameVariable,isMemberVariable)==false) - {break;}} - catch(NullPointerException NPE){} - } - else if(Name_Superklasse.equals("Expr") || Name_Superklasse.equals("BinaryExpr") || Name_Superklasse.equals("UnaryExpr")) //Bei Expression - { - Expr e = (Expr)vectorObjekt; - try{ - addOffsetsToExpression(localAssumption,e,NameVariable,isMemberVariable);} - catch(NullPointerException NPE){} - } - } - - }}*/ - } - // ino.end - - // ino.method.addOffsetsToStatement.23134.defdescription type=javadoc - /** - * Hilfs-Methode f�r die Offset-Zuweisung - * durchsucht ein Statement rekursiv - *
Author: Thomas Hornberger 08.04.2006 - *
Author: Arne Lüdtke 20.10.2007, Auf Polymorphie umgebaut. - * @return - */ - // ino.end - // ino.method.addOffsetsToStatement.23134.definition - public static boolean addOffsetsToStatement(CTypeAssumption localAssumption,Statement statement, String NameVariable, boolean isMemberVariable) - // ino.end - // ino.method.addOffsetsToStatement.23134.body - { - return statement.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable); - /*if(statement instanceof Block) //Wenn Block - { - Block b = (Block)statement; - addOffsetsToAssumption(localAssumption,b,NameVariable,isMemberVariable); - } - else if(statement instanceof IfStmt)//Wenn if - { - IfStmt i = (IfStmt)statement; - addOffsetsToExpression(localAssumption,i.expr,NameVariable,isMemberVariable); - addOffsetsToStatement(localAssumption,i.else_block,NameVariable,isMemberVariable); - addOffsetsToStatement(localAssumption,i.then_block,NameVariable,isMemberVariable); - } - else if(statement instanceof Return)//Wenn Return - { - Return r = (Return)statement; - addOffsetsToExpression(localAssumption,r.retexpr,NameVariable,isMemberVariable); - } - else if(statement instanceof WhileStmt)//Wenn While - { - WhileStmt w = (WhileStmt)statement; - addOffsetsToExpression(localAssumption,w.expr,NameVariable,isMemberVariable); - addOffsetsToStatement(localAssumption,w.loop_block,NameVariable,isMemberVariable); - } - else if(statement instanceof LocalVarDecl)//Wenn Lokale-Variable-Deklaration - { - isMemberVariable=true;//hoth 02.05.06 - if(isMemberVariable)//Wenn Objektvariable - { - LocalVarDecl l = (LocalVarDecl)statement; - if(l.get_Name().equals(NameVariable)) - { - if(isFirstLocalVarDecl==false) - {return false;}//Wenn jetzt lokale Variable kommt, dann springe raus - else - {isFirstLocalVarDecl=false;} - } - } - } - return true;*/ - } - // ino.end - - // ino.method.addOffsetsToExpression.23137.defdescription type=javadoc - /** - * Hilfs-Methode f�r die Offset-Zuweisung - * durchsucht eine Expression rekursiv - *
Author: Thomas Hornberger 07.04.2006 - *
Authos: Arne Lüdtke 20.01.2007, Auf Polymorphie umgebaut. - * @return - */ - // ino.end - // ino.method.addOffsetsToExpression.23137.definition - public static void addOffsetsToExpression(CTypeAssumption localAssumption,Expr expression, String NameVariable,boolean isMemberVariable) - // ino.end - // ino.method.addOffsetsToExpression.23137.body - { - expression.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - // ino.end - + // ino.method.getSimpleName.23140.defdescription type=javadoc /** * HOTI diff --git a/src/de/dhbwstuttgart/syntaxtree/Constant.java b/src/de/dhbwstuttgart/syntaxtree/Constant.java index 5790a442..b9e5dcc7 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Constant.java +++ b/src/de/dhbwstuttgart/syntaxtree/Constant.java @@ -10,17 +10,15 @@ import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.JVMCode; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.myexception.JVMCodeException; +import de.dhbwstuttgart.parser.JavaClassName; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.statement.Literal; 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.mymodifier.Modifiers; -// ino.end -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; // ino.class.Constant.23212.description type=javadoc /** @@ -225,11 +223,6 @@ public class Constant extends Method //return null; } - @Override - public void replaceType(CReplaceTypeEvent e) { - // TODO Auto-generated method stub - - } @Override public int getTypeLineNumber() { diff --git a/src/de/dhbwstuttgart/syntaxtree/Constructor.java b/src/de/dhbwstuttgart/syntaxtree/Constructor.java index e35a46de..bc301e51 100644 --- a/src/de/dhbwstuttgart/syntaxtree/Constructor.java +++ b/src/de/dhbwstuttgart/syntaxtree/Constructor.java @@ -4,7 +4,9 @@ import java.util.Vector; import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.myexception.JVMCodeException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.misc.DeclId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.statement.Block; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.RefType; @@ -17,9 +19,6 @@ 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.mymodifier.Modifiers; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; public class Constructor extends Method { private Method methode; @@ -179,12 +178,6 @@ public class Constructor extends Method { this.methode.setOffset(Offset); } - @Override - public void replaceType(CReplaceTypeEvent e) { - - this.methode.replaceType(e); - } - @Override public int getTypeLineNumber() { diff --git a/src/de/dhbwstuttgart/syntaxtree/Field.java b/src/de/dhbwstuttgart/syntaxtree/Field.java index 74a1b08e..51930b34 100644 --- a/src/de/dhbwstuttgart/syntaxtree/Field.java +++ b/src/de/dhbwstuttgart/syntaxtree/Field.java @@ -17,7 +17,6 @@ import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.Typeable; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Typeable, Generic, GenericTypeInsertable{ diff --git a/src/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java b/src/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java index 02f4d8e8..087689c9 100644 --- a/src/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java +++ b/src/de/dhbwstuttgart/syntaxtree/FieldDeclaration.java @@ -18,7 +18,6 @@ import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.assumptions.FieldAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; /** * Eine Feldinitialisation steht für eine Felddeklaration mit gleichzeitiger Wertzuweisung @@ -111,17 +110,6 @@ public class FieldDeclaration extends Field{ return ret; } - @Override - public void replaceType(CReplaceTypeEvent e) { - // TODO Auto-generated method stub - - } - @Override - public int getTypeLineNumber() { - // TODO Auto-generated method stub - return 0; - } - public int getVariableLength() { return declid.elementAt(0).get_Name().length(); diff --git a/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java b/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java index 4b631265..cb726848 100755 --- a/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java +++ b/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java @@ -5,34 +5,7 @@ package de.dhbwstuttgart.syntaxtree; // ino.module.FormalParameter.8561.import import java.util.Vector; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.syntaxtree.misc.DeclId; @@ -48,7 +21,7 @@ import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; // ino.class.FormalParameter.23391.declaration -public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementListener, Typeable, TypeInsertable +public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeInsertable // ino.end // ino.class.FormalParameter.23391.body { @@ -91,13 +64,6 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL // ino.end // ino.method.setType.23404.body { - if(this.type instanceof TypePlaceholder){ - ((TypePlaceholder)this.type).removeReplacementListener(this); - } - - if(t instanceof TypePlaceholder){ - ((TypePlaceholder)t).addReplacementListener(this); - } this.type = t; } // ino.end @@ -188,24 +154,6 @@ public class FormalParameter extends SyntaxTreeNode implements ITypeReplacementL } // ino.end - // ino.method.replaceType.23428.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - * @param e - */ - // ino.end - // ino.method.replaceType.23428.definition - public void replaceType(CReplaceTypeEvent e) - // ino.end - // ino.method.replaceType.23428.body - { - inferencelog.debug("Ersetze Typ in FormalParameter \""+this.getIdentifier()+"\""); - if(type instanceof TypePlaceholder){ - ((TypePlaceholder)type).removeReplacementListener(this); - } - this.setType(e.getNewType()); - } - // ino.end // ino.method.getTypeLineNumber.23431.defdescription type=javadoc /** diff --git a/src/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java b/src/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java index 45f23959..115e60e3 100644 --- a/src/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java +++ b/src/de/dhbwstuttgart/syntaxtree/GenericDeclarationList.java @@ -2,8 +2,8 @@ package de.dhbwstuttgart.syntaxtree; import java.util.Vector; +import de.dhbwstuttgart.parser.GenericVarDeclarationList; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; -import de.dhbwstuttgart.typeinference.parser.GenericVarDeclarationList; /** diff --git a/src/de/dhbwstuttgart/syntaxtree/Interface.java b/src/de/dhbwstuttgart/syntaxtree/Interface.java index 1502b881..2d98f3c5 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Interface.java +++ b/src/de/dhbwstuttgart/syntaxtree/Interface.java @@ -9,11 +9,11 @@ import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.core.AClassOrInterface; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import mycompiler.mymodifier.Modifiers; /** * Ein Interface ist eine abstrakte Klasse, erbt daher von Class diff --git a/src/de/dhbwstuttgart/syntaxtree/InterfaceBody.java b/src/de/dhbwstuttgart/syntaxtree/InterfaceBody.java index 12bc5df1..69b9d6f4 100755 --- a/src/de/dhbwstuttgart/syntaxtree/InterfaceBody.java +++ b/src/de/dhbwstuttgart/syntaxtree/InterfaceBody.java @@ -7,8 +7,7 @@ import java.util.Vector; import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.myexception.JVMCodeException; -import mycompiler.mymodifier.Modifiers; -// ino.end +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; // ino.class.InterfaceBody.23984.description type=javadoc /** diff --git a/src/de/dhbwstuttgart/syntaxtree/Method.java b/src/de/dhbwstuttgart/syntaxtree/Method.java index 47979102..a1044daf 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/de/dhbwstuttgart/syntaxtree/Method.java @@ -7,16 +7,6 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mymodifier.Modifiers; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; import de.dhbwstuttgart.bytecode.ClassFile; @@ -25,7 +15,9 @@ import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.myexception.SCMethodException; import de.dhbwstuttgart.myexception.SCStatementException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.misc.DeclId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.statement.Block; import de.dhbwstuttgart.syntaxtree.statement.Return; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; @@ -41,7 +33,6 @@ 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; @@ -204,14 +195,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable // ino.end // ino.method.setReturnType.23539.body { - if(this.returntype instanceof TypePlaceholder){ - ((TypePlaceholder)this.returntype).removeReplacementListener(this); - } - - if(type instanceof TypePlaceholder){ - ((TypePlaceholder)type).addReplacementListener(this); - } - // this.returntype = type; //auskommentiert von Andreas Stadelmeier (a10023) this.returntype = type; } // ino.end @@ -423,24 +406,6 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable } // ino.end - // ino.method.replaceType.23599.defdescription type=javadoc - /** - *
Author: Jrg Buerle - * @param e - */ - // ino.end - // ino.method.replaceType.23599.definition - public void replaceType(CReplaceTypeEvent e) - // ino.end - // ino.method.replaceType.23599.body - { - inferencelog.debug("Ersetze Typ in Method \""+this.get_Method_Name()+"()\"\n"); - if(returntype instanceof TypePlaceholder){ - ((TypePlaceholder)returntype).removeReplacementListener(this); - } - this.setReturnType(e.getNewType()); - } - // ino.end // ino.method.getTypeLineNumber.23602.defdescription type=javadoc /** diff --git a/src/de/dhbwstuttgart/syntaxtree/ParameterList.java b/src/de/dhbwstuttgart/syntaxtree/ParameterList.java index 78febc12..7db364cd 100755 --- a/src/de/dhbwstuttgart/syntaxtree/ParameterList.java +++ b/src/de/dhbwstuttgart/syntaxtree/ParameterList.java @@ -4,7 +4,6 @@ package de.dhbwstuttgart.syntaxtree; // ino.module.ParameterList.8565.import import java.util.Vector; -import mycompiler.mytype.*; import java.util.Iterator; diff --git a/src/de/dhbwstuttgart/syntaxtree/SourceFile.java b/src/de/dhbwstuttgart/syntaxtree/SourceFile.java index 6ed62634..c2fb4b18 100755 --- a/src/de/dhbwstuttgart/syntaxtree/SourceFile.java +++ b/src/de/dhbwstuttgart/syntaxtree/SourceFile.java @@ -10,15 +10,6 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mymodifier.Modifiers; -import mycompiler.mymodifier.Public; -import mycompiler.mytypereconstruction.CIntersectionType; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; import de.dhbwstuttgart.bytecode.ClassFile; @@ -28,8 +19,11 @@ import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.myexception.SCClassException; import de.dhbwstuttgart.myexception.SCException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.misc.DeclId; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; +import de.dhbwstuttgart.syntaxtree.modifier.Public; import de.dhbwstuttgart.syntaxtree.type.BooleanType; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.Pair; @@ -50,11 +44,8 @@ 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.*; -import mycompiler.*; import sun.reflect.generics.reflectiveObjects.NotImplementedException; import sun.reflect.generics.reflectiveObjects.TypeVariableImpl; @@ -1177,10 +1168,7 @@ public class SourceFile for(int j=0;j()); - CInstVarTypeAssumption instVar = new CInstVarTypeAssumption(className, fields[j].getName(), new RefType(fields[j].getType().getName(),-1), MyCompiler.NO_LINENUMBER,MyCompiler.NO_LINENUMBER,new Vector()); - //basicAssumptions.addFieldOrLocalVarAssumption(instVar); - 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(),-1))); } } for(int j=0;j(),null); ParameterList paraList = new ParameterList(); for(int k=0;k())); } //basicAssumptions.addMethodIntersectionType(new CIntersectionType(constructor)); Method constructorMethod = de.dhbwstuttgart.syntaxtree.Method.createEmptyMethod(methodName, parentClass); diff --git a/src/de/dhbwstuttgart/syntaxtree/misc/DeclId.java b/src/de/dhbwstuttgart/syntaxtree/misc/DeclId.java index 8012781a..7142823c 100755 --- a/src/de/dhbwstuttgart/syntaxtree/misc/DeclId.java +++ b/src/de/dhbwstuttgart/syntaxtree/misc/DeclId.java @@ -4,9 +4,6 @@ package de.dhbwstuttgart.syntaxtree.misc; // ino.module.DeclId.8558.import import java.util.Vector; -import mycompiler.mymodifier.Final; -import mycompiler.mymodifier.Modifiers; - import org.apache.log4j.Logger; // ino.end @@ -15,6 +12,7 @@ import org.apache.log4j.Logger; + import de.dhbwstuttgart.bytecode.Attribute; import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; @@ -23,6 +21,8 @@ import de.dhbwstuttgart.bytecode.SignatureInfo; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.Constant; +import de.dhbwstuttgart.syntaxtree.modifier.Final; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.statement.Assign; import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.statement.ExprStmt; diff --git a/src/de/dhbwstuttgart/syntaxtree/misc/Status.java b/src/de/dhbwstuttgart/syntaxtree/misc/Status.java index ea598693..e68b7d32 100755 --- a/src/de/dhbwstuttgart/syntaxtree/misc/Status.java +++ b/src/de/dhbwstuttgart/syntaxtree/misc/Status.java @@ -2,9 +2,6 @@ package de.dhbwstuttgart.syntaxtree.misc; // ino.end -// ino.module.Status.8566.import -import mycompiler.unused.Import; -// ino.end // ino.class.Status.23644.declaration public abstract class Status @@ -14,9 +11,6 @@ public abstract class Status // ino.attribute.userdef.23647.declaration protected UserDef userdef; // ino.end - // ino.attribute.imp.23650.declaration - protected Import imp; - // ino.end // ino.method.set_UserDef.23653.definition public void set_UserDef( UserDef userdef) @@ -26,13 +20,6 @@ public abstract class Status this.userdef = userdef; } // ino.end - // ino.method.set_Import.23656.definition - public void set_Import(Import imp) - // ino.end - // ino.method.set_Import.23656.body - { - this.imp = imp; - } - // ino.end + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/misc/UsedId.java b/src/de/dhbwstuttgart/syntaxtree/misc/UsedId.java index 937f9a03..78b68fb4 100755 --- a/src/de/dhbwstuttgart/syntaxtree/misc/UsedId.java +++ b/src/de/dhbwstuttgart/syntaxtree/misc/UsedId.java @@ -7,11 +7,11 @@ import java.util.Vector; import de.dhbwstuttgart.bytecode.JVMCode; import de.dhbwstuttgart.core.IItemWithOffset; +import de.dhbwstuttgart.parser.JavaClassName; 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; // ino.class.UsedId.23659.declaration diff --git a/src/mycompiler/mymodifier/Abstract.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Abstract.java similarity index 93% rename from src/mycompiler/mymodifier/Abstract.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Abstract.java index 69027ed7..0fbc63fd 100755 --- a/src/mycompiler/mymodifier/Abstract.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Abstract.java @@ -1,5 +1,5 @@ // ino.module.Abstract.8585.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Final.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Final.java similarity index 93% rename from src/mycompiler/mymodifier/Final.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Final.java index 8330eba5..03be2767 100755 --- a/src/mycompiler/mymodifier/Final.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Final.java @@ -1,5 +1,5 @@ // ino.module.Final.8586.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/InterfaceModifier.java b/src/de/dhbwstuttgart/syntaxtree/modifier/InterfaceModifier.java similarity index 88% rename from src/mycompiler/mymodifier/InterfaceModifier.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/InterfaceModifier.java index 8de2bee1..b6fd3ece 100755 --- a/src/mycompiler/mymodifier/InterfaceModifier.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/InterfaceModifier.java @@ -1,7 +1,7 @@ /** * */ -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Modifier.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Modifier.java similarity index 93% rename from src/mycompiler/mymodifier/Modifier.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Modifier.java index 1d72d4e7..22bcda47 100755 --- a/src/mycompiler/mymodifier/Modifier.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Modifier.java @@ -1,5 +1,5 @@ // ino.module.Modifier.8587.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Modifiers.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Modifiers.java similarity index 98% rename from src/mycompiler/mymodifier/Modifiers.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Modifiers.java index c51a0ccd..759f59cc 100755 --- a/src/mycompiler/mymodifier/Modifiers.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Modifiers.java @@ -1,5 +1,5 @@ // ino.module.Modifiers.8588.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; // ino.end // ino.module.Modifiers.8588.import diff --git a/src/mycompiler/mymodifier/Private.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Private.java similarity index 92% rename from src/mycompiler/mymodifier/Private.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Private.java index 4b36125c..913b5dad 100755 --- a/src/mycompiler/mymodifier/Private.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Private.java @@ -1,5 +1,5 @@ // ino.module.Private.8589.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Protected.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Protected.java similarity index 92% rename from src/mycompiler/mymodifier/Protected.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Protected.java index c732b00f..bc6b6f23 100755 --- a/src/mycompiler/mymodifier/Protected.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Protected.java @@ -1,5 +1,5 @@ // ino.module.Protected.8590.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Public.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Public.java similarity index 92% rename from src/mycompiler/mymodifier/Public.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Public.java index 0236b80e..52ca21ff 100755 --- a/src/mycompiler/mymodifier/Public.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Public.java @@ -1,5 +1,5 @@ // ino.module.Public.8591.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Static.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Static.java similarity index 92% rename from src/mycompiler/mymodifier/Static.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Static.java index c5de6ead..18402b76 100755 --- a/src/mycompiler/mymodifier/Static.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Static.java @@ -1,5 +1,5 @@ // ino.module.Static.8592.package -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/mycompiler/mymodifier/Super.java b/src/de/dhbwstuttgart/syntaxtree/modifier/Super.java similarity index 88% rename from src/mycompiler/mymodifier/Super.java rename to src/de/dhbwstuttgart/syntaxtree/modifier/Super.java index c12de826..3baa9d4e 100755 --- a/src/mycompiler/mymodifier/Super.java +++ b/src/de/dhbwstuttgart/syntaxtree/modifier/Super.java @@ -1,7 +1,7 @@ /** * */ -package mycompiler.mymodifier; +package de.dhbwstuttgart.syntaxtree.modifier; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java index c5d1e660..5dae26d7 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java @@ -22,11 +22,6 @@ import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java index 8c5b87bb..c8f58be3 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java @@ -16,11 +16,6 @@ import de.dhbwstuttgart.syntaxtree.statement.Null; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/LogOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/LogOp.java index 17c73e23..33472b5b 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/LogOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/LogOp.java @@ -26,11 +26,6 @@ import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java index 1ffa2147..47c8d887 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java @@ -16,11 +16,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; // ino.class.MulOp.24231.declaration public abstract class MulOp extends Operator diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java index 7f8d19cc..91b22924 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java @@ -16,14 +16,6 @@ import de.dhbwstuttgart.syntaxtree.statement.Null; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; - - - // ino.class.NotEqualOp.24241.declaration public class NotEqualOp extends RelOp diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java index 0a588a61..29304f01 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java @@ -26,12 +26,6 @@ import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; - diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java index 135f0ae4..ec22a5e2 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java @@ -19,12 +19,6 @@ import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.unify.Unify; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; - // ino.class.RelOp.24299.declaration public abstract class RelOp extends Operator // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java index 224d2f56..941734b3 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java @@ -7,31 +7,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CMultiplyTuple; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CMultiplyTupleSet; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; - -// ino.end - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -39,6 +16,7 @@ import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.myexception.SCExcept; import de.dhbwstuttgart.myexception.SCStatementException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; @@ -52,7 +30,6 @@ 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; @@ -257,11 +234,6 @@ public class Assign extends Expr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr1.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - expr2.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } @Override public String getTypeInformation(){ diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java b/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java index ff127df9..53f8886d 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java @@ -7,32 +7,8 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -59,6 +35,7 @@ import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -265,12 +242,6 @@ public class Binary extends BinaryExpr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr1.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - expr2.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Block.java b/src/de/dhbwstuttgart/syntaxtree/statement/Block.java index 3ab3a23e..0a5796ae 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Block.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Block.java @@ -7,31 +7,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.myexception.CTypeReconstructionException; @@ -51,6 +28,7 @@ import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -185,43 +163,6 @@ public class Block extends Statement } // ino.end - - public void addOffsetsToAssumption(CTypeAssumption localAssumption, String NameVariable,boolean isMemberVariable) - { - for(Object vectorObjekt : this.statements) //durchlaufe alle Statements dieses Blocks - { - if(vectorObjekt instanceof Block) //Bei Block - { - Block b = (Block)vectorObjekt; - b.addOffsetsToAssumption(localAssumption,NameVariable,isMemberVariable);//rekursiver Aufruf - } - else - { - String Name_Superklasse = vectorObjekt.getClass().getSuperclass().getSimpleName(); - if(Name_Superklasse.equals("Statement")) //Bei Statement - { - Statement s = (Statement)vectorObjekt; - try{ - if(s.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable)==false) - {break;}} - catch(NullPointerException NPE){} - } - else if(Name_Superklasse.equals("Expr") || Name_Superklasse.equals("BinaryExpr") || Name_Superklasse.equals("UnaryExpr")) //Bei Expression - { - Expr e = (Expr)vectorObjekt; - try{ - e.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable);} - catch(NullPointerException NPE){} - } - } - } - } - - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable) - { - addOffsetsToAssumption(localAssumption,NameVariable,isMemberVariable); - return true; - } @Override @@ -256,9 +197,6 @@ public class Block extends Statement this.setType(tph); } } - if (this.type instanceof TypePlaceholder) { - ((TypePlaceholder)this.type).addReplacementListener(this); - } }else{ this.setType(new Void(0)); } @@ -281,11 +219,6 @@ public class Block extends Statement } */ - - public void replaceType(CReplaceTypeEvent e) { - super.replaceType(e); - } - @Override public String getTypeInformation(){ String ret = "\n"; diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java index 19bc0716..b1b39e80 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/BoolLiteral.java @@ -5,27 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -41,6 +21,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -141,51 +122,6 @@ public class BoolLiteral extends Literal // ino.end - // ino.method.TRStatement.25117.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25117.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - - // ino.method.TRExp.25120.defdescription type=javadoc - /** - * Workaround: �berschreibt Methode TRExp aus der Super-Klasse - * Literal, weil die Implementierung von Unify (noch) nicht mit - * Basetypes umgehen kann.
- * Anstatt den Basetype BooleanType zur�ckzugeben, wird ein - * RefType zur�ckgegeben.
- * Diese Methode kann sp�ter entfernt werden, sodass automatisch die Methode der - * Super-Klasse verwendet wird. - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25120.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25120.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Boolean",getOffset()),V)); - return tripleSet; - } - // ino.end - - // ino.method.wandleRefTypeAttributes2GenericAttributes.25123.definition - public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) - // ino.end - // ino.method.wandleRefTypeAttributes2GenericAttributes.25123.body - { - } - // ino.end - @Override @@ -210,6 +146,16 @@ public class BoolLiteral extends Literal return ret; } + + + @Override + public void wandleRefTypeAttributes2GenericAttributes( + Vector paralist, + Vector genericMethodParameters) { + // TODO Auto-generated method stub + + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java index 87832a22..681a0354 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/CastExpr.java @@ -6,28 +6,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -43,6 +22,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -141,11 +121,6 @@ public class CastExpr extends UnaryExpr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - @Override diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java index f150db34..b8163af1 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/CharLiteral.java @@ -4,29 +4,7 @@ package de.dhbwstuttgart.syntaxtree.statement; // ino.module.CharLiteral.8628.import import java.util.Hashtable; import java.util.Vector; - -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -42,6 +20,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -133,54 +112,6 @@ public class CharLiteral extends Literal } // ino.end - - // ino.method.TRStatement.25194.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25194.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - - // ino.method.TRExp.25197.defdescription type=javadoc - /** - * Workaround: �berschreibt Methode TRExp aus der Super-Klasse - * Literal, weil die Implementierung von Unify (noch) nicht mit - * Basetypes umgehen kann.
- * Anstatt den Basetype CharacterType zur�ckzugeben, wird ein - * RefType zur�ckgegeben.
- * Diese Methode kann sp�ter entfernt werden, sodass automatisch die Methode der - * Super-Klasse verwendet wird. - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25197.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25197.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Character",getOffset()),V)); - return tripleSet; - } - // ino.end - - // ino.method.wandleRefTypeAttributes2GenericAttributes.25200.definition - public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) - // ino.end - // ino.method.wandleRefTypeAttributes2GenericAttributes.25200.body - { - } - // ino.end - - - @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { // TODO Auto-generated method stub @@ -198,5 +129,13 @@ public class CharLiteral extends Literal Vector ret = new Vector(); return ret; } + + + + @Override + public void wandleRefTypeAttributes2GenericAttributes( + Vector paralist, + Vector genericMethodParameters) { + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java index 85b0778a..903ee739 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.java @@ -5,12 +5,6 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; @@ -31,6 +25,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; // ino.end @@ -144,42 +139,6 @@ public class DoubleLiteral extends Literal } // ino.end - - // ino.method.TRStatement.25478.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25478.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRExp.25481.defdescription type=javadoc - /** - * Workaround: �berschreibt Methode TRExp aus der Super-Klasse - * Literal, weil die Implementierung von Unify (noch) nicht mit - * Basetypes umgehen kann.
- * Anstatt den Basetype IntegerType zur�ckzugeben, wird ein - * RefType zur�ckgegeben.
- * Diese Methode kann sp�ter entfernt werden, sodass automatisch die Methode der - * Super-Klasse verwendet wird. - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25481.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25481.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Double",getOffset()),V)); - return tripleSet; - } - // ino.end // ino.method.toString.25484.defdescription type=javadoc /** diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java index 1967fe04..68d04cd7 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/EmptyStmt.java @@ -5,28 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.myexception.CTypeReconstructionException; @@ -39,6 +19,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -80,14 +61,6 @@ public class EmptyStmt extends Statement { } // ino.end - // ino.method.TRStatement.25219.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25219.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.25222.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) @@ -97,10 +70,6 @@ public class EmptyStmt extends Statement } // ino.end - public boolean addOffsetsToStatement(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - return true; - } @Override public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) { @@ -108,12 +77,6 @@ public class EmptyStmt extends Statement return null; } - public void replaceType(CReplaceTypeEvent e) { - // TODO Auto-generated method stub - throw new NotImplementedException(); - } - - public int getTypeLineNumber() { throw new NotImplementedException(); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Expr.java b/src/de/dhbwstuttgart/syntaxtree/statement/Expr.java index db241201..ba3d9563 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Expr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Expr.java @@ -15,17 +15,6 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import sun.reflect.generics.reflectiveObjects.NotImplementedException; -import mycompiler.mytypereconstruction.CMultiplyTuple; -import mycompiler.mytypereconstruction.CSubstitution; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CMultiplyTupleSet; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -// ino.end - @@ -120,14 +109,5 @@ public abstract class Expr extends ExprStmt public ConstraintsSet TYPEStmt(TypeAssumptions assumptions){ throw new NotImplementedException(); //wird die TYPEStmt-Methode innerhalb einer Expr aufgerufen, dann ist etwas schief gelaufen. } - - - public abstract void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable); - - public boolean addOffsetsToStatement(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - return true; - } - } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/ExprStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/ExprStmt.java index 3788e586..370af348 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/ExprStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/ExprStmt.java @@ -6,18 +6,7 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; - import org.apache.log4j.Logger; -// ino.end - - - import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.Type; @@ -25,7 +14,7 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.unify.Unify; // ino.class.ExprStmt.25265.declaration -public abstract class ExprStmt extends Statement implements ITypeReplacementListener +public abstract class ExprStmt extends Statement // ino.end // ino.class.ExprStmt.25265.body { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java index 8ce6eb37..80bd8526 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/FloatLiteral.java @@ -5,12 +5,6 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; - import org.apache.log4j.Logger; import de.dhbwstuttgart.bytecode.ClassFile; @@ -138,42 +132,7 @@ public class FloatLiteral extends Literal } // ino.end - - // ino.method.TRStatement.25478.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25478.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRExp.25481.defdescription type=javadoc - /** - * Workaround: �berschreibt Methode TRExp aus der Super-Klasse - * Literal, weil die Implementierung von Unify (noch) nicht mit - * Basetypes umgehen kann.
- * Anstatt den Basetype IntegerType zur�ckzugeben, wird ein - * RefType zur�ckgegeben.
- * Diese Methode kann sp�ter entfernt werden, sodass automatisch die Methode der - * Super-Klasse verwendet wird. - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25481.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25481.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Float",getOffset()),V)); - return tripleSet; - } - // ino.end + // ino.method.toString.25484.defdescription type=javadoc /** diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java index 1400b35c..bd78a1fd 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java @@ -5,13 +5,6 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; @@ -104,24 +97,12 @@ public class ForStmt extends Statement body_Loop_block = statement; } - - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable) - { - head_Initializer_1.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable); - body_Loop_block.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable); - return true; - } @Override public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) { // TODO Auto-generated method stub return null; } - - public void replaceType(CReplaceTypeEvent e) { - // TODO Auto-generated method stub - throw new NotImplementedException(); - } public int getTypeLineNumber() { throw new NotImplementedException(); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java index 8822fcb3..0cae62ad 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/IfStmt.java @@ -7,32 +7,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSubstitution; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -255,116 +230,7 @@ public class IfStmt extends Statement - // ino.method.makeNewResult.25343.definition - private void makeNewResult(MUB Mub, CTriple triple, CTypeAssumptionSet V, CTripleSet returnSet) - throws CTypeReconstructionException - // ino.end - // ino.method.makeNewResult.25343.body - { - CSubstitutionSet unifier = new CSubstitutionSet(Mub.getUnifier()); - // -------------------------- - // Typannahmen bauen: - // -------------------------- - CTypeAssumptionSet V_substituted = V.deepCopy(); - V_substituted.sub(unifier); - // -------------------------- - // Substitutionen bauen: - // -------------------------- - CSubstitutionSet substSet = triple.getSubstitutions().deepCopy(); - substSet.applyUnifier(unifier); - substSet.unite(unifier); - // -------------------------- - // R�ckgabetyp bauen: - // -------------------------- - Iterator setMubIt = Mub.getMub().iterator(); - - while(setMubIt.hasNext()) { - Type retType = setMubIt.next(); - Type retType2 = substSet.applyThisSubstitutionSet(retType.clone()); - // Muesste eigentlich cloneAndApplyUnify machen PL 06-03-18 - // If(Rettype Instanceof TypePlaceholders){ - // Iterator Pairit = Unifier.Getiterator(); - // While(Pairit.Hasnext()){ - // Csubstitution Pair = Pairit.Next(); - // If(Pair.Gettypevar().Getname().Equals(Rettype.Getname())){ - // Rettype = Pair.Gettype(); - // Break; - // } - // } - // } - // -------------------------- - CTriple resultTriple = new CTriple(substSet, retType2, V_substituted); - //CSubstitutionSet CSubstUnifier = new CSubstitutionSet(unifier); - //CTriple resultTriple2 = retTriple.cloneAndApplyUnify(CSubstUnifier); - // -------------------------- - // Triple zu R�ckgabemenge hinzuf�gen - // -------------------------- - if(!returnSet.contains(resultTriple)){ - returnSet.addElement(resultTriple); - } - } - } - // ino.end - - // ino.method.applyUnifier.25346.definition - private void applyUnifier(Vector> unifierPossibilities, CTriple triple, CTypeAssumptionSet V, CTripleSet returnSet) - throws CTypeReconstructionException - // ino.end - // ino.method.applyUnifier.25346.body - { - // -------------------------- - // Wenn Unifier vorhanden, dann anwenden: - // -------------------------- - if(unifierPossibilities.size()!=0){ - // -------------------------- - // Alle m�glichen Unifier auf V_i,j anwenden: - // -------------------------- - for(int k=0; k pairIt = unifier.getIterator(); - while(pairIt.hasNext()){ - CSubstitution pair = pairIt.next(); - if(pair.getTypeVar().getName().equals(retType.getName())){ - retType = pair.getType(); - break; - } - } - } - // -------------------------- - CTriple resultTriple = new CTriple(substSet, retType, V_substituted); - // -------------------------- - // Triple zu R�ckgabemenge hinzuf�gen - // -------------------------- - if(!returnSet.contains(resultTriple)){ - returnSet.addElement(resultTriple); - } - } - } - // -------------------------- - // Ansonsten Fehlermeldung: - // -------------------------- - else { - throw new CTypeReconstructionException("IfStmt.TRStatement(): Block-Typen lassen sich nicht unifizieren.",this); - } - } - // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.25349.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) // ino.end @@ -379,15 +245,6 @@ public class IfStmt extends Statement } // ino.end - - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - else_block.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable); - then_block.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable); - return true; - } - @Override @@ -408,11 +265,6 @@ public class IfStmt extends Statement return ret; } - public void replaceType(CReplaceTypeEvent e) { - // TODO Auto-generated method stub - throw new NotImplementedException(); - } - public int getTypeLineNumber() { throw new NotImplementedException(); } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/InstVar.java b/src/de/dhbwstuttgart/syntaxtree/statement/InstVar.java index be25f6cf..f149e94e 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/InstVar.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/InstVar.java @@ -6,36 +6,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; - -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -import mycompiler.mytypereconstruction.typeassumptionkey.CInstVarKey; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; @@ -202,60 +173,9 @@ public class InstVar extends Expr } // ino.end - // ino.method.TRStatement.25429.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25429.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.handleInstVarAssum.25438.defdescription type=javadoc - /** - * Unifiziert den R�ckgabetyp des Receivers mit dem der gefundenen Klasse - *
Author: J�rg B�uerle - * @param triple Triple des Receivers - * @param thetaZero Typ der gefundenen Klasse - * @param thetaC Typ der InstanzVariable - * @param resultSet - * @param supportData - */ - // ino.end - // ino.method.handleInstVarAssum.25438.definition - private void handleInstVarAssum(CTriple triple, Type thetaZero, Type thetaC, CTripleSet resultSet, CSupportData supportData) - // ino.end - // ino.method.handleInstVarAssum.25438.body - { - // -------------------------- - // ReturnType mit Integer unifizieren: - // -------------------------- - Vector> unifierPossibilities = Unify.unify(triple.getResultType(), thetaZero, supportData.getFiniteClosure()); - // -------------------------- - // Wenn Unifier vorhanden, dann - // anwenden und Triple hinzuf�gen: - // -------------------------- - if(unifierPossibilities.size()!=0){ - // -------------------------- - // Subset bauen: - // -------------------------- - CTripleSet subSet = new CTripleSet(); - // -------------------------- - // Alle m�glichen Unifier anwenden: - // -------------------------- - for(int i=0; ischreibe Offset - localAssumption.addOffset(this.get_UsedId().getOffset()); - } - } - @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { ConstraintsSet ret = new ConstraintsSet(); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java b/src/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java index 5b8baa5f..2178ba46 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/InstanceOf.java @@ -6,25 +6,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; @@ -120,24 +102,6 @@ public class InstanceOf extends BinaryExpr } // ino.end - // ino.method.TRExp.25383.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25383.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRStatement.25386.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25386.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - // ino.method.wandleRefTypeAttributes2GenericAttributes.25389.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) // ino.end @@ -145,11 +109,7 @@ public class InstanceOf extends BinaryExpr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } + @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java index 7b7a0d39..f90970c4 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/IntLiteral.java @@ -5,28 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -42,6 +21,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -154,42 +134,6 @@ public class IntLiteral extends Literal } // ino.end - - // ino.method.TRStatement.25478.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25478.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRExp.25481.defdescription type=javadoc - /** - * Workaround: �berschreibt Methode TRExp aus der Super-Klasse - * Literal, weil die Implementierung von Unify (noch) nicht mit - * Basetypes umgehen kann.
- * Anstatt den Basetype IntegerType zur�ckzugeben, wird ein - * RefType zur�ckgegeben.
- * Diese Methode kann sp�ter entfernt werden, sodass automatisch die Methode der - * Super-Klasse verwendet wird. - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25481.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25481.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Integer",getOffset()),V)); - return tripleSet; - } - // ino.end // ino.method.toString.25484.defdescription type=javadoc /** diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java b/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java index 89cbcd81..64891b30 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java @@ -29,13 +29,7 @@ import de.dhbwstuttgart.typeinference.Typeable; import de.dhbwstuttgart.typeinference.assumptions.ParameterAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; /** * @author A10023 - Andreas Stadelmeier @@ -117,13 +111,6 @@ public class LambdaExpression extends Expr{ } } - @Override - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, - String NameVariable, boolean isMemberVariable) { - // TODO Auto-generated method stub - return false; - } - @Override public String get_Name() { // TODO Auto-generated method stub @@ -131,13 +118,6 @@ public class LambdaExpression extends Expr{ } - @Override - public void addOffsetsToExpression(CTypeAssumption localAssumption, - String NameVariable, boolean isMemberVariable) { - // TODO Auto-generated method stub - - } - /** * Spezifikation: diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java b/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java index a89ef6b5..f83c1c36 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Literal.java @@ -5,13 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement; // ino.module.Literal.8636.import import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.myexception.JVMCodeException; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -// ino.end +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; // ino.class.Literal.25490.declaration public abstract class Literal extends Expr @@ -55,26 +49,6 @@ public abstract class Literal extends Expr } // ino.end - // ino.method.TRExp.25497.defdescription type=javadoc - /** - * Implementierung des Algorithmus 5.40 von Martin Pl�micke - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25497.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25497.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, this.getType(),V)); - return tripleSet; - } - // ino.end // ino.method.ConstantCodegen.25500.defdescription type=javadoc /** @@ -92,9 +66,6 @@ public abstract class Literal extends Expr + " wurde nicht implementiert!"); } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVar.java b/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVar.java index bd83ce15..4f03ddae 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVar.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LocalOrFieldVar.java @@ -6,33 +6,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -import mycompiler.mytypereconstruction.typeassumptionkey.CInstVarKey; -import mycompiler.mytypereconstruction.typeassumptionkey.CLocalVarKey; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -54,6 +28,7 @@ import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -173,16 +148,6 @@ public class LocalOrFieldVar extends Expr } // ino.end - // ino.end - // ino.method.TRStatement.25531.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25531.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - // ino.method.toString.25534.defdescription type=javadoc /** *
Author: Martin Pl�micke @@ -207,14 +172,6 @@ public class LocalOrFieldVar extends Expr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - if(this.get_UsedId().get_Name_1Element().equals(NameVariable)) - { - //wenn Variable mit gleichem Namen gefunden->schreibe Offset - localAssumption.addOffset(this.get_UsedId().getOffset()); - } - } @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java index eda8deef..94681236 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java @@ -6,41 +6,8 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.core.MyCompiler; @@ -66,6 +33,7 @@ import de.dhbwstuttgart.typeinference.assumptions.LocalVarAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -348,33 +316,6 @@ public class LocalVarDecl extends Statement implements TypeInsertable // ino.end - // ino.method.replaceType.25608.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - * @param e - */ - // ino.end - // ino.method.replaceType.25608.definition - public void replaceType(CReplaceTypeEvent e) - // ino.end - // ino.method.replaceType.25608.body - { - if(e.getOldType().equals(this.getType())){ - inferencelog.debug("Ersetze Typ in LocalVarDecl \""+this.get_Name()+"\"\n"); - if(getType() instanceof TypePlaceholder){ - ((TypePlaceholder)getType()).removeReplacementListener(this); - } - this.setType(e.getNewType()); - } - if(e.getOldType().equals(this.getType())){ - inferencelog.debug("Ersetze Typ in LocalVarDecl \""+this.get_Name()+"\"\n"); - if(this.getType() instanceof TypePlaceholder){ - ((TypePlaceholder)this.getType()).removeReplacementListener(this); - } - this.setType(e.getNewType()); - } - } - // ino.end // ino.method.getTypeLineNumber.25611.defdescription type=javadoc /** @@ -391,36 +332,6 @@ public class LocalVarDecl extends Statement implements TypeInsertable } // ino.end - // ino.method.TRStatement.25614.defdescription type=javadoc - /** - * Implementierung des Algorithmus 5.24 von Martin Pl�micke - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRStatement.25614.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25614.body - { - CTripleSet resultSet = new CTripleSet(); - V = V.shallowCopy(); - CTypeAssumptionSet localSet = new CTypeAssumptionSet(); - CLocalVarTypeAssumption varAssum = new CLocalVarTypeAssumption(supportData.getCurrentClass(), supportData.getCurrentMethod(), supportData.getCurrentMethodParaCount(), supportData.getCurrentMethodOverloadedID(), supportData.getCurrentBlockId(), this.get_Name() ,this.getType(), this.getLineNumber(),this.getOffset(),new Vector()); - Class.isFirstLocalVarDecl=true; - - if(this.block != null) - this.block.addOffsetsToAssumption(varAssum,this.get_Name(),false);//hinzugef�gt hoth: 07.04.2006 - - localSet.addElement(varAssum); - V.unite(localSet); - resultSet.addElement(new CTriple(sigma, new Void(getOffset()), V)); - return resultSet; - } - // ino.end // ino.method.toString.25617.defdescription type=javadoc /** @@ -457,21 +368,6 @@ public class LocalVarDecl extends Statement implements TypeInsertable } // ino.end - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable) - { - isMemberVariable=true;//hoth 02.05.06 - if(isMemberVariable)//Wenn Objektvariable - { - if(this.get_Name().equals(NameVariable)) - { - if(Class.isFirstLocalVarDecl==false) - {return false;}//Wenn jetzt lokale Variable kommt, dann springe raus - else - {Class.isFirstLocalVarDecl=false;} - } - } - return true; - } /** * @author Andreas Stadelmeier, a10023 diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java index 0dca5340..ed134118 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LongLiteral.java @@ -5,12 +5,6 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; @@ -30,6 +24,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; // ino.end @@ -143,43 +138,6 @@ public class LongLiteral extends Literal } // ino.end - - // ino.method.TRStatement.25478.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25478.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRExp.25481.defdescription type=javadoc - /** - * Workaround: �berschreibt Methode TRExp aus der Super-Klasse - * Literal, weil die Implementierung von Unify (noch) nicht mit - * Basetypes umgehen kann.
- * Anstatt den Basetype IntegerType zur�ckzugeben, wird ein - * RefType zur�ckgegeben.
- * Diese Methode kann sp�ter entfernt werden, sodass automatisch die Methode der - * Super-Klasse verwendet wird. - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25481.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25481.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, new RefType("java.lang.Long",getOffset()),V)); - return tripleSet; - } - // ino.end - // ino.method.toString.25484.defdescription type=javadoc /** *
Author: Martin Pl�micke diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java b/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java index 113fb693..e635fdf4 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java @@ -2,79 +2,26 @@ package de.dhbwstuttgart.syntaxtree.statement; // ino.end // ino.module.MethodCall.8639.import -import java.util.Enumeration; import java.util.Hashtable; -import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CIntersectionType; -import mycompiler.mytypereconstruction.CMultiplyTuple; -import mycompiler.mytypereconstruction.CSubstitution; -import mycompiler.mytypereconstruction.CSubstitutionGenVar; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CMultiplyTupleSet; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -import mycompiler.mytypereconstruction.typeassumptionkey.CMethodKey; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; -import de.dhbwstuttgart.bytecode.JVMCode; -import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; -import de.dhbwstuttgart.myexception.SCExcept; -import de.dhbwstuttgart.myexception.SCStatementException; -import de.dhbwstuttgart.syntaxtree.Class; -import de.dhbwstuttgart.syntaxtree.ClassBody; -import de.dhbwstuttgart.syntaxtree.FormalParameter; import de.dhbwstuttgart.syntaxtree.Method; -import de.dhbwstuttgart.syntaxtree.ParameterList; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; -import de.dhbwstuttgart.syntaxtree.misc.DeclId; import de.dhbwstuttgart.syntaxtree.misc.UsedId; -import de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; -import de.dhbwstuttgart.syntaxtree.type.Pair; -import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.Void; import de.dhbwstuttgart.typeinference.ConstraintsSet; -import de.dhbwstuttgart.typeinference.FreshTypeVariable; import de.dhbwstuttgart.typeinference.JavaCodeResult; 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; @@ -93,16 +40,6 @@ public class MethodCall extends Expr } // ino.end - // ino.attribute.OK.25630.declaration - private static final int OK = 0; - // ino.end - // ino.attribute.UNIFY_ERROR.25633.declaration - private static final int UNIFY_ERROR = 1; - // ino.end - // ino.attribute.METHOD_NOT_FOUND_ERROR.25636.declaration - private static final int METHOD_NOT_FOUND_ERROR = 2; - // ino.end - // ino.attribute.receiver.25639.declaration /** @@ -112,34 +49,7 @@ public class MethodCall extends Expr // ino.end // ino.attribute.arglist.25642.declaration private ArgumentList arglist=new ArgumentList(); - // ino.end - private Vector exprtypes=new Vector(); //hier werden die Typen der �bergabewerten von sc_check eingetragen. - // ino.attribute.class_name.25645.declaration - private String class_name; //hier steht in welcher Klasse die Methode deklariert ist. - // ino.end - // ino.attribute.uebernachdurch.25651.declaration - private Hashtable uebernachdurch; - // ino.end - // ino.attribute.finde_method.25654.declaration - private Vector> finde_method=new Vector>(); - // ino.end - // ino.attribute.counter.25657.declaration - private int counter; - // ino.end - - // ino.attribute.methodsFittingMethodCall.25660.decldescription type=javadoc - /** - * Da der SemanticCheck nicht mehr ausgeführt wird, werden hier die bei der - * Typrekonstruktion gefundenen Methoden abgespeichert. Problem ist hier jedoch, - * dass der receiver in diesem Moment noch nicht fest steht. Deshalb wird je - * Receiver ein Methodcall abgelegt. Dieser kann dann mit bspw. - * methodsFittingMethodCAll.get("Vector") abgerufen werden. - */ - // ino.end - // ino.attribute.methodsFittingMethodCall.25660.declaration - private Hashtable methodsFittingMethodCall=new Hashtable(); - // ino.end // ino.attribute.parserlog.25663.declaration protected static Logger parserlog = Logger.getLogger("parser"); // ino.end @@ -223,408 +133,10 @@ public class MethodCall extends Expr } // ino.end - // ino.method.getMethodFittingMethodCallAndClassname.25705.defdescription type=javadoc - /** - * hoti 4.5.06 - * Diese Methode lädt die Methodeninfos einer Methode aus der Hashtable - * methodsfittingmethodcall in ein Method-Objekt - * anhand der angegeben klasse - * @see methodsFittingMethodCall - * @param className - * @return - * @throws JVMCodeException - */ - // ino.end - // ino.method.getMethodFittingMethodCallAndClassname.25705.definition - public Method getMethodFittingMethodCallAndClassname(String className) - throws JVMCodeException - // ino.end - // ino.method.getMethodFittingMethodCallAndClassname.25705.body - { - CMethodTypeAssumption assumption=methodsFittingMethodCall.get(className); - if(assumption==null){ - throw new JVMCodeException("Codegen: Fuer die Klasse "+className+" wurde die Methode "+usedid.get_Name_1Element()+" nicht gefunden"); - } - Vector paraAssumptions=assumption.getParaAssumptions(); - Type returnType=assumption.getAssumedType(); - Method meth=new Method(0); - Vector parameterVector=new Vector(); - ParameterList pl=new ParameterList(); - for(int i=0;i nichterkannte) kann kein Methodenaufruf ausgeführt werden - // Es muss sich also um einen RefType handeln. Ansonsten gibt es einen Fehler - - if(!(receiver.get_Expr().getType() instanceof RefType)){ - throw new JVMCodeException("Es kann nur auf ein RefType ein Methodenaufruf ausgeführt werden ("+receiver+"["+receiver.get_Expr().getType()+"])"); - } - - // HOTI 4.5.06 - // Es handelt sich also um einen RefType. Der Klassenname wird nun bezogen - String receiverClassName=((RefType)receiver.get_Expr().getType()).getTypeName(); - - // Die richtige Methode wird gesucht und gesetzt - Method called_method=getMethodFittingMethodCallAndClassname(receiverClassName); - - - Vector name_vector = get_Name_Vector(); - String local_name = receiver.get_Expr().get_Name(); - - // Richtiges Objekt auf den Stack legen - int index = code.get_indexOf_Var(local_name); - - if (index != -1 ) { // Lokale Variable - try { - 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 - JavaClassName local_type = code.get_TypeOf_Var(local_name) - .getName(); - code.add_code(JVMCode.nload(local_type.toString())); - code.add_code_byte((byte) index); - } - } else { // FieldVariable - code.add_code(JVMCode.aload_0); - code.add_code(JVMCode.getfield); - code.add_code_short(classfile.add_field_ref(local_name, - class_name, JVMCode.get_codegen_Type(receiver.get_Type(), null))); - } - - String called_method_name = called_method.get_Method_Name(); - if (called_method_name == null) - called_method_name = (String) name_vector.lastElement(); - // feda 04.07.07 an dieser Stelle muss geschaut werden ob - // die Methode eine Static Methode ist. - // Wenn Static dann aload_0 weg und anstellen von - // code.add_code(JVMCode.invokevirtual); muss - // code.add_code(JVMCode.invokestatic); stehen. - - - if (arglist != null) - arglist.codegen(classfile, code, paralist); - code.add_code(JVMCode.invokevirtual); - code.add_code_short(classfile.add_method_ref(receiverClassName, - called_method_name, called_method - .get_codegen_Param_Type(paralist))); - } -// ino.end + - // ino.method.makeReceiver.25714.definition - private void makeReceiver() - // ino.end - // ino.method.makeReceiver.25714.body - { - usedid.get_Name().remove(usedid.get_Name().size()-1); //Methodenname loeschen - Iterator namen = usedid.get_Name().iterator(); - LocalOrFieldVar LOFV = new LocalOrFieldVar((String)namen.next(),getOffset()); - LOFV.setType(TypePlaceholder.fresh(this)); - receiver = new Receiver(LOFV); - while(namen.hasNext()) { - InstVar INSTVA = new InstVar(receiver.get_Expr(), (String)namen.next(),getOffset()); - INSTVA.setType(TypePlaceholder.fresh(this)); - receiver = new Receiver(INSTVA); - } - } - // ino.end - - - - - // ino.method.addMethodAndSuperclassMethodsToFittings.25726.defdescription type=javadoc - /** - * HOTI 4.5.06-15.5.06 - * Fügt diese Klasse mit deren Typannahme in den Vektor ein. - * Da aber auch die Subklassen alle die Methodenproperties haben - * können müssen die mit rein... - * @param classToAdd - * @param methodAssumCopy - * @param fc - */ - // ino.end - // ino.method.addMethodAndSuperclassMethodsToFittings.25726.definition - private void addMethodAndSuperclassMethodsToFittings(RefType classToAdd, CMethodTypeAssumption methodAssumCopy, FC_TTO fctto) - // ino.end - // ino.method.addMethodAndSuperclassMethodsToFittings.25726.body - { - methodsFittingMethodCall.put(classToAdd.getTypeName(),methodAssumCopy); - // Input: Klasse Vector - // Output: Alle Klassen <= Vector ... ohne Parameter - RefType cloneRT=classToAdd.clone(); - CSubstitutionSet sub=cloneRT.GenericTypeVar2TypePlaceholder(); - sub.applyThisSubstitutionSet(cloneRT); - Vector vec=sub.getVector(); - for(int i=0;i> test=Unify.instanceSmaller(pair,fctto); - for(int j=0;jhandleMethodAssum().
Author: J�rg B�uerle - * @param multiTuple - * @param possibleTypeComb - * @param returnSet - * @param className - * @param methodName - * @param paraCount - * @param methodsFittingMethodCall Hashtable in der jede erfolgreiche Methode - * abgelegt wird @param supportData - * @return Einen Error-Code: OK, UNIFY_ERROR oder - * METHOD_NOT_FOUND_ERROR - */ - // ino.end - // ino.method.searchAndHandleMethod.25729.definition - private int searchAndHandleMethod(CMultiplyTuple multiTuple, CTypeAssumptionSet V, CTripleSet returnSet, RefType classType, String methodName, int paraCount, CSupportData supportData, Hashtable methodsFittingMethodCall) - // ino.end - // ino.method.searchAndHandleMethod.25729.body - { - // -------------------------- - // Typannahme f�r Methode heraussuchen: - // -------------------------- - - String className; - if(classType instanceof RefType){ - className=((RefType)classType).getTypeName(); - }else{ - className=classType.getName().toString(); - } - - CMethodKey key = new CMethodKey( - className, - methodName, - paraCount - ); - - Vector methodAssums = V.getElements(key); - - - // Wenn die Methode nicht fuendig war: - - if(methodAssums.size()==0){ - return METHOD_NOT_FOUND_ERROR; - } - - // Fuendig: Alle Methoden, die "xxx" heißen und y Parameter haben sind nun in dem Vector drin - // Für alle soll jetzt geschaut werden - - int wellDoneFunctionCount=0; - - for(int item=0;item typeGenPara = supportData.getCurrentClassPara(); - - // Generics der Methode holen - // p.ex. E test(){...} - // ___________________ - Vector genericMethodParameters=methodAssum.getGenericMethodParameters(); - - // Klassengenerics verarbeiten - Vector typePara = null; - if (typeGenPara != null) { - typePara = new Vector(); - for( int i = 0; i < typeGenPara.size(); i++ ) - { - typePara.addElement(typeGenPara.elementAt(i)); - } - } - - // Methodengenerics verarbeiten - Vector additionalPairsToUnify=new Vector(); - - if (genericMethodParameters != null && genericMethodParameters.size()>0) { - - CSubstitutionSet sub = new CSubstitutionSet(); - - for( int i = 0; i < genericMethodParameters.size(); i++ ){ - - - if(genericMethodParameters.elementAt(i) instanceof BoundedGenericTypeVar){ - // Jede Bound als Paar zum Unifizieren vormerken - TypePlaceholder newTLV=TypePlaceholder.fresh(this); - BoundedGenericTypeVar bgtv=(BoundedGenericTypeVar)genericMethodParameters.elementAt(i); - for(int j=0;jAuthor: J�rg B�uerle - * @param multiTuple - * @param returnSet - * @param methodAssum - * @param className - * @param supportData - * @param additionalPairsToUnify - * @return Einen Error-Code: OK, UNIFY_ERROR oder - * METHOD_NOT_FOUND_ERROR - */ - // ino.end - // ino.method.handleMethodAssum.25732.definition - private static int handleMethodAssum(CMultiplyTuple multiTuple, Vector typePara, CTripleSet returnSet, CMethodTypeAssumption methodAssum, Type classType, CSupportData supportData, Vector additionalPairsToUnify) - // ino.end - // ino.method.handleMethodAssum.25732.body - { - // -------------------------- - // Typen unifizieren: - // -------------------------- - - // Vorerst Paare zum Unifizieren bilden - Vector pairsToUnify = createPairsToUnify(multiTuple, typePara, classType, methodAssum); - - // Vorgemerkte Paare - if(pairsToUnify!=null && additionalPairsToUnify!=null) - pairsToUnify.addAll(additionalPairsToUnify); - - // Die Paare endlich unifizieren - Vector> unifierPossibilities = Unify.unify(pairsToUnify, supportData.getFiniteClosure()); - // -------------------------- - // Wenn Unifier vorhanden, dann anwenden: - // -------------------------- - if(unifierPossibilities.size()!=0){ - // -------------------------- - // Subset bauen: - // -------------------------- - CTripleSet subSet = new CTripleSet(); - // -------------------------- - // Alle Unifer durchgehen: - // -------------------------- - for(int j=0; jAuthor: J�rg B�uerle - * @param multiTuple - * @param receiverClass - * @param methodAssum - * @return - */ - // ino.end - // ino.method.createPairsToUnify.25735.definition - private static Vector createPairsToUnify(CMultiplyTuple multiTuple, Vector typePara, Type receiverClass, CMethodTypeAssumption methodAssum) - // ino.end - // ino.method.createPairsToUnify.25735.body - { - Vector pairList = new Vector(); - Pair p = new Pair(multiTuple.getResultTypes().firstElement(), receiverClass); - pairList.addElement(p); - for(int i=1; iAuthor: Martin Pl�micke @@ -648,20 +160,7 @@ public class MethodCall extends Expr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - if(this.get_Receiver()!=null) - { - this.get_Receiver().get_Expr().addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - if(this.getArgumentList()!=null){ - for(Expr n : this.getArgumentList().expr) - { - n.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - }} - } - + /** * @author Andreas Stadelmeier, a10023 * @return der Name der Methode, welcher dieser MethodCall aufruft. @@ -738,6 +237,13 @@ public class MethodCall extends Expr public void parserPostProcessing(SyntaxTreeNode parent) { super.parserPostProcessing(parent); } + + @Override + public void codegen(ClassFile classfile, CodeAttribute code, Vector paralist) + throws JVMCodeException { + // TODO Auto-generated method stub + + } } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java index 2efdd2e8..6d9aa6f4 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/NegativeExpr.java @@ -6,29 +6,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.myexception.CTypeReconstructionException; @@ -46,6 +25,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -140,11 +120,6 @@ public class NegativeExpr extends UnaryExpr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { // TODO Auto-generated method stub diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/NewArray.java b/src/de/dhbwstuttgart/syntaxtree/statement/NewArray.java index 3a921483..94e9af5c 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/NewArray.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/NewArray.java @@ -5,27 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -39,6 +20,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -153,33 +135,7 @@ public class NewArray extends Expr } // ino.end - // ino.method.TRExp.25821.defdescription type=javadoc - /** - * Implementierung des Algorithmus 5.32 von Martin Pl�micke - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.25821.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25821.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - // ino.method.TRStatement.25824.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25824.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.25827.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) // ino.end @@ -187,20 +143,6 @@ public class NewArray extends Expr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - if(this.get_UsedId().get_Name_1Element().equals(NameVariable)) - { - //wenn Variable mit gleichem Namen gefunden->schreibe Offset - localAssumption.addOffset(this.get_UsedId().getOffset()); - } - if(this.expr!=null){ - for(Expr n : this.expr) - { - n.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - }} - } @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/NewClass.java b/src/de/dhbwstuttgart/syntaxtree/statement/NewClass.java index 3b6733a9..9e562ef0 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/NewClass.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/NewClass.java @@ -7,37 +7,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CMultiplyTuple; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CMultiplyTupleSet; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -64,6 +35,7 @@ import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.ConstructorAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -226,20 +198,6 @@ public class NewClass extends Expr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - if(this.get_UsedId().get_Name_1Element().equals(NameVariable)) - { - //wenn Variable mit gleichem Namen gefunden->schreibe Offset - localAssumption.addOffset(this.get_UsedId().getOffset()); - } - if(this.getArgumentList()!=null){ - for(Expr n : this.getArgumentList().expr) - { - n.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - }} - } - @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { //TODO: Das hier noch vervollständigen diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java index c92bce5e..26a54659 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/NotExpr.java @@ -6,31 +6,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.myexception.CTypeReconstructionException; @@ -49,6 +25,7 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.OderConstraint; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -163,11 +140,6 @@ public class NotExpr extends UnaryExpr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { ConstraintsSet ret = new ConstraintsSet(); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Null.java b/src/de/dhbwstuttgart/syntaxtree/statement/Null.java index 3f81ed76..53e73917 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Null.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Null.java @@ -5,28 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -41,6 +21,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -94,24 +75,6 @@ public class Null extends Literal } // ino.end - // ino.method.TRStatement.25938.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25938.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRExp.25941.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25941.body - { - CTripleSet tripleSet = new CTripleSet(); - tripleSet.addElement(new CTriple(sigma, TypePlaceholder.fresh(this) ,V)); - return tripleSet; - } // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.25944.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java index e67d6a25..bea0c19d 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/PositivExpr.java @@ -5,27 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.myexception.CTypeReconstructionException; @@ -38,6 +19,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -113,23 +95,6 @@ public class PositivExpr extends UnaryExpr {} // ino.end - // ino.method.TRExp.25978.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.25978.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end - - // ino.method.TRStatement.25981.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.25981.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.25984.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) // ino.end @@ -138,10 +103,6 @@ public class PositivExpr extends UnaryExpr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PostDecExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PostDecExpr.java index 9e22a4b1..0b97d2e7 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/PostDecExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/PostDecExpr.java @@ -6,29 +6,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -47,6 +26,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -174,11 +154,6 @@ public class PostDecExpr extends UnaryExpr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } @Override public JavaCodeResult printJavaCode(ResultSet resultSet) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PostIncExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PostIncExpr.java index badcceb1..5c96c4c6 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/PostIncExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/PostIncExpr.java @@ -6,32 +6,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -53,6 +28,7 @@ import de.dhbwstuttgart.typeinference.OderConstraint; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -181,11 +157,6 @@ public class PostIncExpr extends UnaryExpr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } @Override public JavaCodeResult printJavaCode(ResultSet resultSet) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java index 8ee14021..aeae83ae 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/PreDecExpr.java @@ -6,29 +6,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -47,6 +25,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -175,11 +154,6 @@ public class PreDecExpr extends UnaryExpr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - @Override public JavaCodeResult printJavaCode(ResultSet resultSet) { // TODO Auto-generated method stub diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java b/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java index 546c7171..56d2f92c 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/PreIncExpr.java @@ -6,29 +6,7 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -47,6 +25,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -176,11 +155,6 @@ public class PreIncExpr extends UnaryExpr } // ino.end - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - } - @Override public JavaCodeResult printJavaCode(ResultSet resultSet) { // TODO Auto-generated method stub diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Return.java b/src/de/dhbwstuttgart/syntaxtree/statement/Return.java index 6400f0c0..d101cecd 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Return.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Return.java @@ -5,28 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -45,6 +24,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.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -117,12 +97,6 @@ public class Return extends Statement { } // ino.end - - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable) - { - retexpr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - return true; - } @Override public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) { @@ -133,11 +107,7 @@ public class Return extends Statement ret.add(new SingleConstraint(retexpr.getType(), this.getType())); return ret; } - - public void replaceType(CReplaceTypeEvent e) { - super.replaceType(e); - } - + public int getTypeLineNumber() { return 0; } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Statement.java b/src/de/dhbwstuttgart/syntaxtree/statement/Statement.java index 68519262..1d03d840 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Statement.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Statement.java @@ -24,20 +24,11 @@ import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.Typeable; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import sun.reflect.generics.reflectiveObjects.NotImplementedException; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -// ino.end - // ino.class.Statement.26184.declaration -public abstract class Statement extends SyntaxTreeNode implements IItemWithOffset, Typeable, ITypeReplacementListener +public abstract class Statement extends SyntaxTreeNode implements IItemWithOffset, Typeable // ino.end // ino.class.Statement.26184.body { @@ -91,8 +82,6 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse public abstract void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters); // ino.end - public abstract boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable); - /** * @author AI10023 - Andreas Stadelmeier * Implementierung des Java 8 - Typinferenzalgorithmus von Martin Plümicke @@ -124,22 +113,8 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse */ public void setType(Type t) { - if(this.getType() instanceof TypePlaceholder){ - ((TypePlaceholder)this.getType()).removeReplacementListener(this); - } - if(t instanceof TypePlaceholder){ - ((TypePlaceholder)t).addReplacementListener(this); - } this.type=t; } - - public void replaceType(CReplaceTypeEvent e) - { - if(getType() instanceof TypePlaceholder){ - ((TypePlaceholder)getType()).removeReplacementListener(this); - } - this.setType(e.getNewType()); - } public abstract JavaCodeResult printJavaCode(ResultSet resultSet); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java b/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java index 92cea66e..36df626d 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/StringLiteral.java @@ -5,29 +5,8 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -44,6 +23,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.unify.CSubstitutionSet; @@ -131,15 +111,6 @@ public class StringLiteral extends Literal } // ino.end - - // ino.method.TRStatement.26255.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.26255.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.26258.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/This.java b/src/de/dhbwstuttgart/syntaxtree/statement/This.java index d33e59ff..7733b5aa 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/This.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/This.java @@ -5,29 +5,7 @@ package de.dhbwstuttgart.syntaxtree.statement; import java.util.Hashtable; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -44,6 +22,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; @@ -127,43 +106,6 @@ public class This extends Expr { return null; } // ino.end - // ino.method.TRExp.26289.defdescription type=javadoc - /** - * Implementierung des Algorithmus 5.35 von Martin Pl�micke - *
Author: J�rg B�uerle - * @param sigma - * @param V - * @param supportData - * @return - */ - // ino.end - // ino.method.TRExp.26289.definition - public CTripleSet TRExp(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRExp.26289.body - { - CTripleSet ret = new CTripleSet(); - RefType newType; - Type supportDataType=supportData.getCurrentClassType(); - if(supportDataType instanceof RefType){ - newType=(RefType)supportDataType; - }else{ - newType=new RefType(supportData.getCurrentClass(),getOffset()); - } - this.type=newType; - ret.addElement(new CTriple(sigma, newType,V)); - return ret; - } - // ino.end - - // ino.method.TRStatement.26292.definition - public CTripleSet TRStatement(CSubstitutionSet sigma, CTypeAssumptionSet V, CSupportData supportData) - // ino.end - // ino.method.TRStatement.26292.body - { - throw CTypeReconstructionException.createNotImplementedException(); - } - // ino.end // ino.method.wandleRefTypeAttributes2GenericAttributes.26295.definition public void wandleRefTypeAttributes2GenericAttributes(Vector paralist, Vector genericMethodParameters) @@ -172,15 +114,6 @@ public class This extends Expr { } // ino.end - - public void addOffsetsToExpression(CTypeAssumption localAssumption,String NameVariable,boolean isMemberVariable) - { - if(this.arglist.expr!=null){ - for(Expr n : this.arglist.expr) - { - n.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - }} - } @Override public ConstraintsSet TYPEExpr(TypeAssumptions assumptions) { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java index 5176123a..2911adb3 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java @@ -7,31 +7,8 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSupportData; -import mycompiler.mytypereconstruction.CTriple; -import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTripleSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.ClassFile; import de.dhbwstuttgart.bytecode.CodeAttribute; import de.dhbwstuttgart.bytecode.JVMCode; @@ -54,6 +31,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.unify.CSubstitutionSet; import de.dhbwstuttgart.typeinference.unify.Unify; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -183,13 +161,6 @@ public class WhileStmt extends Statement } // ino.end - public boolean addOffsetsToStatement(CTypeAssumption localAssumption, String NameVariable, boolean isMemberVariable) - { - expr.addOffsetsToExpression(localAssumption,NameVariable,isMemberVariable); - loop_block.addOffsetsToStatement(localAssumption,NameVariable,isMemberVariable); - return true; - } - @Override public ConstraintsSet TYPEStmt(TypeAssumptions assumptions) { ConstraintsSet ret = new ConstraintsSet(); @@ -201,11 +172,6 @@ public class WhileStmt extends Statement return ret; } - public void replaceType(CReplaceTypeEvent e) { - // TODO Auto-generated method stub - throw new NotImplementedException(); - } - public int getTypeLineNumber() { throw new NotImplementedException(); } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/CRefTypeSet.java b/src/de/dhbwstuttgart/syntaxtree/type/CRefTypeSet.java index 9c909450..80c6d3ca 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/CRefTypeSet.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/CRefTypeSet.java @@ -3,7 +3,7 @@ package de.dhbwstuttgart.syntaxtree.type; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.set.CVectorSet; +import de.dhbwstuttgart.typeinference.unify.CVectorSet; public class CRefTypeSet extends CVectorSet { diff --git a/src/de/dhbwstuttgart/syntaxtree/type/FreshWildcardType.java b/src/de/dhbwstuttgart/syntaxtree/type/FreshWildcardType.java index fd24670e..d3bd6f3f 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/FreshWildcardType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/FreshWildcardType.java @@ -2,9 +2,9 @@ package de.dhbwstuttgart.syntaxtree.type; import java.util.Vector; +import de.dhbwstuttgart.parser.JavaClassName; 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 { diff --git a/src/de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.java b/src/de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.java index 4af912eb..4560edd8 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/GenericTypeVar.java @@ -6,34 +6,14 @@ package de.dhbwstuttgart.syntaxtree.type; import java.util.HashMap; import java.util.Iterator; import java.util.Vector; -// ino.end - - - - - - - - - - - - - - - - - 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; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; // ino.class.GenericTypeVar.26505.description type=javadoc /** @@ -188,7 +168,7 @@ public class GenericTypeVar extends Type public TypePlaceholder getTypePlaceHolder() { if(!GenericTypeVar.tph.containsKey(this)){ - GenericTypeVar.tph.put(this, TypePlaceholder.fresh(this.getName().toString())); + GenericTypeVar.tph.put(this, TypePlaceholder.fresh(this.getName().toString(),this)); } return GenericTypeVar.tph.get(this); //if(this.tph == null)this.tph = TypePlaceholder.fresh(); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/Pair.java b/src/de/dhbwstuttgart/syntaxtree/type/Pair.java index 7ba5056c..81f84404 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/Pair.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/Pair.java @@ -6,7 +6,8 @@ import java.util.Hashtable; import java.util.Vector; // ino.end -import de.dhbwstuttgart.typeinference.parser.JavaClassName; + +import de.dhbwstuttgart.parser.JavaClassName; diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index bbf164e9..9bac8e69 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -8,38 +8,20 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.CSubstitutionGenVar; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; - import org.apache.log4j.Logger; -// ino.end - - - - - - - - - - - - - - - - import de.dhbwstuttgart.bytecode.JVMCode; import de.dhbwstuttgart.core.IItemWithOffset; import de.dhbwstuttgart.myexception.SCException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.misc.UsedId; import de.dhbwstuttgart.typeinference.JavaCodeResult; 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 de.dhbwstuttgart.typeinference.unify.CSubstitutionGenVar; +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; import sun.reflect.generics.reflectiveObjects.NotImplementedException; @@ -208,7 +190,7 @@ public class RefType extends Type implements IMatchable { if (parameter.elementAt(i) instanceof GenericTypeVar) { - TypePlaceholder tlv = TypePlaceholder.fresh(); + TypePlaceholder tlv = TypePlaceholder.fresh(null); sub.addElement(new CSubstitutionGenVar((GenericTypeVar)parameter.elementAt(i), tlv)); parameter.set(i, tlv); } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/Type.java b/src/de/dhbwstuttgart/syntaxtree/type/Type.java index 3573d308..8fab0c18 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/Type.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/Type.java @@ -7,19 +7,19 @@ import java.util.Vector; import de.dhbwstuttgart.bytecode.JVMCode; import de.dhbwstuttgart.core.IItemWithOffset; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.misc.UsedId; 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; // ino.class.Type.26716.declaration -public class Type implements IItemWithOffset +public class Type extends SyntaxTreeNode implements IItemWithOffset // ino.end // ino.class.Type.26716.body { @@ -301,6 +301,11 @@ public class Type implements IItemWithOffset Vector ret = new Vector<>(); return ret; } + + @Override + public Vector getChildren() { + return new Vector<>(); + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java b/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java index d861b5ba..2e65d172 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/TypePlaceholder.java @@ -9,17 +9,13 @@ import java.util.Vector; import java.util.logging.Logger; import de.dhbwstuttgart.core.MyCompiler; +import de.dhbwstuttgart.parser.JavaClassName; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; 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; -import mycompiler.mytypereconstruction.replacementlistener.IReplaceTypeEventProvider; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; -// ino.end - // ino.class.TypePlaceholder.26780.description type=javadoc /** * Repr�sentiert einen Typparameter f�r einen vom Programmierer nicht angegeben @@ -31,7 +27,7 @@ import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListe */ // ino.end // ino.class.TypePlaceholder.26780.declaration -public class TypePlaceholder extends Type implements IReplaceTypeEventProvider +public class TypePlaceholder extends Type // ino.end // ino.class.TypePlaceholder.26780.body { @@ -41,10 +37,8 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider // ino.attribute.m_TypePlaceholdersRegistry.26788.declaration private static Hashtable m_TypePlaceholdersRegistry = new Hashtable(); // ino.end - - // ino.attribute.m_ReplacementListeners.26791.declaration - private Vector m_ReplacementListeners; - // ino.end + private SyntaxTreeNode parent; + // ino.method.TypePlaceholder.26794.defdescription type=javadoc /** @@ -55,13 +49,13 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider */ // ino.end // ino.method.TypePlaceholder.26794.definition - private TypePlaceholder(String typeName) + private TypePlaceholder(String typeName, SyntaxTreeNode parent) // ino.end // ino.method.TypePlaceholder.26794.body { super(-1); this.name = new JavaClassName(typeName); - m_ReplacementListeners = new Vector(); + this.parent = parent; } // ino.end @@ -83,36 +77,17 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider } // ino.end - // ino.method.fresh.26800.defdescription type=javadoc - /** - * Erzeugt eine neue TypePlaceholder mit einem eindeutigen Namen. Die - * erzeugte Instanz ist die einzig im Syntaxbaum existierende Instanz dieser - * Variablen.
Author: J�rg B�uerle - * @return Die TypePlaceholder - */ - // ino.end - // ino.method.fresh.26800.definition - public static TypePlaceholder fresh() - // ino.end - // ino.method.fresh.26800.body - { - TypePlaceholder typeVar = new TypePlaceholder(makeNewName()); - m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar); - return typeVar; - } - // ino.end - /** * Generiert einen neuen TPH mit einem bestimmten Namen. * Wird benötigt, wenn aus Generischen Variablen TPH generiert werden. * @param name * @return */ - public static TypePlaceholder fresh(String name) + public static TypePlaceholder fresh(String name, SyntaxTreeNode parent) // ino.end // ino.method.fresh.26800.body { - TypePlaceholder typeVar = new TypePlaceholder(name); + TypePlaceholder typeVar = new TypePlaceholder(name, parent); TypePlaceholder oldTPH = m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar); if(oldTPH != null){ oldTPH.name = new JavaClassName(makeNewName()); @@ -130,10 +105,9 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider * @param listener * @return */ - public static TypePlaceholder fresh(ITypeReplacementListener listener){ - TypePlaceholder ret = fresh(); - //System.out.println(""+ret+" -> "+listener); - ret.addReplacementListener(listener); + public static TypePlaceholder fresh(SyntaxTreeNode parent){ + TypePlaceholder ret= new TypePlaceholder(makeNewName(), parent); + m_TypePlaceholdersRegistry.put(ret.getName(), ret); return ret; } @@ -258,134 +232,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider } // ino.end - // ino.method.addReplacementListener.26815.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - * @param listener - */ - // ino.end - // ino.method.addReplacementListener.26815.definition - public void addReplacementListener(ITypeReplacementListener listener) - // ino.end - // ino.method.addReplacementListener.26815.body - { - if(!this.containsListener(listener)){ - m_ReplacementListeners.addElement(listener); - } - } - // ino.end - // ino.method.containsListener.26818.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - * @param listener - * @return - */ - // ino.end - // ino.method.containsListener.26818.definition - public boolean containsListener(ITypeReplacementListener listener) - // ino.end - // ino.method.containsListener.26818.body - { - return m_ReplacementListeners.contains(listener); - } - // ino.end - - // ino.method.removeReplacementListener.26821.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - * @param listener - */ - // ino.end - // ino.method.removeReplacementListener.26821.definition - public void removeReplacementListener(ITypeReplacementListener listener) - // ino.end - // ino.method.removeReplacementListener.26821.body - { - m_ReplacementListeners.removeElement(listener); - } - // ino.end - - // ino.method.removeAllReplacementListeners.26824.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - */ - // ino.end - // ino.method.removeAllReplacementListeners.26824.definition - public void removeAllReplacementListeners() - // ino.end - // ino.method.removeAllReplacementListeners.26824.body - { - m_ReplacementListeners.removeAllElements(); - } - // ino.end - - // ino.method.fireReplaceTypeEvent.26827.defdescription type=javadoc - /** - *
Author: J�rg B�uerle - * @param e - */ - // ino.end - // ino.method.fireReplaceTypeEvent.26827.definition - public void fireReplaceTypeEvent(CReplaceTypeEvent e) - // ino.end - // ino.method.fireReplaceTypeEvent.26827.body - { - for(int i=0; iAuthor: J�rg B�uerle - * @return - */ - // ino.end - // ino.method.getReplacementListeners.26830.definition - public Iterator getReplacementListeners() - // ino.end - // ino.method.getReplacementListeners.26830.body - { - return m_ReplacementListeners.iterator(); - } - // ino.end - - // ino.method.replaceWithType.26833.defdescription type=javadoc - /** - * Diese Methode geht alle TypeReplacmentListener durch und tauscht �ber deren - * Callback-Methode diesen Typ gegen den neuen aus. - *
Author: J�rg B�uerle - * @param newType - */ - // ino.end - // ino.method.replaceWithType.26833.definition - public void replaceWithType(Type newType) - // ino.end - // ino.method.replaceWithType.26833.body - { - this.fireReplaceTypeEvent(new CReplaceTypeEvent(this, newType)); - } - // ino.end - - // ino.method.getLineNumbers.26836.definition - public Vector getLineNumbers() - // ino.end - // ino.method.getLineNumbers.26836.body - { - Vector lineNumbers = new Vector(); - for(int i=0; i)m_ReplacementListeners.clone(); + TypePlaceholder dolly = new TypePlaceholder(name.toString(), this.parent); return dolly; } // ino.end @@ -467,7 +313,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider //backdoorvars werden registiert, weil am Ende beim execute //auf den CSubstitution nicht registrierte Variablen zu //Exceptions fuehrt - TypePlaceholder typeVar = new TypePlaceholder(makeNewName()); + TypePlaceholder typeVar = new TypePlaceholder(makeNewName(), null); m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar); return typeVar; @@ -517,7 +363,7 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider //backdoorvars werden registiert, weil am Ende beim execute //auf den CSubstitution nicht registrierte Variablen zu //Exceptions fuehrt - TypePlaceholder typeVar = new TypePlaceholder(name); + TypePlaceholder typeVar = new TypePlaceholder(name, null); m_TypePlaceholdersRegistry.put(typeVar.getName(), typeVar); return typeVar; @@ -554,12 +400,10 @@ public class TypePlaceholder extends Type implements IReplaceTypeEventProvider */ public Vector getTypeInsertPoints(ResultSet result) { Vector ret = new Vector(); - for(ITypeReplacementListener ti : this.m_ReplacementListeners){ - if(ti instanceof TypeInsertable){ - TypeInsertPoint toAdd = ((TypeInsertable) ti).createTypeInsertPoint(this, result); - if(toAdd != null)ret.add(toAdd); - //ret.add(new TypeInsertPoint(this, (TypeInsertable)ti, result.getTypeEqualTo(this), result)); - } + if(this.parent instanceof TypeInsertable){ + TypeInsertPoint toAdd = ((TypeInsertable) parent).createTypeInsertPoint(this, result); + if(toAdd != null)ret.add(toAdd); + //ret.add(new TypeInsertPoint(this, (TypeInsertable)ti, result.getTypeEqualTo(this), result)); } return ret; } diff --git a/src/de/dhbwstuttgart/typeinference/FunN.java b/src/de/dhbwstuttgart/typeinference/FunN.java index bf1ae84b..5a21d03d 100755 --- a/src/de/dhbwstuttgart/typeinference/FunN.java +++ b/src/de/dhbwstuttgart/typeinference/FunN.java @@ -4,6 +4,7 @@ package de.dhbwstuttgart.typeinference; import java.util.Iterator; import java.util.Vector; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.ParameterList; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; @@ -12,10 +13,6 @@ 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; /** * @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke @@ -26,7 +23,7 @@ import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; * FunN ist ein RefType. Der RefType ist nicht mit einem FunNInterface verbunden. * */ -public class FunN extends RefType implements ITypeReplacementListener{ +public class FunN extends RefType { private Type R; private Vector T; @@ -89,16 +86,10 @@ public class FunN extends RefType implements ITypeReplacementListener{ protected void setT(Vector T){ this.T = T; calculateNewParalist(); - //ReplacementListener registrieren: - for(Type t : T)if(t instanceof TypePlaceholder)((TypePlaceholder)t).addReplacementListener(this); } protected void setR(Type R){ this.R = R; calculateNewParalist(); - //Sind die übergebenen Typen TypePlaceholder, so soll die FunN über TypReplacements informiert werden. - if(R instanceof TypePlaceholder){ - ((TypePlaceholder)R).addReplacementListener(this); - } } /* @@ -112,15 +103,7 @@ public class FunN extends RefType implements ITypeReplacementListener{ return ret; } */ - public void replaceType(CReplaceTypeEvent e) { - if(R.equals(e.getOldType()))this.setR(e.getNewType()); - for(Type t : T){ - if(t.equals(e.getOldType())){ - T.setElementAt(e.getNewType(),T.indexOf(t)); - this.setT(T); - } - } - } + public int getTypeLineNumber() { // TODO Auto-generated method stub diff --git a/src/de/dhbwstuttgart/typeinference/FunNInterface.java b/src/de/dhbwstuttgart/typeinference/FunNInterface.java index b19ddc02..ac64a8a3 100644 --- a/src/de/dhbwstuttgart/typeinference/FunNInterface.java +++ b/src/de/dhbwstuttgart/typeinference/FunNInterface.java @@ -9,7 +9,6 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; -import mycompiler.mytype.*; /** * Stellt das Interface FunN dar. diff --git a/src/de/dhbwstuttgart/typeinference/FunNMethod.java b/src/de/dhbwstuttgart/typeinference/FunNMethod.java index bb61be65..07b8acf8 100644 --- a/src/de/dhbwstuttgart/typeinference/FunNMethod.java +++ b/src/de/dhbwstuttgart/typeinference/FunNMethod.java @@ -9,8 +9,6 @@ import de.dhbwstuttgart.syntaxtree.misc.DeclId; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; -import mycompiler.mytype.*; -import mycompiler.myclass.*; public class FunNMethod extends Method{ /** diff --git a/src/de/dhbwstuttgart/typeinference/Overloading.java b/src/de/dhbwstuttgart/typeinference/Overloading.java index c06421ec..b2d7dfae 100755 --- a/src/de/dhbwstuttgart/typeinference/Overloading.java +++ b/src/de/dhbwstuttgart/typeinference/Overloading.java @@ -10,8 +10,6 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; /** * diff --git a/src/de/dhbwstuttgart/typeinference/TypeInsertable.java b/src/de/dhbwstuttgart/typeinference/TypeInsertable.java index bd283a5e..39411208 100644 --- a/src/de/dhbwstuttgart/typeinference/TypeInsertable.java +++ b/src/de/dhbwstuttgart/typeinference/TypeInsertable.java @@ -3,9 +3,8 @@ package de.dhbwstuttgart.typeinference; import de.dhbwstuttgart.core.IItemWithOffset; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; -public interface TypeInsertable extends ITypeReplacementListener, Typeable, IItemWithOffset { +public interface TypeInsertable extends Typeable, IItemWithOffset { public int getOffset(); public void setOffset(int offset); diff --git a/src/de/dhbwstuttgart/typeinference/Typeable.java b/src/de/dhbwstuttgart/typeinference/Typeable.java index bfcc3559..72c902d3 100755 --- a/src/de/dhbwstuttgart/typeinference/Typeable.java +++ b/src/de/dhbwstuttgart/typeinference/Typeable.java @@ -1,7 +1,6 @@ package de.dhbwstuttgart.typeinference; import de.dhbwstuttgart.syntaxtree.type.Type; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; public interface Typeable { /** diff --git a/src/de/dhbwstuttgart/typeinference/TypeinferenceResultSet.java b/src/de/dhbwstuttgart/typeinference/TypeinferenceResultSet.java index 77eee759..fe0e79ea 100755 --- a/src/de/dhbwstuttgart/typeinference/TypeinferenceResultSet.java +++ b/src/de/dhbwstuttgart/typeinference/TypeinferenceResultSet.java @@ -16,13 +16,7 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; -import mycompiler.mytypereconstruction.set.CTypeAssumptionSet; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; -import mycompiler.mytypereconstruction.typeassumptionkey.CMethodKey; -import mycompiler.mytypereconstruction.typeassumptionkey.CTypeAssumptionKey; -// ino.end +import de.dhbwstuttgart.typeinference.unify.CSubstitutionSet; // ino.class.CTypeReconstructionResult.27238.description type=javadoc /** diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/Assumption.java b/src/de/dhbwstuttgart/typeinference/assumptions/Assumption.java index d95089ca..837dcfa4 100644 --- a/src/de/dhbwstuttgart/typeinference/assumptions/Assumption.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/Assumption.java @@ -1,11 +1,10 @@ package de.dhbwstuttgart.typeinference.assumptions; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.Typeable; -import de.dhbwstuttgart.typeinference.parser.JavaClassName; -import mycompiler.mytype.*; public class Assumption { diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/ClassAssumption.java b/src/de/dhbwstuttgart/typeinference/assumptions/ClassAssumption.java index 9327c6d5..785a049f 100644 --- a/src/de/dhbwstuttgart/typeinference/assumptions/ClassAssumption.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/ClassAssumption.java @@ -1,9 +1,6 @@ package de.dhbwstuttgart.typeinference.assumptions; import de.dhbwstuttgart.syntaxtree.Class; -import mycompiler.myclass.*; -import mycompiler.mytype.*; - /** * Nicht wirklich eine Assumption. * Wird benutzt um Typen von Variablen zu verifizieren. diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.java b/src/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.java index 79b60d5c..11f7caa1 100644 --- a/src/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/FieldAssumption.java @@ -1,9 +1,9 @@ package de.dhbwstuttgart.typeinference.assumptions; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Field; import de.dhbwstuttgart.syntaxtree.type.RefType; -import de.dhbwstuttgart.typeinference.parser.JavaClassName; public class FieldAssumption extends Assumption { diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/GenericVarAssumption.java b/src/de/dhbwstuttgart/typeinference/assumptions/GenericVarAssumption.java index bd6c1399..3460bed9 100644 --- a/src/de/dhbwstuttgart/typeinference/assumptions/GenericVarAssumption.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/GenericVarAssumption.java @@ -1,10 +1,10 @@ package de.dhbwstuttgart.typeinference.assumptions; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; -import de.dhbwstuttgart.typeinference.parser.JavaClassName; public class GenericVarAssumption extends Assumption{ diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.java b/src/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.java index 98c8a564..30645adb 100644 --- a/src/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.java @@ -6,8 +6,6 @@ import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.FormalParameter; import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.type.Type; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytype.*; public class MethodAssumption extends FieldAssumption { diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java index f7609191..c2f4382a 100755 --- a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java @@ -4,6 +4,7 @@ import java.util.Iterator; import java.util.Vector; import de.dhbwstuttgart.core.IItemWithOffset; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.RefType; @@ -13,14 +14,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; -import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CParaTypeAssumption; -import mycompiler.mytypereconstruction.typeassumption.CTypeAssumption; /** * Eine Sammlung von TypeAssumptions. diff --git a/src/de/dhbwstuttgart/typeinference/exceptions/ParserError.java b/src/de/dhbwstuttgart/typeinference/exceptions/ParserError.java index 7d1d51ef..535c576a 100644 --- a/src/de/dhbwstuttgart/typeinference/exceptions/ParserError.java +++ b/src/de/dhbwstuttgart/typeinference/exceptions/ParserError.java @@ -1,6 +1,6 @@ package de.dhbwstuttgart.typeinference.exceptions; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; +import de.dhbwstuttgart.parser.JavaParser.yyException; public class ParserError extends TypeinferenceException{ diff --git a/src/de/dhbwstuttgart/typeinference/typedeployment/TypeInsertPoint.java b/src/de/dhbwstuttgart/typeinference/typedeployment/TypeInsertPoint.java index ad644975..33593014 100644 --- a/src/de/dhbwstuttgart/typeinference/typedeployment/TypeInsertPoint.java +++ b/src/de/dhbwstuttgart/typeinference/typedeployment/TypeInsertPoint.java @@ -12,9 +12,6 @@ import de.dhbwstuttgart.typeinference.JavaCodeResult; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.exceptions.DebugException; -import mycompiler.myclass.*; -import mycompiler.mytype.*; -import mycompiler.mytypereconstruction.replacementlistener.ITypeReplacementListener; /** * Stellt eine Einsetzungsmöglichkeit für einen Typ an einem (Typeable)Punkt im Syntaxbaum dar. diff --git a/src/de/dhbwstuttgart/typeinference/unify/CSet.java b/src/de/dhbwstuttgart/typeinference/unify/CSet.java new file mode 100755 index 00000000..08af741d --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/CSet.java @@ -0,0 +1,72 @@ +// ino.module.CSet.8698.package +package de.dhbwstuttgart.typeinference.unify; +// ino.end + +// ino.module.CSet.8698.import +import java.util.Iterator; +// ino.end + +// ino.class.CSet.27435.description type=javadoc +/** + * + * @author Jrg Buerle + * @version $date + */ +// ino.end +// ino.class.CSet.27435.declaration +public abstract class CSet implements Iterable +// ino.end +// ino.class.CSet.27435.body +{ + // ino.method.addElement.27438.declaration + public abstract void addElement(E element); + // ino.end + // ino.method.removeElement.27441.declaration + public abstract void removeElement(E element); + // ino.end + // ino.method.unite.27444.declaration + public abstract void unite(CSet anotherSet); + // ino.end + // ino.method.subtract.27447.declaration + public abstract void subtract(CSet anotherSet); + // ino.end + // ino.method.shallowCopy.27450.declaration + public abstract CSet shallowCopy(); + // ino.end + // ino.method.deepCopy.27453.declaration + public abstract CSet deepCopy(); + // ino.end + // ino.method.contains.27456.declaration + public abstract boolean contains(E element); + // ino.end + // ino.method.getCardinality.27459.declaration + public abstract int getCardinality(); + // ino.end + // ino.method.getIterator.27462.declaration + public abstract Iterator getIterator(); + // ino.end + // ino.method.equals.27465.declaration + public abstract boolean equals(Object obj); + // ino.end + + // ino.method.toString.27468.definition + public String toString() + // ino.end + // ino.method.toString.27468.body + { + StringBuffer sb = new StringBuffer(); + sb.append("Set {\n"); + Iterator it = this.getIterator(); + while(it.hasNext()){ + sb.append(it.next().toString()); + sb.append(",\n"); + } + if(this.getCardinality()>0){ + sb.delete(sb.length()-2, sb.length()-1); + } + sb.append("}"); + return sb.toString(); + } + // ino.end +} +// ino.end diff --git a/src/de/dhbwstuttgart/typeinference/unify/CSubstitution.java b/src/de/dhbwstuttgart/typeinference/unify/CSubstitution.java new file mode 100755 index 00000000..f0cca4e8 --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/CSubstitution.java @@ -0,0 +1,252 @@ +// ino.module.CSubstitution.8685.package +package de.dhbwstuttgart.typeinference.unify; +// ino.end + +// ino.module.CSubstitution.8685.import +import java.util.Iterator; +import java.util.Vector; + +import org.apache.log4j.Logger; +// ino.end + + + + + + + + +import de.dhbwstuttgart.myexception.CTypeReconstructionException; +import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; +import de.dhbwstuttgart.syntaxtree.type.Pair; +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.Type; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; + +// ino.class.CSubstitution.27003.description type=javadoc +/** + * Implementierung einer Typsubstitution. Bildet eine zu ersetzende + * TypePlaceholder auf einen Substitutions-Typ ab. Instanzen dieser + * Klasse werden in der Regel aus + * Pair-Objekten erzeugt. + * @author J�rg B�uerle + * @version $Date: 2006/07/10 11:27:04 $ + */ +// ino.end +// ino.class.CSubstitution.27003.declaration +public class CSubstitution +// ino.end +// ino.class.CSubstitution.27003.body +{ + // ino.attribute.m_TypeVar.27006.declaration + private TypePlaceholder m_TypeVar = null; + // ino.end + // ino.attribute.m_Type.27009.declaration + protected Type m_Type = null; + // ino.end + // ino.attribute.inferencelog.27012.declaration + protected static Logger inferencelog = Logger.getLogger("inference"); + // ino.end + // ino.method.CSubstitution.27015.definition + public CSubstitution() + // ino.end + // ino.method.CSubstitution.27015.body + { + this(null, null); + } + // ino.end + + // ino.method.CSubstitution.27018.definition + public CSubstitution(TypePlaceholder typeVar, Type type) + // ino.end + // ino.method.CSubstitution.27018.body + { + m_TypeVar = typeVar; + m_Type = type; + } + // ino.end + + // ino.method.CSubstitution.27021.definition + public CSubstitution(Pair unifier) + throws CTypeReconstructionException + // ino.end + // ino.method.CSubstitution.27021.body + { + if(!(unifier.TA1 instanceof TypePlaceholder)){ + throw new CTypeReconstructionException("Unifier enth�lt keinen Typeplaceholder",unifier.TA1); + } + m_TypeVar = (TypePlaceholder)unifier.TA1; + m_Type = unifier.TA2; + } + // ino.end + + + // ino.method.getType.27024.defdescription type=javadoc + /** + * Author: J�rg B�uerle
+ * @return Returns the Type. + */ + // ino.end + // ino.method.getType.27024.definition + public Type getType() + // ino.end + // ino.method.getType.27024.body + { + return m_Type; + } + // ino.end + + // ino.method.setType.27027.defdescription type=javadoc + /** + * Author: J�rg B�uerle
+ * @param type The Type to set. + */ + // ino.end + // ino.method.setType.27027.definition + public void setType(Type type) + // ino.end + // ino.method.setType.27027.body + { + m_Type = type; + } + // ino.end + + // ino.method.getTypeVar.27030.defdescription type=javadoc + /** + * Author: J�rg B�uerle
+ * @return Returns the TypeVar. + */ + // ino.end + // ino.method.getTypeVar.27030.definition + public Type getTypeVar() + // ino.end + // ino.method.getTypeVar.27030.body + { + return this.m_TypeVar; + } + // ino.end + + // ino.method.setTypeVar.27033.defdescription type=javadoc + /** + * Author: J�rg B�uerle
+ * @param typeVar The TypeVar to set. + */ + // ino.end + // ino.method.setTypeVar.27033.definition + public void setTypeVar(TypePlaceholder typeVar) + // ino.end + // ino.method.setTypeVar.27033.body + { + m_TypeVar = typeVar; + } + // ino.end + + // ino.method.equals.27036.definition + public boolean equals(Object obj) + // ino.end + // ino.method.equals.27036.body + { + if(obj instanceof CSubstitution){ + CSubstitution sub = (CSubstitution)obj; + boolean ret = true; + ret &= (m_TypeVar.equals(sub.m_TypeVar)); + ret &= (m_Type.equals(sub.m_Type)); + return ret; + } + else{ + return false; + } + } + // ino.end + + // ino.method.toString.27039.definition + public String toString() + // ino.end + // ino.method.toString.27039.body + { + //return m_TypeVar.getName() +" --> "+m_Type.getName(); + return m_TypeVar.toString() +" --> "+m_Type.toString(); + } + // ino.end + + // ino.method.clone.27042.definition + public CSubstitution clone() + // ino.end + // ino.method.clone.27042.body + { + CSubstitution copy = new CSubstitution(m_TypeVar.clone(), m_Type.clone()); + return copy; + } + // ino.end + + + // ino.method.applyUnifier.27048.defdescription type=javadoc + /** + * Wendet den Unifier auf die rechte Seite dieser Substitution an. + *
Author: J�rg B�uerle + * @param unifier + */ + // ino.end + // ino.method.applyUnifier.27048.definition + public void applyUnifier(CSubstitutionSet unifier) + // ino.end + // ino.method.applyUnifier.27048.body + { + Iterator pairIt = unifier.getIterator(); + while(pairIt.hasNext()){ + CSubstitution subst = (CSubstitution)pairIt.next(); + + //korrigiert PL 05-07-31 das erste duerfte doch richtig sein. + //subst.setType(this.applySubstitution(subst.getType(), subst)); + this.setType(this.applySubstitution(this.getType(), subst)); + } + + } + // ino.end + + // ino.method.applySubstitution.27051.defdescription type=javadoc + /** + * Wendet die �bergebene Substitution rekursiv auf den �bergebenen Typ an. + *
Author: J�rg B�uerle + * @param type Der zu untersuchende Typ + * @param unifierSub Die anzuwendende Substitution + * @return Den ermittelnden Typ + */ + // ino.end + // ino.method.applySubstitution.27051.definition + private Type applySubstitution(Type type, CSubstitution unifierSub) + // ino.end + // ino.method.applySubstitution.27051.body + { + if(type instanceof TypePlaceholder){ + if(type.equals(unifierSub.getTypeVar())){ + return unifierSub.getType(); + } + } + else if(type instanceof GenericTypeVar){ + if(type.equals(unifierSub.getTypeVar())){ + return unifierSub.getType(); + } + } + else if(type instanceof RefType){ + Vector paras = ((RefType)type).get_ParaList(); + if(paras != null){ + for(int i=0; iTypePlaceholder auf einen Substitutions-Typ ab. Instanzen dieser + * Klasse werden in der Regel aus + * Pair-Objekten erzeugt. + * @author Martin Pl�micke + * @version $Date: 2006/06/13 10:37:32 $ + */ +// ino.end +// ino.class.CSubstitutionGenVar.27057.declaration +public class CSubstitutionGenVar extends CSubstitution +// ino.end +// ino.class.CSubstitutionGenVar.27057.body +{ + // ino.attribute.m_TypeVar.27061.declaration + private GenericTypeVar m_TypeVar = null; + // ino.end + + // ino.method.CSubstitutionGenVar.27064.definition + public CSubstitutionGenVar() + // ino.end + // ino.method.CSubstitutionGenVar.27064.body + { + this(null, null); + } + // ino.end + + // ino.method.CSubstitutionGenVar.27067.definition + public CSubstitutionGenVar(GenericTypeVar typeVar, Type type) + // ino.end + // ino.method.CSubstitutionGenVar.27067.body + { + m_TypeVar = typeVar; + m_Type = type; + } + // ino.end + + // ino.method.getTypeVar.27070.defdescription type=javadoc + /** + * Author: J�rg B�uerle
+ * @return Returns the TypeVar. + */ + // ino.end + // ino.method.getTypeVar.27070.definition + public Type getTypeVar() + // ino.end + // ino.method.getTypeVar.27070.body + { + return this.m_TypeVar; + } + // ino.end + + // ino.method.toString.27073.definition + public String toString() + // ino.end + // ino.method.toString.27073.body + { + return this.m_TypeVar.getName() +" --> "+this.m_Type.getName(); + } + // ino.end +} +// ino.end diff --git a/src/de/dhbwstuttgart/typeinference/unify/CSubstitutionSet.java b/src/de/dhbwstuttgart/typeinference/unify/CSubstitutionSet.java new file mode 100755 index 00000000..889d080b --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/CSubstitutionSet.java @@ -0,0 +1,111 @@ +// ino.module.CSubstitutionSet.8699.package +package de.dhbwstuttgart.typeinference.unify; +// ino.end + +// ino.module.CSubstitutionSet.8699.import +import java.util.Iterator; +import java.util.Vector; + +import de.dhbwstuttgart.myexception.CTypeReconstructionException; +import de.dhbwstuttgart.syntaxtree.type.Pair; +import de.dhbwstuttgart.syntaxtree.type.Type; + +// ino.class.CSubstitutionSet.27471.description type=javadoc +/** + * @author J�rg B�uerle + * @version $Date: 2013/03/27 18:29:34 $ + */ +// ino.end +// ino.class.CSubstitutionSet.27471.declaration +public class CSubstitutionSet extends CVectorSet +// ino.end +// ino.class.CSubstitutionSet.27471.body +{ + // ino.method.CSubstitutionSet.27475.definition + public CSubstitutionSet() + // ino.end + // ino.method.CSubstitutionSet.27475.body + { + super(); + } + // ino.end + + // ino.method.CSubstitutionSet.27478.definition + public CSubstitutionSet(Vector unifiers) + throws CTypeReconstructionException + // ino.end + // ino.method.CSubstitutionSet.27478.body + { + super(); + for(int i=0; i substIter = this.getIterator(); + while(substIter.hasNext()){ + copy.addElement(substIter.next().clone()); + } + return copy; + } + // ino.end + + // ino.method.applyUnifier.27487.defdescription type=javadoc + /** + * Wendet den Unifier auf die rechten Seiten alle Substitutionen an. + *
Author: J�rg B�uerle + * @param unifier + */ + // ino.end + // ino.method.applyUnifier.27487.definition + public void applyUnifier(CSubstitutionSet unifier) + // ino.end + // ino.method.applyUnifier.27487.body + { + Iterator substIt = this.getIterator(); + + while(substIt.hasNext()){ + substIt.next().applyUnifier(unifier); + } + } + // ino.end + + // ino.method.applyThisSubstitutionSet.27490.definition + public Type applyThisSubstitutionSet(Type type) + // ino.end + // ino.method.applyThisSubstitutionSet.27490.body + { + Iterator substIt = this.getIterator(); + Type ty = type; + + while(substIt.hasNext()) { + ty = substIt.next().applyThisSubstitution(ty); + } + return ty; + } + // ino.end + + + public Iterator iterator() { + return this.getIterator(); + } +} +// ino.end diff --git a/src/de/dhbwstuttgart/typeinference/unify/CVectorSet.java b/src/de/dhbwstuttgart/typeinference/unify/CVectorSet.java new file mode 100755 index 00000000..ed35951a --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/unify/CVectorSet.java @@ -0,0 +1,165 @@ +// ino.module.CVectorSet.8702.package +package de.dhbwstuttgart.typeinference.unify; +// ino.end + +// ino.module.CVectorSet.8702.import +import java.util.Iterator; +import java.util.Vector; +// ino.end + +// ino.class.CVectorSet.27519.description type=javadoc +/** + * @author J�rg B�uerle + * @version $Date: 2013/02/07 05:08:51 $ + */ +// ino.end +// ino.class.CVectorSet.27519.declaration +public abstract class CVectorSet extends CSet +// ino.end +// ino.class.CVectorSet.27519.body +{ + // ino.attribute.m_Elements.27523.declaration + private Vector m_Elements = null; + // ino.end + + // ino.method.CVectorSet.27526.definition + public CVectorSet() + // ino.end + // ino.method.CVectorSet.27526.body + { + m_Elements = new Vector(); + } + // ino.end + + // ino.method.addElement.27529.definition + public void addElement(E element) + // ino.end + // ino.method.addElement.27529.body + { + m_Elements.addElement(element); + } + // ino.end + + // ino.method.removeElement.27532.definition + public void removeElement(E element) + // ino.end + // ino.method.removeElement.27532.body + { + m_Elements.addElement(element); + } + // ino.end + + public void addAll( CVectorSet set ) + { + for( int i=0;i getIterator() + // ino.end + // ino.method.getIterator.27535.body + { + return m_Elements.iterator(); + } + // ino.end + + // ino.method.getVector.27538.definition + public Vector getVector() + // ino.end + // ino.method.getVector.27538.body + { + return m_Elements; + } + // ino.end + + // ino.method.setVector.27541.definition + public void setVector(Vector elements) + // ino.end + // ino.method.setVector.27541.body + { + m_Elements = elements; + } + // ino.end + + /** + * Fügt ein CVectorSet an! + * Es handelt sich um eine Vereinigung (es werden keine bereits vorhandenen Elemente übernommen) + * @param anotherSet Das hinzuzufügende CVectorSet (CSet wird ignoriert) + */ + // ino.method.unite.27544.definition + public void unite(CSet anotherSet) + // ino.end + // ino.method.unite.27544.body + { + if(!(anotherSet instanceof CVectorSet)){ + return; + } + CVectorSet vectorSet = (CVectorSet)anotherSet; + + // Elemente der anderen Menge hinzuf�gen: + Iterator it = vectorSet.getIterator(); + while(it.hasNext()){ + E elem = it.next(); + if(!m_Elements.contains(elem)){ + m_Elements.addElement(elem); + } + } + //m_Elements.addAll(vectorSet.m_Elements); + } + // ino.end + + // ino.method.subtract.27547.definition + public void subtract(CSet anotherSet) + // ino.end + // ino.method.subtract.27547.body + { + if(!(anotherSet instanceof CVectorSet)){ + return; + } + CVectorSet vectorSet = (CVectorSet)anotherSet; + + // Elemente der anderen Menge entfernen: + m_Elements.removeAll(vectorSet.m_Elements); + } + // ino.end + + // ino.method.contains.27550.definition + public boolean contains(E element) + // ino.end + // ino.method.contains.27550.body + { + return m_Elements.contains(element); + } + // ino.end + + // ino.method.equals.27553.definition + public boolean equals(Object obj) + // ino.end + // ino.method.equals.27553.body + { + if(obj instanceof CVectorSet){ + CVectorSet tripSet= (CVectorSet)obj; + boolean ret = true; + ret &= (m_Elements.containsAll(tripSet.m_Elements)); + ret &= (tripSet.m_Elements.containsAll(m_Elements)); + return ret; + } + else{ + return false; + } + } + // ino.end + + // ino.method.getCardinality.27556.definition + public int getCardinality() + // ino.end + // ino.method.getCardinality.27556.body + { + return m_Elements.size(); + } + // ino.end +} +// ino.end diff --git a/src/de/dhbwstuttgart/typeinference/unify/Unify.java b/src/de/dhbwstuttgart/typeinference/unify/Unify.java index 5f0ca048..6ac56413 100755 --- a/src/de/dhbwstuttgart/typeinference/unify/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unify/Unify.java @@ -8,14 +8,13 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Vector; -import mycompiler.mytypereconstruction.set.CSubstitutionSet; - import org.apache.log4j.Logger; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.MatchException; import de.dhbwstuttgart.myexception.SCException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.type.BoundedGenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.CRefTypeSet; @@ -32,7 +31,6 @@ 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 diff --git a/src/myJvmDisassembler/.cvsignore b/src/myJvmDisassembler/.cvsignore deleted file mode 100755 index 24602276..00000000 --- a/src/myJvmDisassembler/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -jvmDisassebler.class -*~* -*.class diff --git a/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOLD_2.java b/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOLD_2.java index c5dc6b91..a5a5417f 100755 --- a/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOLD_2.java +++ b/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOLD_2.java @@ -9,9 +9,9 @@ import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; +import de.dhbwstuttgart.typeinference.unify.CSubstitution; import junit.framework.TestCase; import mycompiler.mytypereconstruction.CIntersectionType; -import mycompiler.mytypereconstruction.CSubstitution; import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption; import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; diff --git a/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOld.java b/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOld.java index 59ca47f7..72876e78 100755 --- a/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOld.java +++ b/test/mycompiler/test/notUsedAnymore/AbstractInferenceTestOld.java @@ -12,9 +12,9 @@ import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; +import de.dhbwstuttgart.typeinference.unify.CSubstitution; import junit.framework.TestCase; import mycompiler.mytypereconstruction.CIntersectionType; -import mycompiler.mytypereconstruction.CSubstitution; import mycompiler.mytypereconstruction.typeassumption.CInstVarTypeAssumption; import mycompiler.mytypereconstruction.typeassumption.CLocalVarTypeAssumption; import mycompiler.mytypereconstruction.typeassumption.CMethodTypeAssumption; diff --git a/test/mycompiler/test/unittest/typeReconstructionTest/TrMakeFCTest.java b/test/mycompiler/test/unittest/typeReconstructionTest/TrMakeFCTest.java index f4a62459..adc2c858 100755 --- a/test/mycompiler/test/unittest/typeReconstructionTest/TrMakeFCTest.java +++ b/test/mycompiler/test/unittest/typeReconstructionTest/TrMakeFCTest.java @@ -3,7 +3,6 @@ package mycompiler.test.unittest.typeReconstructionTest; import java.util.Vector; import junit.framework.TestCase; -import mycompiler.mymodifier.Modifiers; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; @@ -13,6 +12,7 @@ import de.dhbwstuttgart.syntaxtree.ClassBody; import de.dhbwstuttgart.syntaxtree.Interface; import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.RefType; diff --git a/test/mycompiler/test/unittest/typeReconstructionTest/TrSubUnifyTest.java b/test/mycompiler/test/unittest/typeReconstructionTest/TrSubUnifyTest.java index 76154140..850ac75d 100755 --- a/test/mycompiler/test/unittest/typeReconstructionTest/TrSubUnifyTest.java +++ b/test/mycompiler/test/unittest/typeReconstructionTest/TrSubUnifyTest.java @@ -4,7 +4,6 @@ package mycompiler.test.unittest.typeReconstructionTest; import java.util.Vector; import junit.framework.TestCase; -import mycompiler.mymodifier.Modifiers; import org.apache.log4j.Logger; import org.apache.log4j.xml.DOMConfigurator; @@ -17,6 +16,7 @@ import de.dhbwstuttgart.syntaxtree.ClassBody; import de.dhbwstuttgart.syntaxtree.Interface; import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.Pair; diff --git a/test/mycompiler/test/unittest/typeReconstructionTest/TrUnifyTest.java b/test/mycompiler/test/unittest/typeReconstructionTest/TrUnifyTest.java index c6fc5538..93a78a82 100755 --- a/test/mycompiler/test/unittest/typeReconstructionTest/TrUnifyTest.java +++ b/test/mycompiler/test/unittest/typeReconstructionTest/TrUnifyTest.java @@ -3,7 +3,6 @@ package mycompiler.test.unittest.typeReconstructionTest; import java.util.Vector; import junit.framework.TestCase; -import mycompiler.mymodifier.Modifiers; import org.apache.log4j.xml.DOMConfigurator; import org.junit.After; @@ -15,6 +14,7 @@ import de.dhbwstuttgart.syntaxtree.ClassBody; import de.dhbwstuttgart.syntaxtree.Interface; import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.syntaxtree.misc.UsedId; +import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.RefType; diff --git a/test/plugindevelopment/InsertSingleTypeTest.java b/test/plugindevelopment/InsertSingleTypeTest.java index ce73fefc..56c735f6 100644 --- a/test/plugindevelopment/InsertSingleTypeTest.java +++ b/test/plugindevelopment/InsertSingleTypeTest.java @@ -12,8 +12,8 @@ import org.junit.Test; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import junit.framework.TestCase; diff --git a/test/plugindevelopment/MartinTestCases/Tester.java b/test/plugindevelopment/MartinTestCases/Tester.java index cd5cbebb..a63eeaf7 100644 --- a/test/plugindevelopment/MartinTestCases/Tester.java +++ b/test/plugindevelopment/MartinTestCases/Tester.java @@ -8,8 +8,8 @@ import org.junit.Test; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import plugindevelopment.TypeInsertTester; import plugindevelopment.TypeInsertTests.MultipleTypesInsertTester; diff --git a/test/plugindevelopment/TRMEqualTest.java b/test/plugindevelopment/TRMEqualTest.java index 65475cec..1c669911 100644 --- a/test/plugindevelopment/TRMEqualTest.java +++ b/test/plugindevelopment/TRMEqualTest.java @@ -11,6 +11,7 @@ import org.junit.Test; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.type.Pair; import de.dhbwstuttgart.syntaxtree.type.RefType; @@ -20,7 +21,6 @@ import de.dhbwstuttgart.syntaxtree.type.Pair.PairOperator; import de.dhbwstuttgart.typeinference.ResultSet; import de.dhbwstuttgart.typeinference.TypeInsertable; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import junit.framework.TestCase; diff --git a/test/plugindevelopment/TypeInsertSetEqualTest.java b/test/plugindevelopment/TypeInsertSetEqualTest.java index ade51473..0f993a54 100644 --- a/test/plugindevelopment/TypeInsertSetEqualTest.java +++ b/test/plugindevelopment/TypeInsertSetEqualTest.java @@ -10,8 +10,8 @@ import org.junit.Test; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; public class TypeInsertSetEqualTest { diff --git a/test/plugindevelopment/TypeInsertTester.java b/test/plugindevelopment/TypeInsertTester.java index a0e79f99..34c35bf6 100644 --- a/test/plugindevelopment/TypeInsertTester.java +++ b/test/plugindevelopment/TypeInsertTester.java @@ -19,8 +19,8 @@ import org.apache.log4j.SimpleLayout; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import junit.framework.TestCase; diff --git a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java index 64233edd..20c32a91 100644 --- a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java +++ b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java @@ -6,8 +6,8 @@ import java.util.Vector; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; import plugindevelopment.TypeInsertTester; diff --git a/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java b/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java index 18cb01a7..7e4cd1eb 100644 --- a/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java +++ b/test/plugindevelopment/TypeInsertTests/OverloadingInsertTest.java @@ -10,8 +10,8 @@ import org.junit.Test; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; public class OverloadingInsertTest { diff --git a/test/syntaxTree/NodeEqualTest.java b/test/syntaxTree/NodeEqualTest.java index 0b4c2073..010cdf8c 100644 --- a/test/syntaxTree/NodeEqualTest.java +++ b/test/syntaxTree/NodeEqualTest.java @@ -8,9 +8,9 @@ import org.junit.Test; import de.dhbwstuttgart.core.MyCompiler; import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.parser.JavaParser.yyException; import de.dhbwstuttgart.syntaxtree.SourceFile; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; -import de.dhbwstuttgart.typeinference.parser.JavaParser.yyException; import junit.framework.TestCase; public class NodeEqualTest extends TestCase{