From 11e149110a02e35c4697db85edf985956c626ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 12 Apr 2016 20:06:22 +0200 Subject: [PATCH 01/26] - OLTest verbessert, ist aber nicht positiv, da Autoboxing fehlt --- .../bytecode/DHBWInstructionFactory.java | 6 +++--- .../syntaxtree/statement/LocalVarDecl.java | 2 +- .../syntaxtree/statement/MethodCall.java | 1 + test/bytecode/types/OL.jav | 2 +- test/bytecode/types/OLTest.java | 12 ++++++------ test/bytecode/types/Overloading.jav | 8 ++++++-- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java index 853ddae1f..c9a60d896 100644 --- a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java +++ b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java @@ -140,12 +140,12 @@ public class DHBWInstructionFactory extends InstructionFactory{ } public LocalVariableInstruction createLoad(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) { - return InstructionFactory.createLoad(bytecodeType, storeIndexes.get(variableName)); + return InstructionFactory.createLoad(bytecodeType, getStoreIndex(variableName)); } public Integer getStoreIndex(String variableName) { if(!storeIndexes.containsKey(variableName)){ - storeIndexes.put(variableName, storeIndexes.size()+1); + storeIndexes.put(variableName, storeIndexes.size()); } return storeIndexes.get(variableName); @@ -160,6 +160,6 @@ public class DHBWInstructionFactory extends InstructionFactory{ } public void resetStoreIndexes() { - storeIndexes = new HashMap<>(); + storeIndexes.clear(); } } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java index a5a319b0c..ee4f45794 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java @@ -431,7 +431,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable @Override public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs) { - // TODO Auto-generated method stub + _cg.getInstructionFactory().getStoreIndex(get_Name()); return new InstructionList(); } } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java b/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java index 7b7b82bbb..affe569df 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/MethodCall.java @@ -326,6 +326,7 @@ public class MethodCall extends Expr public InstructionList genByteCode(ClassGenerator cg, TypeinferenceResultSet rs) { InstructionList il = new InstructionList(); DHBWInstructionFactory _factory = cg.getInstructionFactory(); + //TODO: später wiederherstelln? _factory.resetStoreIndexes(); il.append(receiver.get_Expr().genByteCode(cg, rs)); diff --git a/test/bytecode/types/OL.jav b/test/bytecode/types/OL.jav index 66e95aeb3..f98887b20 100644 --- a/test/bytecode/types/OL.jav +++ b/test/bytecode/types/OL.jav @@ -7,7 +7,7 @@ class OL { class Main { - main(x) { + main(x) { ol; ol = new OL(); return ol.m(x); diff --git a/test/bytecode/types/OLTest.java b/test/bytecode/types/OLTest.java index 4b3692837..a425b77ba 100644 --- a/test/bytecode/types/OLTest.java +++ b/test/bytecode/types/OLTest.java @@ -33,13 +33,13 @@ public class OLTest extends SourceFileBytecodeTest{ URL url = file.toURL(); URL[] urls = new URL[]{url}; - Class stringVector = classLoader.loadClass("Integer"); + Integer integer = new Integer(1); Class[] params = new Class[1]; - params[0] = stringVector; + params[0] = integer.getClass(); Method method = cls.getDeclaredMethod("m", params); - method.invoke(obj, stringVector.newInstance()); + method.invoke(obj, integer); assertTrue(true); }catch(Exception e){ throw new RuntimeException(e); @@ -59,13 +59,13 @@ public class OLTest extends SourceFileBytecodeTest{ URL url = file.toURL(); URL[] urls = new URL[]{url}; - Class stringVector = classLoader.loadClass("Boolean"); + Boolean bool = new Boolean(true); Class[] params = new Class[1]; - params[0] = stringVector; + params[0] = bool.getClass(); Method method = cls.getDeclaredMethod("m", params); - method.invoke(obj, stringVector.newInstance()); + method.invoke(obj, bool); assertTrue(true); }catch(Exception e){ throw new RuntimeException(e); diff --git a/test/bytecode/types/Overloading.jav b/test/bytecode/types/Overloading.jav index 0c0fdb2b3..66a2ad814 100644 --- a/test/bytecode/types/Overloading.jav +++ b/test/bytecode/types/Overloading.jav @@ -10,8 +10,12 @@ class Overloading{ } - main(String[] args) { - new Overloading().method(new Vector ()); + main(String[] args) { + ol; + ol = new Overloading(); + v; + v = new Vector (); + ol.method(v); } } \ No newline at end of file From dfe79a8030d18d2502bef99b9c49b0eeaae6300c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Wed, 13 Apr 2016 19:31:35 +0200 Subject: [PATCH 02/26] Equal Operator implementiert --- .../bytecode/DHBWInstructionFactory.java | 2 +- .../syntaxtree/operator/EqualOp.java | 49 ++++++++++++++++++- .../syntaxtree/operator/Operator.java | 8 ++- .../syntaxtree/statement/Binary.java | 22 +-------- test/bytecode/operators/AddOperator.jav | 9 ++++ test/bytecode/operators/AddOperatorTest.java | 32 ++++++++++++ test/bytecode/operators/EqualOperator.jav | 5 ++ .../bytecode/operators/EqualOperatorTest.java | 32 ++++++++++++ 8 files changed, 135 insertions(+), 24 deletions(-) create mode 100644 test/bytecode/operators/AddOperator.jav create mode 100644 test/bytecode/operators/AddOperatorTest.java create mode 100644 test/bytecode/operators/EqualOperator.jav create mode 100644 test/bytecode/operators/EqualOperatorTest.java diff --git a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java index c9a60d896..5cb139916 100644 --- a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java +++ b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java @@ -145,7 +145,7 @@ public class DHBWInstructionFactory extends InstructionFactory{ public Integer getStoreIndex(String variableName) { if(!storeIndexes.containsKey(variableName)){ - storeIndexes.put(variableName, storeIndexes.size()); + storeIndexes.put(variableName, storeIndexes.size()+1); } return storeIndexes.get(variableName); diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java index 184a85012..89285c6bb 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java @@ -3,16 +3,30 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.end // ino.module.EqualOp.8597.import import java.util.Iterator; -import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.GOTO; +import org.apache.commons.bcel6.generic.IF_ICMPNE; +import org.apache.commons.bcel6.generic.InstructionConstants; +import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.NOP; +import org.apache.commons.bcel6.generic.ObjectType; + +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; +import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.statement.Null; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.typeinference.Pair; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; +import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -31,6 +45,39 @@ public class EqualOp extends RelOp super(offset, variableLength); } // ino.end + + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + InstructionList linkeSeite = operator.expr1.genByteCode(_cg, rs); + linkeSeite.append(_factory.createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + + InstructionList rechteSeite = operator.expr2.genByteCode(_cg, rs); + rechteSeite.append(_factory.createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + + + if(operator.getReturnType().getName().equals(new JavaClassName("String"))){ + throw new TypeinferenceException("Zeichenketten zusammenfügen ist noch nicht unterstützt",this); + } + + linkeSeite.append(rechteSeite); + + //TODO: bytecode (Bis jetzt wird jeder Condition als EQUALS behandelt) + //TODO: bytecode autoboxing + + BranchInstruction if_icmpneInstruction = new IF_ICMPNE(null); + linkeSeite.append(if_icmpneInstruction); + linkeSeite.append(InstructionConstants.ICONST_1); + + BranchInstruction gotoInstruction = new GOTO(null); + + linkeSeite.append(gotoInstruction); + if_icmpneInstruction.setTarget(linkeSeite.append(InstructionConstants.ICONST_0)); + gotoInstruction.setTarget(linkeSeite.append(_factory.createInvoke("java.lang.Boolean", "valueOf", new ObjectType("java.lang.Boolean"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.BOOLEAN}, Constants.INVOKESTATIC))); + + return linkeSeite; + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java index 8639bb8f4..4a2573ba1 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java @@ -5,8 +5,11 @@ package de.dhbwstuttgart.syntaxtree.operator; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; -import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.InstructionList; + +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.bytecode.ClassGenerator; import de.dhbwstuttgart.core.IItemWithOffset; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; @@ -20,6 +23,7 @@ import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.OderConstraint; import de.dhbwstuttgart.typeinference.Pair; import de.dhbwstuttgart.typeinference.SingleConstraint; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; @@ -85,6 +89,8 @@ public abstract class Operator extends SyntaxTreeNode * @return */ public abstract HashMap getReturnTypes(TypeAssumptions ass); + + public abstract InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator); @Override diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java b/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java index 035d4c0aa..f0fd2d9d9 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Binary.java @@ -229,27 +229,7 @@ public JavaCodeResult printJavaCode(ResultSet resultSet) { @Override public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs) { - InstructionList linkeSeite = this.expr1.genByteCode(_cg, rs); - InstructionList rechteSeite = this.expr2.genByteCode(_cg, rs); - if(this.getReturnType().getName().equals(new JavaClassName("String"))){ - throw new TypeinferenceException("Zeichenketten zusammenfügen ist noch nicht unterstützt",this); - } - - linkeSeite.append(rechteSeite); - - //TODO: bytecode (Bis jetzt wird jeder Condition als EQUALS behandelt) - //TODO: bytecode autoboxing - - BranchInstruction if_icmpneInstruction = new IF_ICMPNE(null); - linkeSeite.append(if_icmpneInstruction); - linkeSeite.append(InstructionConstants.ICONST_1); - - BranchInstruction gotoInstruction = new GOTO(null); - - linkeSeite.append(gotoInstruction); - if_icmpneInstruction.setTarget(linkeSeite.append(InstructionConstants.ICONST_0)); - gotoInstruction.setTarget(linkeSeite.append(new NOP())); - return linkeSeite; + return op.genByteCode(_cg, rs, this); } } diff --git a/test/bytecode/operators/AddOperator.jav b/test/bytecode/operators/AddOperator.jav new file mode 100644 index 000000000..d7c79a23f --- /dev/null +++ b/test/bytecode/operators/AddOperator.jav @@ -0,0 +1,9 @@ +class AddOperator{ + Integer method(Integer x){ + return x + x; + } + + Double method(Double x){ + return x + x; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/AddOperatorTest.java b/test/bytecode/operators/AddOperatorTest.java new file mode 100644 index 000000000..53fcc6be5 --- /dev/null +++ b/test/bytecode/operators/AddOperatorTest.java @@ -0,0 +1,32 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class AddOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "AddOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} diff --git a/test/bytecode/operators/EqualOperator.jav b/test/bytecode/operators/EqualOperator.jav new file mode 100644 index 000000000..a51b512a4 --- /dev/null +++ b/test/bytecode/operators/EqualOperator.jav @@ -0,0 +1,5 @@ +class EqualOperator{ + Boolean method(Integer x, Integer y){ + return x == y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/EqualOperatorTest.java b/test/bytecode/operators/EqualOperatorTest.java new file mode 100644 index 000000000..b605799f3 --- /dev/null +++ b/test/bytecode/operators/EqualOperatorTest.java @@ -0,0 +1,32 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class EqualOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "EqualOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} From 9a072014988dbb3c436d41df931b26795c168ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Thu, 14 Apr 2016 12:00:15 +0200 Subject: [PATCH 03/26] And, Or, Plus Operator implementiert --- .../syntaxtree/operator/AndOp.java | 11 ++++ .../syntaxtree/operator/OrOp.java | 54 +++++++++++++++ .../syntaxtree/operator/PlusOp.java | 65 +++++++++++++++++++ test/bytecode/operators/AddOperator.jav | 8 +-- test/bytecode/operators/OROperatorTest.java | 32 +++++++++ test/bytecode/operators/OrOperator.jav | 5 ++ 6 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 test/bytecode/operators/OROperatorTest.java create mode 100644 test/bytecode/operators/OrOperator.jav diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/AndOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/AndOp.java index fdb01d2cb..41e960e21 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/AndOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/AndOp.java @@ -3,11 +3,16 @@ package de.dhbwstuttgart.syntaxtree.operator; import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.InstructionList; + +import de.dhbwstuttgart.bytecode.ClassGenerator; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; +import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.SingleConstraint; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; // ino.class.AndOp.24101.declaration @@ -25,6 +30,12 @@ public class AndOp extends LogOp } // ino.end + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + // TODO Auto-generated method stub + return null; + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/OrOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/OrOp.java index 41bbdac90..3bf1c44fe 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/OrOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/OrOp.java @@ -2,6 +2,19 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.end +import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.GOTO; +import org.apache.commons.bcel6.generic.IFEQ; +import org.apache.commons.bcel6.generic.IFNE; +import org.apache.commons.bcel6.generic.InstructionConstants; +import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.ObjectType; + +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; +import de.dhbwstuttgart.syntaxtree.statement.Binary; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; // ino.class.OrOp.24282.declaration public class OrOp extends LogOp @@ -17,6 +30,47 @@ public class OrOp extends LogOp super(offset,variableLength); } // ino.end + + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + /* + 0: aload_1 + 1: invokevirtual #2 // Method java/lang/Boolean.booleanValue:()Z + 4: ifne 14 + 7: aload_2 + 8: invokevirtual #2 // Method java/lang/Boolean.booleanValue:()Z + 11: ifeq 18 + 14: iconst_1 + 15: goto 19 + 18: iconst_0 + 19: invokestatic #3 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean; + 22: areturn + */ + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + InstructionList il = operator.get_Expr1().genByteCode(_cg, rs); + il.append(_factory.createInvoke("java.lang.Boolean", "booleanValue", org.apache.commons.bcel6.generic.Type.BOOLEAN, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + + BranchInstruction firstTest = new IFNE(null); + il.append(firstTest); + + il.append(operator.get_Expr2().genByteCode(_cg, rs)); + il.append(_factory.createInvoke("java.lang.Boolean", "booleanValue", org.apache.commons.bcel6.generic.Type.BOOLEAN, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + + BranchInstruction secondTest = new IFEQ(null); + il.append(secondTest); + + firstTest.setTarget(il.append(InstructionConstants.ICONST_1)); + + BranchInstruction gotoInstruction = new GOTO(null); + il.append(gotoInstruction); + + secondTest.setTarget(il.append(InstructionConstants.ICONST_0)); + + gotoInstruction.setTarget(il.append(_factory.createInvoke("java.lang.Boolean", "valueOf", new ObjectType("java.lang.Boolean"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.BOOLEAN}, Constants.INVOKESTATIC))); + + return il; + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java index e7d828231..2c2c44aa9 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java @@ -3,10 +3,27 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.end // ino.module.PlusOp.8609.import import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; +import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; +import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.GOTO; +import org.apache.commons.bcel6.generic.IADD; +import org.apache.commons.bcel6.generic.IFEQ; +import org.apache.commons.bcel6.generic.IFNE; +import org.apache.commons.bcel6.generic.InstructionConstants; +import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.InvokeInstruction; +import org.apache.commons.bcel6.generic.ObjectType; + +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; +import de.dhbwstuttgart.syntaxtree.type.Type; @@ -25,5 +42,53 @@ public class PlusOp extends AddOp } // ino.end + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + // TODO Plus Operator ist bis jetzt nur für Integer implementiert + /* + 0: aload_1 + 1: invokevirtual #2 // Method java/lang/Integer.intValue:()I + 4: aload_1 + 5: invokevirtual #2 // Method java/lang/Integer.intValue:()I + 8: iadd + 9: invokestatic #3 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer; + 12: areturn + */ + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2()); + + InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); + + il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), returnType)); + + il.append(getOperator(returnType)); + + il.append(convertValueToObject(_factory, returnType)); + return il; + } + + private String getReturnType(Expr expr1, Expr expr2) { + return "java.lang.Integer"; + } + + private ArithmeticInstruction getOperator(String returnType) { + return new IADD(); + } + private InvokeInstruction convertValueToObject(DHBWInstructionFactory _factory, String returnType) { + if(returnType.equals("java.lang.Integer")){ + return _factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.INT}, Constants.INVOKESTATIC); + }else{ + throw new NotImplementedException(); + } + } + + private InstructionList getInstructionListForOperand(ClassGenerator _cg, TypeinferenceResultSet rs, Expr operand, String returnType){ + InstructionList il = new InstructionList(); + il.append(operand.genByteCode(_cg, rs)); + il.append(_cg.getInstructionFactory().createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + return il; + } + } // ino.end diff --git a/test/bytecode/operators/AddOperator.jav b/test/bytecode/operators/AddOperator.jav index d7c79a23f..ec305c058 100644 --- a/test/bytecode/operators/AddOperator.jav +++ b/test/bytecode/operators/AddOperator.jav @@ -1,9 +1,5 @@ class AddOperator{ - Integer method(Integer x){ - return x + x; - } - - Double method(Double x){ - return x + x; + Integer method(Integer x, Integer y){ + return x + y; } } \ No newline at end of file diff --git a/test/bytecode/operators/OROperatorTest.java b/test/bytecode/operators/OROperatorTest.java new file mode 100644 index 000000000..7c648e882 --- /dev/null +++ b/test/bytecode/operators/OROperatorTest.java @@ -0,0 +1,32 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class OROperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "OrOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} diff --git a/test/bytecode/operators/OrOperator.jav b/test/bytecode/operators/OrOperator.jav new file mode 100644 index 000000000..c10a96e25 --- /dev/null +++ b/test/bytecode/operators/OrOperator.jav @@ -0,0 +1,5 @@ +class OrOperator{ + Boolean method(Boolean x, Boolean y){ + return x || y; + } +} \ No newline at end of file From a23f77c33715cc438dc01229fd0cd7601c3f2bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Thu, 14 Apr 2016 14:36:18 +0200 Subject: [PATCH 04/26] =?UTF-8?q?-Test=20f=C3=BCr=20Variablen=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bytecode/DHBWInstructionFactory.java | 7 ++-- src/de/dhbwstuttgart/syntaxtree/Method.java | 5 +++ test/bytecode/Variable.jav | 8 +++++ test/bytecode/VariableTest.java | 35 +++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 test/bytecode/Variable.jav create mode 100644 test/bytecode/VariableTest.java diff --git a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java index 5cb139916..bc5a3806a 100644 --- a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java +++ b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java @@ -144,8 +144,9 @@ public class DHBWInstructionFactory extends InstructionFactory{ } public Integer getStoreIndex(String variableName) { - if(!storeIndexes.containsKey(variableName)){ - storeIndexes.put(variableName, storeIndexes.size()+1); + if(storeIndexes.get(variableName) == null){ + Integer index = storeIndexes.size()+1; + storeIndexes.put(variableName, index); } return storeIndexes.get(variableName); @@ -160,6 +161,6 @@ public class DHBWInstructionFactory extends InstructionFactory{ } public void resetStoreIndexes() { - storeIndexes.clear(); + //storeIndexes.clear(); } } diff --git a/src/de/dhbwstuttgart/syntaxtree/Method.java b/src/de/dhbwstuttgart/syntaxtree/Method.java index ebed13813..9a59788a5 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/de/dhbwstuttgart/syntaxtree/Method.java @@ -610,6 +610,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable public void genByteCode(ClassGenerator cg, Class classObj) { List typeInterferenceResults = cg.getTypeinferenceResults().getTypeReconstructions(this, cg); + DHBWInstructionFactory _factory = cg.getInstructionFactory(); for(TypeinferenceResultSet t: typeInterferenceResults){ DHBWConstantPoolGen _cp = cg.getConstantPool(); @@ -626,6 +627,10 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable for(FormalParameter parameter : this.parameterlist){ argumentTypes[i] = parameter.getType().getBytecodeType(cg, t); argumentNames[i] = parameter.getIdentifier(); + + + _factory.getStoreIndex(parameter.getIdentifier()); + i++; } } diff --git a/test/bytecode/Variable.jav b/test/bytecode/Variable.jav new file mode 100644 index 000000000..ef9de3312 --- /dev/null +++ b/test/bytecode/Variable.jav @@ -0,0 +1,8 @@ +class Variable{ + public Integer method(Integer parameter){ + Integer lokaleVariable; + lokaleVariable = 2; + + return parameter+lokaleVariable; + } +} \ No newline at end of file diff --git a/test/bytecode/VariableTest.java b/test/bytecode/VariableTest.java new file mode 100644 index 000000000..de3875663 --- /dev/null +++ b/test/bytecode/VariableTest.java @@ -0,0 +1,35 @@ +package bytecode; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Test; + +import org.junit.Ignore; + +import bytecode.SourceFileBytecodeTest; + + +public class VariableTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Variable"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} From 65a1038574595089cdd0279ba178f41165e08496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Thu, 14 Apr 2016 14:53:18 +0200 Subject: [PATCH 05/26] - Speichern einer lokalen Variable unter Verwenung der InstructionFactory --- src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java | 4 ++++ src/de/dhbwstuttgart/syntaxtree/statement/Assign.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java index bc5a3806a..6cf24c88e 100644 --- a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java +++ b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java @@ -143,6 +143,10 @@ public class DHBWInstructionFactory extends InstructionFactory{ return InstructionFactory.createLoad(bytecodeType, getStoreIndex(variableName)); } + public LocalVariableInstruction createStore(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) { + return InstructionFactory.createStore(bytecodeType, getStoreIndex(variableName)); + } + public Integer getStoreIndex(String variableName) { if(storeIndexes.get(variableName) == null){ Integer index = storeIndexes.size()+1; diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java index 9e863d01c..9dfb6560a 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Assign.java @@ -208,7 +208,7 @@ public class Assign extends Expr } */ //Es wird momentan immer von RefType ausgegangen: - il.append(new ASTORE(_factory.getStoreIndex(expr1.get_Name()))); + il.append(_factory.createStore(expr2.getType().getBytecodeType(cg, rs), expr1.get_Name())); return il; } From b70dc71a62e42474a8a809e8ec84d8b8c69ebe89 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Mon, 18 Apr 2016 15:38:47 +0200 Subject: [PATCH 06/26] =?UTF-8?q?Convert=20zu=20FunNTypen=20hinzuf=C3=BCge?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/core/MyCompiler.java | 37 --- src/de/dhbwstuttgart/syntaxtree/Class.java | 2 +- .../dhbwstuttgart/syntaxtree/ClassBody.java | 58 ----- .../syntaxtree/factory/UnifyTypeFactory.java | 44 +++- .../syntaxtree/statement/LocalVarDecl.java | 53 ---- .../syntaxtree/type/GenericClassType.java | 4 +- .../syntaxtree/type/RefType.java | 239 +----------------- .../typeinference/FunNMethod.java | 7 +- .../typeinference/FunVoidNMethod.java | 3 +- .../typeinference/OderConstraint.java | 4 +- src/de/dhbwstuttgart/typeinference/Pair.java | 55 +--- .../typeinference/UndConstraint.java | 6 +- 12 files changed, 75 insertions(+), 437 deletions(-) diff --git a/src/de/dhbwstuttgart/core/MyCompiler.java b/src/de/dhbwstuttgart/core/MyCompiler.java index 1f39fb976..9e84fb527 100755 --- a/src/de/dhbwstuttgart/core/MyCompiler.java +++ b/src/de/dhbwstuttgart/core/MyCompiler.java @@ -209,43 +209,6 @@ public class MyCompiler implements MyCompilerAPI{ return OutputDir; } - /** - * @author Arne Lüdtke - * Ersetzt alle GTVs durch TPHs mit gleichem Namen. Arbeitet Rekursiv. - * ACHTUNG: BACKDOOR CREATE!!! Nur für Testzwecke verwenden. - * @param T - Typ, bei welchem die GTVs ersetzt werden sollen. - */ - public static Type makeGenericTypeVars2TypePlaceHolders(Type T) - { - if(T instanceof RefType) - { - RefType refT = (RefType)T; - if(refT.get_ParaList() != null) - { - Menge paras = refT.get_ParaList(); - for(int i = 0; i get_ParaList() + public List get_ParaList() // ino.end // ino.method.get_ParaList.23101.body { diff --git a/src/de/dhbwstuttgart/syntaxtree/ClassBody.java b/src/de/dhbwstuttgart/syntaxtree/ClassBody.java index 1c96052ff..0dcb76099 100755 --- a/src/de/dhbwstuttgart/syntaxtree/ClassBody.java +++ b/src/de/dhbwstuttgart/syntaxtree/ClassBody.java @@ -85,64 +85,6 @@ Paratyp gesetzt."); } fielddecl.addElement(i); } -// ino.method.is_declared.23188.defdescription type=line -// -// ******************************************************************************************** -// -// ino.end - -// ino.method.is_declared.23188.definition -public boolean is_declared(Type t, Menge classlist) -throws SCClassBodyException -// ino.end -// ino.method.is_declared.23188.body -{ - boolean flag=false; - for(Enumeration e = classlist.elements();e.hasMoreElements();) - { - flag = false; - Class c = e.nextElement(); - -// System.out.println("is_init: vergleiche "+t.get_Type_()+" mit "+c.getName()); - if(c.getName().equals(t.getName())){ -// System.out.println("Klasse "+t.get_Type()+"im Menge classlist gefunden."); - flag = true; - break; - } - } - - if( t instanceof RefType && ((RefType)t).get_ParaList()!=null) - { - if( ((RefType)t).get_ParaList().size() > 0 ) - { - for(Enumeration e1 = ((RefType)t).get_ParaList().elements(); e1.hasMoreElements(); ) - { - try - { - is_declared((Type)e1.nextElement(),classlist); - } - catch(SCClassBodyException ex) - { - throw ex; - } - } - } - } - - if(flag) - return true; - else - { - SCClassBodyException ex = new SCClassBodyException(); - SCExcept e = new SCExcept(); - e.set_error("unbekannte Klasse "+t.getName()+"."); - e.set_function("complete_parahashtable() --> is_declared()"); - e.set_statement(t.getName().toString()); - ex.addException(e); - throw ex; - } -} -// ino.end // ino.method.string_rec.23191.definition static String string_rec(Hashtable ht) diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index 4ba6fee4c..d29765628 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -1,11 +1,14 @@ package de.dhbwstuttgart.syntaxtree.factory; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; import java.util.logging.Logger; import de.dhbwstuttgart.myexception.NotImplementedException; import de.dhbwstuttgart.syntaxtree.NullSyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; +import de.dhbwstuttgart.syntaxtree.type.FunN; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.ObjectType; import de.dhbwstuttgart.syntaxtree.type.RefType; @@ -29,6 +32,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.unify.model.ExtendsType; import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure; +import de.dhbwstuttgart.typeinference.unify.model.FunNType; import de.dhbwstuttgart.typeinference.unify.model.UnifyPair; import de.dhbwstuttgart.typeinference.unify.model.PairOperator; import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType; @@ -67,18 +71,20 @@ public class UnifyTypeFactory { //Es wurde versucht ein Typ umzuwandeln, welcher noch nicht von der Factory abgedeckt ist if(t instanceof GenericTypeVar){ return UnifyTypeFactory.convert((GenericTypeVar)t); - }else if(t instanceof RefType){ - return UnifyTypeFactory.convert((RefType)t); + }else if(t instanceof FunN){ + return UnifyTypeFactory.convert((FunN)t); }else if(t instanceof TypePlaceholder){ return UnifyTypeFactory.convert((TypePlaceholder)t); }else if(t instanceof ExtendsWildcardType){ return UnifyTypeFactory.convert((ExtendsWildcardType)t); }else if(t instanceof SuperWildcardType){ return UnifyTypeFactory.convert((SuperWildcardType)t); + }else if(t instanceof RefType){ + return UnifyTypeFactory.convert((RefType)t); } throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden"); } - + public static UnifyType convert(RefType t){ UnifyType ret; if(t.getParaList() != null && t.getParaList().size() > 0){ @@ -92,6 +98,18 @@ public class UnifyTypeFactory { } return ret; } + + public static UnifyType convert(FunN t){ + UnifyType ret; + Menge params = new Menge<>(); + if(t.getParaList() != null && t.getParaList().size() > 0){ + for(Type pT : t.getParaList()){ + params.add(UnifyTypeFactory.convert(pT)); + } + } + ret = FunNType.getFunNType(new TypeParams(params)); + return ret; + } public static UnifyType convert(TypePlaceholder tph){ return new PlaceholderType(tph.get_Name()); @@ -151,7 +169,15 @@ public class UnifyTypeFactory { } public static Type convert(ReferenceType t) { - return new RefType(t.getName(),null,0); + RefType ret = new RefType(t.getName(),null,0); + ret.set_ParaList(convert(t.getTypeParams())); + return ret; + } + + public static Type convert(FunNType t) { + RefType ret = new RefType(t.getName(),null,0); + ret.set_ParaList(convert(t.getTypeParams())); + return ret; } public static Type convert(SuperType t) { @@ -169,10 +195,20 @@ public class UnifyTypeFactory { } public static Type convert(UnifyType t) { + if(t instanceof FunNType)return convert((FunNType) t); if(t instanceof ReferenceType)return convert((ReferenceType) t); if(t instanceof SuperType)return convert((SuperType) t); if(t instanceof ExtendsType)return convert((ExtendsType) t); if(t instanceof PlaceholderType)return convert((PlaceholderType) t); throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden"); } + + private static List convert(TypeParams typeParams) { + List ret = new ArrayList<>(); + for(UnifyType uT : typeParams){ + ret.add(convert(uT)); + } + return ret; + } + } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java index 5fb393db7..9a4c4ea94 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LocalVarDecl.java @@ -99,59 +99,6 @@ public class LocalVarDecl extends Statement implements TypeInsertable } // ino.end - // ino.method.is_declared.25587.definition - public void is_declared(Type t, Menge classlist) - throws SCStatementException - // ino.end - // ino.method.is_declared.25587.body - { - boolean flag=false; - for(Enumeration e = classlist.elements();e.hasMoreElements();){ - flag = false; - Class c = e.nextElement(); - - // System.out.println("is_init: vergleiche "+t.get_Type_()+" mit "+c.get_classname()); - if(c.getName().equals(t.getName())){ - // System.out.println("Klasse "+t.get_Type()+" im Menge classlist gefunden."); - flag = true; - break; - } - } - - if ( t instanceof RefType ) - { - if(((RefType)t).get_ParaList()!=null) - { - if( ((RefType)t).get_ParaList().size()>0) - { - for(Enumeration e1 = ((RefType)t).get_ParaList().elements();e1.hasMoreElements();) - { - try - { - is_declared((Type)e1.nextElement(),classlist); - } - catch(SCStatementException ex) - { - throw ex; - } - } - } - } - } - - if(!flag) - { - SCStatementException ex = new SCStatementException(); - SCExcept e = new SCExcept(); - e.set_error("unbekannte Klasse "+t.getName()+"."); - e.set_function("complete_parahashtable() --> is_declared()"); - e.set_statement(t.getName().toString()); - ex.addException(e); - throw ex; - } - } - // ino.end - /* // ino.method.check_anz.25590.definition public void check_anz(Type type, Menge paralist, Menge classlist) diff --git a/src/de/dhbwstuttgart/syntaxtree/type/GenericClassType.java b/src/de/dhbwstuttgart/syntaxtree/type/GenericClassType.java index 0df35e3cf..9985f48fd 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/GenericClassType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/GenericClassType.java @@ -1,5 +1,7 @@ package de.dhbwstuttgart.syntaxtree.type; +import java.util.List; + import de.dhbwstuttgart.bytecode.ClassGenerator; import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; @@ -12,7 +14,7 @@ import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; public class GenericClassType extends RefType{ - public GenericClassType(String fullyQualifiedName, Menge parameter, SyntaxTreeNode parent, int offset) { + public GenericClassType(String fullyQualifiedName, List parameter, SyntaxTreeNode parent, int offset) { super(fullyQualifiedName, parameter, parent, offset); } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index d0033d322..1fa47df18 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; +import java.util.List; import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.logger.Logger; @@ -47,7 +48,7 @@ public class RefType extends ObjectType implements IMatchable private boolean IsArray = false; // ino.attribute.parameter.26625.declaration - private Menge parameter = null; + private List parameter = null; // ino.end // ino.attribute.primitiveFlag.29412.decldescription type=javadoc /** @@ -97,7 +98,7 @@ public class RefType extends ObjectType implements IMatchable } // ino.method.RefType.26640.definition - public RefType(String fullyQualifiedName, Menge parameter,SyntaxTreeNode parent, int offset) + public RefType(String fullyQualifiedName, List parameter,SyntaxTreeNode parent, int offset) // ino.end // ino.method.RefType.26640.body { @@ -134,52 +135,6 @@ public class RefType extends ObjectType implements IMatchable this(jName.toString(), parent, offset); } - // ino.method.Type2Key.26646.definition - public String Type2Key() - // ino.end - // ino.method.Type2Key.26646.body - { - if(parameter==null) - { - return name.toString(); - } - else - { - String para = new String(); - for(Enumeration e=parameter.elements();e.hasMoreElements();) - { - String t = ((Type)e.nextElement()).Type2Key(); - if(para.length() > 0) - para = para +", "+ t; - else para = " " + t; - } - return name + "<"+para + " >" ; - } - } - // ino.end - - // ino.method.Type2String.26649.definition - public String Type2String() - // ino.end - // ino.method.Type2String.26649.body - { - if(parameter==null) - { - return name.toString(); - } - else - { - String para = new String(); - for(Enumeration e=parameter.elements();e.hasMoreElements();) - { - String t = ((Type)e.nextElement()).Type2String(); - if(para.length() > 0) - para = para +", "+ t; - else para = " " + t; - } - return name + "<"+para + " >" ; - } - } /** * Wandelt die Parameter des RefTypes in TPHs um, sofern es sich um Generische Variablen handelt. @@ -290,7 +245,7 @@ public class RefType extends ObjectType implements IMatchable * @param v */ // ino.method.set_ParaList.26661.definition - public void set_ParaList(Menge v) + public void set_ParaList(List v) // ino.end // ino.method.set_ParaList.26661.body { @@ -310,7 +265,7 @@ public class RefType extends ObjectType implements IMatchable * @return gibt bei leere Parameterliste null zurück. Ist entscheidend für unify-Algorithmus */ // ino.method.get_ParaList.26664.definition - public Menge get_ParaList() + public List get_ParaList() // ino.end // ino.method.get_ParaList.26664.body { @@ -319,7 +274,7 @@ public class RefType extends ObjectType implements IMatchable } // ino.end - public Menge getParaList(){ + public List getParaList(){ if(this.parameter==null)return new Menge<>(); return this.parameter; } @@ -341,179 +296,7 @@ public class RefType extends ObjectType implements IMatchable // otth: Liefert den Namen des Typs, ohne Parameter, z.B. Stapel bei Stapel return name.toString(); } - // ino.end - // ino.method.getParaN.26673.definition - public String getParaN( int n ) - throws SCException - // ino.end - // ino.method.getParaN.26673.body - { - // otth: liefert n.ten Parameter - if( parameter == null ) - { - throw new SCException(); - } - - if( n >= parameter.size() ) - return ""; - - return ((Type)parameter.elementAt(n)).getName().toString(); - } - // ino.end - - // ino.method.isTV.26676.definition - public boolean isTV( int n ) - // ino.end - // ino.method.isTV.26676.body - { - // otth: Prueft, ob Parameter n eine TV ist - return parameter.elementAt(n) instanceof TypePlaceholder; - } - // ino.end - - - // ino.method.is_Equiv.26679.defdescription type=line - // GenericTypeVar ergaenzt PL 06-03-16 - // ino.end - // ino.method.is_Equiv.26679.definition - public boolean is_Equiv(RefType ty2, Hashtable ht) - // ino.end - // ino.method.is_Equiv.26679.body - { - //vergleicht einen Typ ty2 mit dem aktuellen Typ, ob es bis auf Variablenumbennung - //gleich ist. - //System.out.println("is_EquivSTART: " + this.get_Type()); - //System.out.println("is_EquivSTART: " + ty2.get_Type()); - if (this.getTypeName().equals(ty2.getTypeName())) { - //System.out.println("is_EquivSTARTx: " + this.get_Type()); - if ((get_ParaList() != null) && (ty2.get_ParaList() != null)) { - if (get_ParaList().size() == ty2.get_ParaList().size()) { - for(int i=0; i < get_ParaList().size(); i++) { - Type pty1 = (Type)get_ParaList().elementAt(i); - Type pty2 = (Type)ty2.get_ParaList().elementAt(i); - if ((pty1 instanceof RefType) && (pty2 instanceof RefType)) { - //System.out.println("Instance RefType" + ((RefType)pty1).get_Type()); - //System.out.println("Instance RefType" + ((RefType)pty2).get_Type()); - if (!((RefType)pty1).is_Equiv((RefType)pty2, ht)) return false; - } - else { - if ((pty1 instanceof TypePlaceholder) && (pty2 instanceof TypePlaceholder)) { - //System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty1).get_Type())); - //System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty2).get_Type())); - if (ht.get((((TypePlaceholder)pty1).getName())) != null) { - //System.out.println(ht.get((((TypePlaceholder)pty1).getName()))); - if (!((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().equals(pty2.getName())) return false; - } - else { - //System.out.println("INPUT" + pty1.getName()); - //System.out.println("INPUT" + pty2); - ht.put(pty1.getName(), pty2); - } - } - else { - if ((pty1 instanceof GenericTypeVar) && (pty2 instanceof GenericTypeVar)) { - if (ht.get((((GenericTypeVar)pty1).getName())) != null) { - if (!((GenericTypeVar)ht.get((((GenericTypeVar)pty1).getName()))).getName().equals(pty2.getName())) return false; - } - else { - ht.put(pty1.getName(), pty2); - } - } - else { - return false; - } - } - } - } - return true; - } - else { - return false; - } - } - else { - //Typ ohne Parameter - return true; - } - } - else { - return false; - } - } - // ino.end - - // ino.method.Equiv2Equal.26682.definition - public boolean Equiv2Equal(RefType ty2, Hashtable ht) - // ino.end - // ino.method.Equiv2Equal.26682.body - { - //vergleicht einen Typ ty2 mit dem aktuellen Typ, ob er bis auf Variablenumbennung - //gleich ist und bennent ty2 so um, dass sie gleich sind. - //System.out.println("is_EquivSTART: " + this.getName()); - //System.out.println("is_EquivSTART: " + ty2.getName()); - if (this.getTypeName().equals(ty2.getTypeName())) { - //System.out.println("is_EquivSTARTx: " + this.getName()); - if ((get_ParaList() != null) && (ty2.get_ParaList() != null)) { - if (get_ParaList().size() == ty2.get_ParaList().size()) { - for(int i=0; i < get_ParaList().size(); i++) { - Type pty1 = (Type)get_ParaList().elementAt(i); - Type pty2 = (Type)ty2.get_ParaList().elementAt(i); - if ((pty1 instanceof RefType) && (pty2 instanceof RefType)) { - //System.out.println("Instance RefType" + ((RefType)pty1).getName()); - //System.out.println("Instance RefType" + ((RefType)pty2).getName()); - if (!((RefType)pty1).is_Equiv((RefType)pty2, ht)) return false; - } - else { - if ((pty1 instanceof TypePlaceholder) && (pty2 instanceof TypePlaceholder)) { - //System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty1).getName())); - //System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty2).getName())); - if (ht.get((((TypePlaceholder)pty1).getName())) != null) { - //System.out.println(ht.get((((TypePlaceholder)pty1).getName()))); - if (!((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().equals(pty2.getName())) return false; - else { //Typvariablen gleich machen - // #JB# 11.04.2005 - // ########################################################### - ((TypePlaceholder)pty2).backdoorSetName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().toString()); - //pty2.setName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName()); - // ########################################################### - } - - } - else { - //System.out.println("INPUT" + pty1.getName()); - //System.out.println("INPUT" + pty2); - ht.put(pty1.getName(), pty2); - // #JB# 11.04.2005 - // ########################################################### - ((TypePlaceholder)pty2).backdoorSetName(pty1.getName().toString()); - //pty2.setName(pty1.getName()); - // ########################################################### - } - } - else { - return false; - } - } - } - return true; - } - else { - return false; - } - } - else { - //Typ ohne Parameter - return true; - } - } - else { - return false; - } - } - // ino.end - - // ino.method.equals.26685.defdescription type=javadoc /** * Author: Jrg Buerle
* @param Object @@ -565,11 +348,11 @@ public class RefType extends ObjectType implements IMatchable { if(this.get_ParaList() != null ) { - Menge para = this.get_ParaList(); + List para = this.get_ParaList(); Menge clonepara = new Menge(); for(int i = 0; i< para.size(); i++) { - clonepara.addElement(((Type)para.elementAt(i)).clone()); + clonepara.addElement(((Type)para.get(i)).clone()); } RefType newRefType=new RefType(this.getTypeName(), clonepara,this.getParent(),getOffset()); newRefType.setPrimitiveFlag(this.getPrimitiveFlag()); @@ -598,10 +381,10 @@ public class RefType extends ObjectType implements IMatchable else { String para = new String(); - Enumeration e=parameter.elements(); - while(e.hasMoreElements()) + Iterator e=parameter.iterator(); + while(e.hasNext()) { - Type ty = (Type)e.nextElement(); + Type ty = (Type)e.next(); String t = ty.toString(); if(para.length() > 0) para = para +", "+ t; diff --git a/src/de/dhbwstuttgart/typeinference/FunNMethod.java b/src/de/dhbwstuttgart/typeinference/FunNMethod.java index d7a18ad45..6ac8011eb 100755 --- a/src/de/dhbwstuttgart/typeinference/FunNMethod.java +++ b/src/de/dhbwstuttgart/typeinference/FunNMethod.java @@ -3,6 +3,9 @@ package de.dhbwstuttgart.typeinference; import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.syntaxtree.FormalParameter; + +import java.util.List; + import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.ParameterList; @@ -16,10 +19,10 @@ public class FunNMethod extends Method{ * * @param N - Anzahl der Parameter (Beispiel: Fun2) */ - public FunNMethod(Menge paralist){ + public FunNMethod(List paralist){ super(0); //Hat keinen Offset, da nur theoretisch gedachte Methode int N = paralist.size(); //In der paraliste ist der erste Parameter der Rückgabetyp - this.setType(paralist.firstElement()); + this.setType(paralist.get(0)); this.set_DeclId(new DeclId("apply")); ParameterList pl = new ParameterList(); Menge fpList = new Menge(); diff --git a/src/de/dhbwstuttgart/typeinference/FunVoidNMethod.java b/src/de/dhbwstuttgart/typeinference/FunVoidNMethod.java index bf1d9f411..41bf22426 100644 --- a/src/de/dhbwstuttgart/typeinference/FunVoidNMethod.java +++ b/src/de/dhbwstuttgart/typeinference/FunVoidNMethod.java @@ -1,6 +1,7 @@ package de.dhbwstuttgart.typeinference; import de.dhbwstuttgart.typeinference.Menge; +import java.util.List; import de.dhbwstuttgart.syntaxtree.type.Void; import de.dhbwstuttgart.syntaxtree.FormalParameter; @@ -17,7 +18,7 @@ public class FunVoidNMethod extends Method{ * * @param N - Anzahl der Parameter (Beispiel: Fun2) */ - public FunVoidNMethod(Menge paralist, Class parent){ + public FunVoidNMethod(List paralist, Class parent){ super(0); //Hat keinen Offset, da nur theoretisch gedachte Methode int N = paralist.size(); this.setType(new Void(this, -1)); diff --git a/src/de/dhbwstuttgart/typeinference/OderConstraint.java b/src/de/dhbwstuttgart/typeinference/OderConstraint.java index 9c741ec8a..c3853f839 100755 --- a/src/de/dhbwstuttgart/typeinference/OderConstraint.java +++ b/src/de/dhbwstuttgart/typeinference/OderConstraint.java @@ -59,7 +59,9 @@ public class OderConstraint extends OderMenge{ * @param toAdd */ public void addConstraint(Pair toAdd){ - oderConstraintPairs.add(new SingleConstraint(toAdd)); + UndConstraint uCons = new UndConstraint(); + uCons.addConstraint(toAdd); + oderConstraintPairs.add(uCons); } @Override diff --git a/src/de/dhbwstuttgart/typeinference/Pair.java b/src/de/dhbwstuttgart/typeinference/Pair.java index c31fc6957..b0792868b 100755 --- a/src/de/dhbwstuttgart/typeinference/Pair.java +++ b/src/de/dhbwstuttgart/typeinference/Pair.java @@ -9,6 +9,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Hashtable; +import java.util.List; import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.unify.model.PairOperator; @@ -143,8 +144,8 @@ public class Pair implements Serializable, DeepCloneable RefType RT1=(RefType)TA1; RefType RT2=(RefType)TA2; if(RT1.getTypeName().equals(RT2.getTypeName())){ - Menge v1=RT1.get_ParaList(); - Menge v2=RT2.get_ParaList(); + List v1=RT1.get_ParaList(); + List v2=RT2.get_ParaList(); if(v1==null && v2==null){ return true; }else{ @@ -155,8 +156,8 @@ public class Pair implements Serializable, DeepCloneable return false; }else{ for(int i=0;i ht = new Hashtable(); - //System.out.println((((RefType)TA1).is_Equiv((RefType)p.TA1, ht))); - //System.out.println(((RefType)TA2).is_Equiv((RefType)p.TA2, ht)); - - //Typen boxen, da es sich um TypePlaceholder handeln koennte - Menge hilfsMenge1 = new Menge(); - Menge hilfsMenge2 = new Menge(); - hilfsMenge1.addElement(TA1); - hilfsMenge2.addElement(TA2); - Menge hilfsMenge3 = new Menge(); - Menge hilfsMenge4 = new Menge(); - hilfsMenge3.addElement(p.TA1); - hilfsMenge4.addElement(p.TA2); - //return (((RefType)TA1).is_Equiv((RefType)p.TA1, ht) && ((RefType)TA2).is_Equiv((RefType)p.TA2, ht)); - return (new RefType("dummy", hilfsMenge3,null,-1)).is_Equiv(new RefType("dummy", hilfsMenge1,null,-1), ht) && - (new RefType("dummy", hilfsMenge4,null,-1)).is_Equiv(new RefType("dummy", hilfsMenge2,null,-1), ht); - } - // ino.end - - - // ino.method.isInMenge.26585.definition - public boolean isInMenge( Menge V ) - // ino.end - // ino.method.isInMenge.26585.body - { - // otth: prueft, ob Paar in Vektor liegt - for( int i = 0; i < V.size(); i++ ) - { - if( V.elementAt(i) instanceof Pair ) - { - //if( this.toString().equals( ( (Pair)V.elementAt(i) ).toString() ) ) - if(Pair_isEquiv(V.elementAt(i))) { - return true; - } - } - } - return false; - } - // ino.end - // ino.method.equals.26588.defdescription type=javadoc /** *
Author: J�rg B�uerle diff --git a/src/de/dhbwstuttgart/typeinference/UndConstraint.java b/src/de/dhbwstuttgart/typeinference/UndConstraint.java index a53f09989..bb6914ee4 100755 --- a/src/de/dhbwstuttgart/typeinference/UndConstraint.java +++ b/src/de/dhbwstuttgart/typeinference/UndConstraint.java @@ -33,7 +33,11 @@ public class UndConstraint extends UndMenge { public void addConstraint(Type type, Type rT) { Pair p = new Pair(type, rT); - this.set.add(new EinzelElement(p)); + addConstraint(p); + } + + public void addConstraint(Pair toAdd){ + this.set.add(new EinzelElement(toAdd)); } @Override From 5a7c2310a1a6c9e1438f41130b1aa0f1c73f733a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 19 Apr 2016 14:40:29 +0200 Subject: [PATCH 07/26] =?UTF-8?q?-Test=20f=C3=BCr=20Methodenaufrufe=20und?= =?UTF-8?q?=20Variablen=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/bytecode/ASTBytecodeTest.java | 8 ------- test/bytecode/MethodAndVariable.jav | 18 ++++++++++++++++ test/bytecode/MethodsAndVariableTest.java | 26 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 test/bytecode/MethodAndVariable.jav create mode 100644 test/bytecode/MethodsAndVariableTest.java diff --git a/test/bytecode/ASTBytecodeTest.java b/test/bytecode/ASTBytecodeTest.java index 32fd80888..d2b4af707 100644 --- a/test/bytecode/ASTBytecodeTest.java +++ b/test/bytecode/ASTBytecodeTest.java @@ -56,10 +56,7 @@ public abstract class ASTBytecodeTest { String rootDirectory = getRootDirectory(); - System.out.println(rootDirectory); - JavaClass javaClass = result.getByteCode().getJavaClass(); - System.out.println(javaClass.toString()); javaClass.dump(new File(rootDirectory+javaClass.getClassName()+".class")); for(ClassGenerator cg: result.getByteCode().getExtraClasses().values()){ @@ -68,7 +65,6 @@ public abstract class ASTBytecodeTest { } }catch(Exception e){ - System.out.print(e.getMessage()); throw new RuntimeException(e); } } @@ -91,8 +87,4 @@ public abstract class ASTBytecodeTest { public String getTestName() { return "No Testname defined!"; } - - - - } diff --git a/test/bytecode/MethodAndVariable.jav b/test/bytecode/MethodAndVariable.jav new file mode 100644 index 000000000..2ae7002ed --- /dev/null +++ b/test/bytecode/MethodAndVariable.jav @@ -0,0 +1,18 @@ +class MethodAndVariable{ + public Integer method(Integer parameter){ + Integer lokaleVariable; + lokaleVariable = 2; + + Integer lokaleVariable2; + lokaleVariable2 = method2(lokaleVariable); + + return parameter+lokaleVariable2; + } + + public Integer method2(Integer parameter){ + Integer lokaleVariable; + lokaleVariable = 2; + + return parameter+lokaleVariable; + } +} \ No newline at end of file diff --git a/test/bytecode/MethodsAndVariableTest.java b/test/bytecode/MethodsAndVariableTest.java new file mode 100644 index 000000000..8e0fd808f --- /dev/null +++ b/test/bytecode/MethodsAndVariableTest.java @@ -0,0 +1,26 @@ +package bytecode; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + + +public class MethodsAndVariableTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MethodAndVariable"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} From 8bad95f7744ba10c1590b1f3d6ad40fbb38439b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 19 Apr 2016 15:24:43 +0200 Subject: [PATCH 08/26] -AndOperator erweitert --- test/bytecode/operators/AddOperatorTest.java | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/bytecode/operators/AddOperatorTest.java b/test/bytecode/operators/AddOperatorTest.java index 53fcc6be5..edd2c3e2d 100644 --- a/test/bytecode/operators/AddOperatorTest.java +++ b/test/bytecode/operators/AddOperatorTest.java @@ -29,4 +29,25 @@ public class AddOperatorTest extends SourceFileBytecodeTest{ Object obj = cls.newInstance(); assertTrue(true); } + + @Test + public void testTwoIntegers() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Integer returnValue = (Integer) method.invoke(obj, x, y); + assertEquals(new Integer(3), returnValue); + } } From fcbd05fa9cbb6b1dd81a2419c8d6e26aa03c4a92 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 19 Apr 2016 15:27:46 +0200 Subject: [PATCH 09/26] Im Unify generierte TPH beachten --- .../syntaxtree/factory/UnifyTypeFactory.java | 9 +++++++-- src/de/dhbwstuttgart/syntaxtree/type/RefType.java | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index d29765628..af90b7bda 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -191,7 +191,11 @@ public class UnifyTypeFactory { } public static Type convert(PlaceholderType t) { - return TypePlaceholder.getInstance(t.getName()); + TypePlaceholder ret = TypePlaceholder.getInstance(t.getName()); + if(ret == null){ //Dieser TPH wurde vom Unifikationsalgorithmus erstellt + ret = TypePlaceholder.fresh(t.getName(), NULL_NODE); + } + return ret; } public static Type convert(UnifyType t) { @@ -206,7 +210,8 @@ public class UnifyTypeFactory { private static List convert(TypeParams typeParams) { List ret = new ArrayList<>(); for(UnifyType uT : typeParams){ - ret.add(convert(uT)); + Type toAdd = convert(uT); + ret.add(toAdd); } return ret; } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index 1fa47df18..20e8fe251 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -256,8 +256,6 @@ public class RefType extends ObjectType implements IMatchable else paralist.add(t); }*/ this.parameter = v;//paralist; - //parserlog.debug("T->Type.java->set_ParaList->parameter: " + parameter); - //parserlog.debug("T->Type.java->get_Type: " + getName()); } // ino.end From 1afe2d4d5c7d2785cfea76263c2563e0489923b1 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 20 Apr 2016 18:04:28 +0200 Subject: [PATCH 10/26] =?UTF-8?q?Unn=C3=B6tige=20Kommentare=20l=C3=B6schen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/syntaxtree/Method.java | 216 +------------------- 1 file changed, 4 insertions(+), 212 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/Method.java b/src/de/dhbwstuttgart/syntaxtree/Method.java index c90f7790c..e08c92416 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/de/dhbwstuttgart/syntaxtree/Method.java @@ -2,8 +2,6 @@ package de.dhbwstuttgart.syntaxtree; import java.util.Arrays; -// ino.end -// ino.module.Method.8564.import import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; @@ -65,58 +63,23 @@ import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertPoint; * */ public class Method extends Field implements IItemWithOffset, TypeInsertable -// ino.end -// ino.class.Method.23482.body { - // ino.attribute.block.23488.declaration private Block block; - // ino.end - // ino.attribute.parameterlist.23491.declaration public ParameterList parameterlist = new ParameterList(); - // ino.end - // ino.attribute.exceptionlist.23494.declaration private ExceptionList exceptionlist; - // ino.end - // ino.attribute.returntype.23497.declaration private Type returntype; - // ino.end - - // ino.attribute.genericMethodParameters.23500.decldescription type=javadoc - /** - * HOTI 4.5.06 Dieser Vektor beinhaltet alle Generischen Typen und v.a. die - * F-Bounded-Generics, die die Methode besitzt size()==0, falls es keine - * gibt - */ - // ino.end - // ino.attribute.genericMethodParameters.23500.declaration - // private Menge genericMethodParameters=new - // Menge(); - // ino.end - // ino.attribute.overloadedID.23503.declaration private int overloadedID; - // ino.end - // ino.attribute.isAbstract.23506.declaration private boolean isAbstract = false; - // ino.end - // ino.attribute.types_in_parameterlist.23509.declaration private Menge types_in_parameterlist = new Menge(); - // ino.end - // ino.attribute.m_LineNumber.23512.declaration private int m_LineNumber = MyCompiler.NO_LINENUMBER; - // ino.end private int m_Offset = -1; // hinzugef�gt hoth: 07.04.2006 private Modifiers modifiers; - // ino.attribute.inferencelog.23515.declaration protected static Logger inferencelog = Logger.getLogger("inference"); - // ino.end - // ino.attribute.parserlog.23518.declaration protected static Logger parserlog = Logger.getLogger("parser"); protected Menge createdMethods = new Menge<>(); - // ino.end - public Method(int offset) { super(offset); } @@ -136,51 +99,7 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable this.setReturnType(returnType); } - /* - * // ino.method.setGenericMethodParameters.23521.definition public void - * setGenericMethodParameters(Menge genericMethodParameters) - * // ino.end // ino.method.setGenericMethodParameters.23521.body { - * this.genericMethodParameters=genericMethodParameters; } // ino.end // - * ino.method.getGenericMethodParameters.23524.definition public - * Menge getGenericMethodParameters() // ino.end // - * ino.method.getGenericMethodParameters.23524.body { - * return(genericMethodParameters); } // ino.end - */ - /* - * // ino.method.sc_init_parameterlist.23530.definition public void - * sc_init_parameterlist(boolean ext) // ino.end // - * ino.method.sc_init_parameterlist.23530.body { DeclId hilf=null; - * Menge list; FormalParameter para; String typeofpara; int - * i=1; if(this.getParameterList()!=null) //es gibt Parameter, dann: { - * hilf=declid.elementAt(0); if(ext) - * parserlog.debug("Semantik-Check hat in Methode " - * +hilf.get_Name()+" bergabewerte gefunden:"); - * list=this.getParameterList().sc_get_Formalparalist(); //Menge - * Formalparalist aus FormalParameterList wird zwischen gesichert - * for(Enumeration el2=list.elements(); - * el2.hasMoreElements();) { para=el2.nextElement(); - * typeofpara=para.getTypeName(); if(ext) - * parserlog.debug(" "+i+". Parameter hat Typ "+typeofpara); - * types_in_parameterlist.addElement(typeofpara); //Typ der Parameter werden - * im Menge abgelegt i++; } } else //keine Parameter vorhanden: { if(ext) { - * hilf=declid.elementAt(0); - * parserlog.debug("Semantik-Check hat in Methode " - * +hilf.get_Name()+" keine bergabewerte gefunden."); } } if(ext) { - * parserlog.debug("Semantik-Check hat in Methode "+hilf.get_Name()+" "+ - * types_in_parameterlist.size()+" bergabeparameter gefunden."); - * parserlog.debug - * (" namentlich: "+types_in_parameterlist.toString()); } } // - * ino.end - */ - // ino.method.getTypeName.23533.defdescription type=line - // Eine der beiden Funktionen ist ueberflssig. Wer sich daran strt kann die - // get_ReturnType() auf eigene Gefahr lschen. - // ino.end - - // ino.method.getTypeName.23533.definition public JavaClassName getTypeName() - // ino.end - // ino.method.getTypeName.23533.body { if (this.getType() == null) return null; @@ -188,101 +107,58 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable return this.getType().getName(); } - // ino.end - // ino.method.get_Block.23536.definition public Block get_Block() - // ino.end - // ino.method.get_Block.23536.body { return block; } - // ino.end - // ino.method.setReturnType.23539.defdescription type=javadoc /** *
* Author: Jrg Buerle * * @param type */ - // ino.end - // ino.method.setReturnType.23539.definition private void setReturnType(Type type) - // ino.end - // ino.method.setReturnType.23539.body { this.returntype = type; } - // ino.end - - // ino.method.set_Block.23542.definition public void set_Block(Block blo) - // ino.end - // ino.method.set_Block.23542.body { if (blo.getType() == null) blo.setType(this.returntype); this.block = blo; } - // ino.end - - // ino.method.set_Modifiers.23545.definition public void set_Modifiers(Modifiers modif) - // ino.end - // ino.method.set_Modifiers.23545.body { declid.firstElement().set_Modifiers(modif); this.modifiers = modif; } - // ino.end - - // ino.method.set_ExceptionList.23548.definition public void set_ExceptionList(ExceptionList exlist) - // ino.end - // ino.method.set_ExceptionList.23548.body { this.exceptionlist = exlist; } - // ino.end - - // ino.method.setParameterList.23551.definition public void setParameterList(ParameterList paralist) - // ino.end - // ino.method.setParameterList.23551.body { this.parameterlist = paralist; } - // ino.end - - // ino.method.getParameterList.23554.definition public ParameterList getParameterList() - // ino.end - // ino.method.getParameterList.23554.body { - // otth: gibt die Parameterliste zurueck return this.parameterlist; } - // ino.end - - // ino.method.getParameterCount.23557.defdescription type=javadoc /** * Author: Jrg Buerle
* * @return Die Anzahl der Methoden-Paramater */ - // ino.end - // ino.method.getParameterCount.23557.definition public int getParameterCount() - // ino.end - // ino.method.getParameterCount.23557.body { if (this.getParameterList() == null) return 0; @@ -290,177 +166,94 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable return this.getParameterList().getParameterCount(); } - // ino.end - - // ino.method.get_ExceptionList.23560.definition public ExceptionList get_ExceptionList() - // ino.end - // ino.method.get_ExceptionList.23560.body { // otth: gibt die Exceptionliste zurueck return this.exceptionlist; } - // ino.end - - // ino.method.getOverloadedID.23563.definition public int getOverloadedID() - // ino.end - // ino.method.getOverloadedID.23563.body { return (overloadedID); } - // ino.end - // ino.method.setOverloadedID.23566.definition public void setOverloadedID(int overloadedID) - // ino.end - // ino.method.setOverloadedID.23566.body { this.overloadedID = overloadedID; } - // ino.end - - // ino.method.get_Method_Name.23575.definition public String get_Method_Name() - // ino.end - // ino.method.get_Method_Name.23575.body { DeclId hilf = declid.elementAt(0); return hilf.get_Name(); } - // ino.end - - // ino.method.get_Type_Paralist.23578.definition public Menge get_Type_Paralist() - // ino.end - // ino.method.get_Type_Paralist.23578.body { return types_in_parameterlist; } - // ino.end - - // ino.method.getLineNumber.23584.definition public int getLineNumber() - // ino.end - // ino.method.getLineNumber.23584.body { return m_LineNumber; } - - // ino.end - - // ino.method.setLineNumber.23587.definition + public void setLineNumber(int lineNumber) - // ino.end - // ino.method.setLineNumber.23587.body { m_LineNumber = lineNumber; } - - // ino.end - - // ino.method.getOffset.23590.defdescription type=line - // hinzugef�gt hoth: 07.04.2006 - // ino.end - // ino.method.getOffset.23590.definition + public int getOffset() - // ino.end - // ino.method.getOffset.23590.body { return m_Offset; } - // ino.end - - // ino.method.getVariableLength.23593.definition public int getVariableLength() - // ino.end - // ino.method.getVariableLength.23593.body { return get_Method_Name().length(); } - // ino.end - - // ino.method.setOffset.23596.defdescription type=line - // hinzugef�gt hoth: 07.04.2006 - // ino.end - // ino.method.setOffset.23596.definition public void setOffset(int Offset) - // ino.end - // ino.method.setOffset.23596.body { m_Offset = Offset; } - // ino.end - - // ino.method.getTypeLineNumber.23602.defdescription type=javadoc /** *
* Author: Jrg Buerle * * @return */ - // ino.end - // ino.method.getTypeLineNumber.23602.definition public int getTypeLineNumber() - // ino.end - // ino.method.getTypeLineNumber.23602.body { return this.getLineNumber(); } - - // ino.end - - // ino.method.toString.23605.defdescription type=javadoc + /** *
* Author: Martin Pl�micke * * @return */ - // ino.end - // ino.method.toString.23605.definition public String toString() - // ino.end - // ino.method.toString.23605.body { return this.getType() + " " + this.get_Name() + ((block != null) ? block.toString() : ""); } - // ino.end - - // ino.method.setAbstract.23608.defdescription type=javadoc /** * Legt fuer die ByteCodeGen fest, ob Bytecode innerhalb der Methode * generiert wird. */ - // ino.end - // ino.method.setAbstract.23608.definition public void setAbstract(boolean b) - // ino.end - // ino.method.setAbstract.23608.body { isAbstract = b; } - - // ino.end - - // ino.method.isAbstract.23611.defdescription type=javadoc + /** * Gibt zurueck, ob ByteCode innerhabl der Methode generiert wird. */ - // ino.end - // ino.method.isAbstract.23611.definition public boolean isAbstract() - // ino.end - // ino.method.isAbstract.23611.body { return isAbstract; } @@ -655,4 +448,3 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable } } } -// ino.end From 16cbf8e1b7ddb7a297ce51311cb52939aab9a6e9 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 21 Apr 2016 14:27:32 +0200 Subject: [PATCH 11/26] Fehler bei TPH Generierung behoben --- src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index af90b7bda..e82bdb52a 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -193,7 +193,7 @@ public class UnifyTypeFactory { public static Type convert(PlaceholderType t) { TypePlaceholder ret = TypePlaceholder.getInstance(t.getName()); if(ret == null){ //Dieser TPH wurde vom Unifikationsalgorithmus erstellt - ret = TypePlaceholder.fresh(t.getName(), NULL_NODE); + ret = TypePlaceholder.fresh(NULL_NODE); } return ret; } From 8bda352bc92d888200eefcbc5776a4afc663dcc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Mon, 25 Apr 2016 14:58:52 +0200 Subject: [PATCH 12/26] - Method refactored --- src/de/dhbwstuttgart/syntaxtree/Method.java | 68 ++++++++++----------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/Method.java b/src/de/dhbwstuttgart/syntaxtree/Method.java index 9a59788a5..3dcaf42a4 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/de/dhbwstuttgart/syntaxtree/Method.java @@ -613,45 +613,41 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable DHBWInstructionFactory _factory = cg.getInstructionFactory(); for(TypeinferenceResultSet t: typeInterferenceResults){ - DHBWConstantPoolGen _cp = cg.getConstantPool(); - InstructionList il = new InstructionList(); - Class parentClass = this.getParentClass(); - - //Die Argumentliste generieren: - org.apache.commons.bcel6.generic.Type[] argumentTypes = org.apache.commons.bcel6.generic.Type.NO_ARGS; - String[] argumentNames = new String[]{}; - if(this.parameterlist != null && this.parameterlist.size() > 0){ - argumentTypes = new org.apache.commons.bcel6.generic.Type[this.parameterlist.size()]; - argumentNames = new String[this.parameterlist.size()]; - int i = 0; - for(FormalParameter parameter : this.parameterlist){ - argumentTypes[i] = parameter.getType().getBytecodeType(cg, t); - argumentNames[i] = parameter.getIdentifier(); - - - _factory.getStoreIndex(parameter.getIdentifier()); - - i++; - } - } - - String nameAndSignature = get_Method_Name()+Arrays.toString(argumentTypes); - - Logger.getLogger("nameAndSignature").error(nameAndSignature, Section.CODEGEN); - + addMethodToClassGenerator(cg, _factory, t); + } + } - short constants = Constants.ACC_PUBLIC; //Per Definition ist jede Methode public - if(this.modifiers != null && this.modifiers.includesModifier(new Static())) constants += Constants.ACC_STATIC; - - Type returnType = this.getType(); + private void addMethodToClassGenerator(ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) { + DHBWConstantPoolGen _cp = cg.getConstantPool(); + InstructionList il = new InstructionList(); + + org.apache.commons.bcel6.generic.Type[] argumentTypes = org.apache.commons.bcel6.generic.Type.NO_ARGS; + String[] argumentNames = new String[]{}; + if(this.parameterlist != null && this.parameterlist.size() > 0){ + generateArgumentList(argumentTypes, argumentNames, cg, _factory, t); + } + + short constants = Constants.ACC_PUBLIC; + if(this.modifiers != null && this.modifiers.includesModifier(new Static())) constants += Constants.ACC_STATIC; + + Type returnType = this.getType(); + + MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes , argumentNames, this.get_Method_Name(), getParentClass().name, il, _cp); + + cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block(), t)); + } + + private void generateArgumentList(org.apache.commons.bcel6.generic.Type[] argumentTypes, String[] argumentNames, ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) { + argumentTypes = new org.apache.commons.bcel6.generic.Type[this.parameterlist.size()]; + argumentNames = new String[this.parameterlist.size()]; + int i = 0; + for(FormalParameter parameter : this.parameterlist){ + argumentTypes[i] = parameter.getType().getBytecodeType(cg, t); + argumentNames[i] = parameter.getIdentifier(); - //Methode generieren: - MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes , argumentNames, this.get_Method_Name(), parentClass.name, il, _cp); + _factory.getStoreIndex(parameter.getIdentifier()); - //Methode generieren und anfügen: - cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block(), t)); - - Logger.getLogger("createMethod").debug(this.toString(), Section.CODEGEN); + i++; } } } From 362be98c30b33722d1eec8bed13e46bc8183c2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 26 Apr 2016 15:52:22 +0200 Subject: [PATCH 13/26] =?UTF-8?q?-Test=20f=C3=BCr=20Stackmaptable=20ifstat?= =?UTF-8?q?ement=20verbessert=20-=20IFStatementCreator=20erstellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BCEL/bcelifier/IfStatement.java | 12 ++++ BCEL/bcelifier/IfStatementCreator.java | 71 +++++++++++++++++++ BCEL/bcelifier/JavaToBCEL.java | 20 +++--- test/bytecode/stackmaptable/IfStatement.jav | 10 +-- .../stackmaptable/IfStatementTest.java | 20 ++++-- 5 files changed, 112 insertions(+), 21 deletions(-) create mode 100644 BCEL/bcelifier/IfStatement.java create mode 100644 BCEL/bcelifier/IfStatementCreator.java diff --git a/BCEL/bcelifier/IfStatement.java b/BCEL/bcelifier/IfStatement.java new file mode 100644 index 000000000..8f16e0d4a --- /dev/null +++ b/BCEL/bcelifier/IfStatement.java @@ -0,0 +1,12 @@ +package bcelifier; + +class IfStatement{ + Integer methode(Boolean b){ + if(b){ + return 1; + }else{ + return 2; + } + } + +} \ No newline at end of file diff --git a/BCEL/bcelifier/IfStatementCreator.java b/BCEL/bcelifier/IfStatementCreator.java new file mode 100644 index 000000000..058ca8e9b --- /dev/null +++ b/BCEL/bcelifier/IfStatementCreator.java @@ -0,0 +1,71 @@ +package bcelifier; + +import org.apache.commons.bcel6.generic.*; + +import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.MethodGenerator; +import de.dhbwstuttgart.typeinference.TypeinferenceResults; + +import org.apache.commons.bcel6.*; +import java.io.*; + +public class IfStatementCreator { + private InstructionFactory _factory; + private ConstantPoolGen _cp; + private ClassGen _cg; + + public IfStatementCreator() { + + TypeinferenceResults typeinferenceResults = null; + _cg = new ClassGenerator("bcelifier.IfStatement", new RefType("java.lang.Object", null, 0), "IfStatement.java", Const.ACC_SUPER, new String[] { }, typeinferenceResults); + + _cp = _cg.getConstantPool(); + _factory = new InstructionFactory(_cg, _cp); + } + + public void create(OutputStream out) throws IOException { + createMethod_0(); + createMethod_1(); + _cg.getJavaClass().dump(out); + } + + private void createMethod_0() { + InstructionList il = new InstructionList(); + MethodGen method = new MethodGen(0, Type.VOID, Type.NO_ARGS, new String[] { }, "", "bcelifier.IfStatement", il, _cp); + + InstructionHandle ih_0 = il.append(_factory.createLoad(Type.OBJECT, 0)); + il.append(_factory.createInvoke("java.lang.Object", "", Type.VOID, Type.NO_ARGS, Const.INVOKESPECIAL)); + InstructionHandle ih_4 = il.append(_factory.createReturn(Type.VOID)); + method.setMaxStack(); + method.setMaxLocals(); + _cg.addMethod(method.getMethod()); + } + + private void createMethod_1() { + InstructionList il = new InstructionList(); + MethodGen method = new MethodGenerator(0, new ObjectType("java.lang.Integer"), new Type[] { new ObjectType("java.lang.Boolean") }, new String[] { "arg0" }, "methode", "bcelifier.IfStatement", il, _cp); + + il.append(InstructionFactory.createLoad(Type.OBJECT, 1)); + il.append(_factory.createInvoke("java.lang.Boolean", "booleanValue", Type.BOOLEAN, Type.NO_ARGS, Const.INVOKEVIRTUAL)); + BranchInstruction ifeq_4 = InstructionFactory.createBranchInstruction(Const.IFEQ, null); + il.append(ifeq_4); + il.append(new PUSH(_cp, 1)); + il.append(_factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new Type[] { Type.INT }, Const.INVOKESTATIC)); + il.append(InstructionFactory.createReturn(Type.OBJECT)); + InstructionHandle ih_12 = il.append(new PUSH(_cp, 2)); + il.append(_factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new Type[] { Type.INT }, Const.INVOKESTATIC)); + il.append(InstructionFactory.createReturn(Type.OBJECT)); + ifeq_4.setTarget(ih_12); + method.setMaxStack(); + method.setMaxLocals(); + _cg.addMethod(method.getMethod()); + } + + public static void main(String[] args) throws Exception { + bcelifier.IfStatementCreator creator = new bcelifier.IfStatementCreator(); + creator.create(new FileOutputStream("bcelifier.IfStatement.class")); + + System.out.println("bcelifier.IfStatement.class"); + } +} diff --git a/BCEL/bcelifier/JavaToBCEL.java b/BCEL/bcelifier/JavaToBCEL.java index 2c87bc2f6..0d162b00e 100644 --- a/BCEL/bcelifier/JavaToBCEL.java +++ b/BCEL/bcelifier/JavaToBCEL.java @@ -24,16 +24,16 @@ public class JavaToBCEL { public JavaToBCEL(){ try { //new BCELifier(new ClassParser(rootDirectory+"Lambda1.class").parse(), new FileOutputStream(new File(rootDirectory+"Lambda1Creator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"This.class").parse(), new FileOutputStream(new File(rootDirectory+"ThisCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"IntLiteral.class").parse(), new FileOutputStream(new File(rootDirectory+"IntLiteralCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"MethodCall.class").parse(), new FileOutputStream(new File(rootDirectory+"MethodCallCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"FieldDeclaration.class").parse(), new FileOutputStream(new File(rootDirectory+"FieldDeclarationCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"Null.class").parse(), new FileOutputStream(new File(rootDirectory+"NullCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"LocalVarAccess.class").parse(), new FileOutputStream(new File(rootDirectory+"LocalVarAccessCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"Wildcard.class").parse(), new FileOutputStream(new File(rootDirectory+"WildcardCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"BooleanValue.class").parse(), new FileOutputStream(new File(rootDirectory+"BooleanValueCreator.java"))).start(); - new BCELifier(new ClassParser(rootDirectory+"NewClass.class").parse(), new FileOutputStream(new File(rootDirectory+"NewClassCreator.java"))).start(); - + //new BCELifier(new ClassParser(rootDirectory+"This.class").parse(), new FileOutputStream(new File(rootDirectory+"ThisCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"IntLiteral.class").parse(), new FileOutputStream(new File(rootDirectory+"IntLiteralCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"MethodCall.class").parse(), new FileOutputStream(new File(rootDirectory+"MethodCallCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"FieldDeclaration.class").parse(), new FileOutputStream(new File(rootDirectory+"FieldDeclarationCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"Null.class").parse(), new FileOutputStream(new File(rootDirectory+"NullCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"LocalVarAccess.class").parse(), new FileOutputStream(new File(rootDirectory+"LocalVarAccessCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"Wildcard.class").parse(), new FileOutputStream(new File(rootDirectory+"WildcardCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"BooleanValue.class").parse(), new FileOutputStream(new File(rootDirectory+"BooleanValueCreator.java"))).start(); + //new BCELifier(new ClassParser(rootDirectory+"NewClass.class").parse(), new FileOutputStream(new File(rootDirectory+"NewClassCreator.java"))).start(); + new BCELifier(new ClassParser(rootDirectory+"IfStatement.class").parse(), new FileOutputStream(new File(rootDirectory+"IfStatementCreator.java"))).start(); } catch (ClassFormatException | IOException e) { e.printStackTrace(); } diff --git a/test/bytecode/stackmaptable/IfStatement.jav b/test/bytecode/stackmaptable/IfStatement.jav index ba78a2be7..1451af170 100644 --- a/test/bytecode/stackmaptable/IfStatement.jav +++ b/test/bytecode/stackmaptable/IfStatement.jav @@ -1,10 +1,10 @@ class IfStatement{ -Integer methode(Boolean b){ - if(b){ - return 1; + Integer methode(Boolean b){ + if(b){ + return 1; }else{ - return 2; + return 2; } -} + } } \ No newline at end of file diff --git a/test/bytecode/stackmaptable/IfStatementTest.java b/test/bytecode/stackmaptable/IfStatementTest.java index 18a0a046d..7c10e42b9 100644 --- a/test/bytecode/stackmaptable/IfStatementTest.java +++ b/test/bytecode/stackmaptable/IfStatementTest.java @@ -3,14 +3,22 @@ package bytecode.stackmaptable; import org.junit.Test; import bytecode.SingleClassTester; +import bytecode.SourceFileBytecodeTest; -public class IfStatementTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/stackmaptable/"; - public final static String testFile = "IfStatement.jav"; - public final static String outputFile = "IfStatement.class"; +public class IfStatementTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "IfStatement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/stackmaptable/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } } From 5ac19d7a5950ff326c83221d8b225f13c0f22128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Tue, 26 Apr 2016 16:15:53 +0200 Subject: [PATCH 14/26] - args_size bugfix --- BCEL/bcelifier/IfStatementCreator.java | 4 ++-- .../bytecode/DHBWInstructionFactory.java | 4 ++-- src/de/dhbwstuttgart/syntaxtree/Method.java | 21 ++++++++----------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/BCEL/bcelifier/IfStatementCreator.java b/BCEL/bcelifier/IfStatementCreator.java index 058ca8e9b..88b43e394 100644 --- a/BCEL/bcelifier/IfStatementCreator.java +++ b/BCEL/bcelifier/IfStatementCreator.java @@ -13,7 +13,7 @@ import java.io.*; public class IfStatementCreator { private InstructionFactory _factory; private ConstantPoolGen _cp; - private ClassGen _cg; + private ClassGenerator _cg; public IfStatementCreator() { @@ -32,7 +32,7 @@ public class IfStatementCreator { private void createMethod_0() { InstructionList il = new InstructionList(); - MethodGen method = new MethodGen(0, Type.VOID, Type.NO_ARGS, new String[] { }, "", "bcelifier.IfStatement", il, _cp); + MethodGen method = new MethodGenerator(0, Type.VOID, new Type[] { new ObjectType("java.lang.Boolean") }, new String[] { "arg0" }, "", "bcelifier.IfStatement", il, _cp); InstructionHandle ih_0 = il.append(_factory.createLoad(Type.OBJECT, 0)); il.append(_factory.createInvoke("java.lang.Object", "", Type.VOID, Type.NO_ARGS, Const.INVOKESPECIAL)); diff --git a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java index 6cf24c88e..8b4b9929b 100644 --- a/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java +++ b/src/de/dhbwstuttgart/bytecode/DHBWInstructionFactory.java @@ -139,7 +139,7 @@ public class DHBWInstructionFactory extends InstructionFactory{ return new INVOKEDYNAMIC(index); } - public LocalVariableInstruction createLoad(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) { + public static LocalVariableInstruction createLoad(org.apache.commons.bcel6.generic.Type bytecodeType, String variableName) { return InstructionFactory.createLoad(bytecodeType, getStoreIndex(variableName)); } @@ -147,7 +147,7 @@ public class DHBWInstructionFactory extends InstructionFactory{ return InstructionFactory.createStore(bytecodeType, getStoreIndex(variableName)); } - public Integer getStoreIndex(String variableName) { + public static Integer getStoreIndex(String variableName) { if(storeIndexes.get(variableName) == null){ Integer index = storeIndexes.size()+1; storeIndexes.put(variableName, index); diff --git a/src/de/dhbwstuttgart/syntaxtree/Method.java b/src/de/dhbwstuttgart/syntaxtree/Method.java index 3dcaf42a4..56539df66 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/de/dhbwstuttgart/syntaxtree/Method.java @@ -1,6 +1,7 @@ // ino.module.Method.8564.package package de.dhbwstuttgart.syntaxtree; +import java.util.ArrayList; import java.util.Arrays; // ino.end // ino.module.Method.8564.import @@ -620,9 +621,10 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable private void addMethodToClassGenerator(ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) { DHBWConstantPoolGen _cp = cg.getConstantPool(); InstructionList il = new InstructionList(); - - org.apache.commons.bcel6.generic.Type[] argumentTypes = org.apache.commons.bcel6.generic.Type.NO_ARGS; - String[] argumentNames = new String[]{}; + + ArrayList argumentTypes = new ArrayList(); + ArrayList argumentNames = new ArrayList(); + if(this.parameterlist != null && this.parameterlist.size() > 0){ generateArgumentList(argumentTypes, argumentNames, cg, _factory, t); } @@ -632,22 +634,17 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable Type returnType = this.getType(); - MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes , argumentNames, this.get_Method_Name(), getParentClass().name, il, _cp); + MethodGenerator method = new MethodGenerator(constants, returnType.getBytecodeType(cg, t), argumentTypes.toArray(new org.apache.commons.bcel6.generic.Type[parameterlist.size()]) , argumentNames.toArray(new String[parameterlist.size()]), this.get_Method_Name(), getParentClass().name, il, _cp); cg.addMethod(method.createMethod(cg, getParameterList(), returnType, get_Block(), t)); } - private void generateArgumentList(org.apache.commons.bcel6.generic.Type[] argumentTypes, String[] argumentNames, ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) { - argumentTypes = new org.apache.commons.bcel6.generic.Type[this.parameterlist.size()]; - argumentNames = new String[this.parameterlist.size()]; - int i = 0; + private void generateArgumentList(ArrayList argumentTypes, ArrayList argumentNames, ClassGenerator cg, DHBWInstructionFactory _factory, TypeinferenceResultSet t) { for(FormalParameter parameter : this.parameterlist){ - argumentTypes[i] = parameter.getType().getBytecodeType(cg, t); - argumentNames[i] = parameter.getIdentifier(); + argumentTypes.add(parameter.getType().getBytecodeType(cg, t)); + argumentNames.add(parameter.getIdentifier()); _factory.getStoreIndex(parameter.getIdentifier()); - - i++; } } } From b3e13d09b924d169491d1f7cf2f6ac505a2187c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Wed, 27 Apr 2016 15:08:17 +0200 Subject: [PATCH 15/26] =?UTF-8?q?-=20Alle=20Operatoren=20implementiert=20-?= =?UTF-8?q?=20Tests=20f=C3=BCr=20Sub,=20Mul,=20Div?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../syntaxtree/operator/AddOp.java | 52 +++++++++++++++++- .../syntaxtree/operator/DivideOp.java | 10 ++-- .../syntaxtree/operator/EqualOp.java | 32 +---------- .../syntaxtree/operator/GreaterEquOp.java | 8 +++ .../syntaxtree/operator/GreaterOp.java | 8 +++ .../syntaxtree/operator/LessEquOp.java | 8 +++ .../syntaxtree/operator/LessOp.java | 7 +++ .../syntaxtree/operator/MinusOp.java | 8 ++- .../syntaxtree/operator/ModuloOp.java | 8 +++ .../syntaxtree/operator/MulOp.java | 53 ++++++++++++++++++- .../syntaxtree/operator/NotEqualOp.java | 17 +++--- .../syntaxtree/operator/Operator.java | 9 ++++ .../syntaxtree/operator/PlusOp.java | 49 +---------------- .../syntaxtree/operator/RelOp.java | 51 +++++++++++++++++- .../syntaxtree/operator/TimesOp.java | 8 +++ test/bytecode/operators/DivOperator.jav | 5 ++ test/bytecode/operators/DivOperatorTest.java | 53 +++++++++++++++++++ test/bytecode/operators/MulOperator.jav | 5 ++ test/bytecode/operators/MulOperatorTest.java | 53 +++++++++++++++++++ test/bytecode/operators/SubOperator.jav | 5 ++ test/bytecode/operators/SubOperatorTest.java | 53 +++++++++++++++++++ 21 files changed, 408 insertions(+), 94 deletions(-) create mode 100644 test/bytecode/operators/DivOperator.jav create mode 100644 test/bytecode/operators/DivOperatorTest.java create mode 100644 test/bytecode/operators/MulOperator.jav create mode 100644 test/bytecode/operators/MulOperatorTest.java create mode 100644 test/bytecode/operators/SubOperator.jav create mode 100644 test/bytecode/operators/SubOperatorTest.java diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java index c9e95ee3d..ac4ac40a5 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java @@ -5,8 +5,17 @@ package de.dhbwstuttgart.syntaxtree.operator; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; -import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.IADD; +import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.InvokeInstruction; +import org.apache.commons.bcel6.generic.ObjectType; + +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; @@ -16,8 +25,10 @@ import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.Pair; import de.dhbwstuttgart.typeinference.SingleConstraint; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; +import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -62,5 +73,44 @@ public abstract class AddOp extends Operator return ret; } + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + // TODO Plus Operator ist bis jetzt nur für Integer implementiert + /* + 0: aload_1 + 1: invokevirtual #2 // Method java/lang/Integer.intValue:()I + 4: aload_1 + 5: invokevirtual #2 // Method java/lang/Integer.intValue:()I + 8: iadd + 9: invokestatic #3 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer; + 12: areturn + */ + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2()); + + InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); + + il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), returnType)); + + il.append(getOperator(returnType)); + + il.append(convertValueToObject(_factory, returnType)); + return il; + } + + private String getReturnType(Expr expr1, Expr expr2) { + return "java.lang.Integer"; + } + + abstract ArithmeticInstruction getOperator(String returnType); + + private InvokeInstruction convertValueToObject(DHBWInstructionFactory _factory, String returnType) { + if(returnType.equals("java.lang.Integer")){ + return _factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.INT}, Constants.INVOKESTATIC); + }else{ + throw new NotImplementedException(); + } + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java index 4442e7a99..850d2ba0f 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java @@ -4,6 +4,9 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.DivideOp.8596.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.IDIV; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.statement.Binary; @@ -26,8 +29,9 @@ public class DivideOp extends MulOp } // ino.end - - - + @Override + ArithmeticInstruction getOperator(String returnType) { + return new IDIV(); + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java index 89285c6bb..063be6288 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/EqualOp.java @@ -47,36 +47,8 @@ public class EqualOp extends RelOp // ino.end @Override - public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { - DHBWInstructionFactory _factory = _cg.getInstructionFactory(); - - InstructionList linkeSeite = operator.expr1.genByteCode(_cg, rs); - linkeSeite.append(_factory.createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); - - InstructionList rechteSeite = operator.expr2.genByteCode(_cg, rs); - rechteSeite.append(_factory.createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); - - - if(operator.getReturnType().getName().equals(new JavaClassName("String"))){ - throw new TypeinferenceException("Zeichenketten zusammenfügen ist noch nicht unterstützt",this); - } - - linkeSeite.append(rechteSeite); - - //TODO: bytecode (Bis jetzt wird jeder Condition als EQUALS behandelt) - //TODO: bytecode autoboxing - - BranchInstruction if_icmpneInstruction = new IF_ICMPNE(null); - linkeSeite.append(if_icmpneInstruction); - linkeSeite.append(InstructionConstants.ICONST_1); - - BranchInstruction gotoInstruction = new GOTO(null); - - linkeSeite.append(gotoInstruction); - if_icmpneInstruction.setTarget(linkeSeite.append(InstructionConstants.ICONST_0)); - gotoInstruction.setTarget(linkeSeite.append(_factory.createInvoke("java.lang.Boolean", "valueOf", new ObjectType("java.lang.Boolean"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.BOOLEAN}, Constants.INVOKESTATIC))); - - return linkeSeite; + BranchInstruction getOperator() { + return new IF_ICMPNE(null); } } diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/GreaterEquOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/GreaterEquOp.java index a01e1285f..588c2271a 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/GreaterEquOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/GreaterEquOp.java @@ -4,6 +4,9 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.GreaterEquOp.8598.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.IF_ICMPLT; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.syntaxtree.statement.Binary; @@ -25,6 +28,11 @@ public class GreaterEquOp extends RelOp super(offset,variableLength); } // ino.end + + @Override + BranchInstruction getOperator() { + return new IF_ICMPLT(null); + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/GreaterOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/GreaterOp.java index 97a668249..f6b037dbb 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/GreaterOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/GreaterOp.java @@ -4,6 +4,9 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.GreaterOp.8599.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.IF_ICMPLE; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; @@ -25,5 +28,10 @@ public class GreaterOp extends RelOp } // ino.end + @Override + BranchInstruction getOperator() { + return new IF_ICMPLE(null); + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/LessEquOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/LessEquOp.java index cff4e5044..7a60fa493 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/LessEquOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/LessEquOp.java @@ -4,6 +4,9 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.LessEquOp.8600.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.IF_ICMPGT; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; @@ -25,5 +28,10 @@ public class LessEquOp extends RelOp } // ino.end + @Override + BranchInstruction getOperator() { + return new IF_ICMPGT(null); + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/LessOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/LessOp.java index 2fcc7f11a..5b6722b3f 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/LessOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/LessOp.java @@ -3,6 +3,8 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.end // ino.module.LessOp.8601.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.IF_ICMPGE; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; @@ -25,5 +27,10 @@ public class LessOp extends RelOp } // ino.end + @Override + BranchInstruction getOperator() { + return new IF_ICMPGE(null); + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/MinusOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/MinusOp.java index 3cd233ad3..72313dd6f 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/MinusOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/MinusOp.java @@ -4,6 +4,10 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.MinusOp.8603.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.IADD; +import org.apache.commons.bcel6.generic.ISUB; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; @@ -25,6 +29,8 @@ public class MinusOp extends AddOp } // ino.end - + ArithmeticInstruction getOperator(String returnType) { + return new ISUB(); + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/ModuloOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/ModuloOp.java index 57465f011..d387958e5 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/ModuloOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/ModuloOp.java @@ -4,6 +4,9 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.ModuloOp.8604.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.IREM; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; @@ -25,5 +28,10 @@ public class ModuloOp extends MulOp } // ino.end + @Override + ArithmeticInstruction getOperator(String returnType) { + return new IREM(); + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java index d031b6478..aa1c3b4e3 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java @@ -6,15 +6,26 @@ package de.dhbwstuttgart.syntaxtree.operator; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; -import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.InvokeInstruction; +import org.apache.commons.bcel6.generic.ObjectType; + +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.syntaxtree.statement.Binary; +import de.dhbwstuttgart.syntaxtree.statement.Expr; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.Pair; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; +import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import de.dhbwstuttgart.typeinference.unify.Unify; // ino.class.MulOp.24231.declaration @@ -50,6 +61,44 @@ public abstract class MulOp extends Operator return ret; } - + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + // TODO Plus Operator ist bis jetzt nur für Integer implementiert + /* + 0: aload_1 + 1: invokevirtual #2 // Method java/lang/Integer.intValue:()I + 4: aload_1 + 5: invokevirtual #2 // Method java/lang/Integer.intValue:()I + 8: imul + 9: invokestatic #3 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer; + 12: areturn + */ + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2()); + + InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); + + il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), returnType)); + + il.append(getOperator(returnType)); + + il.append(convertValueToObject(_factory, returnType)); + return il; + } + + private String getReturnType(Expr expr1, Expr expr2) { + return "java.lang.Integer"; + } + + abstract ArithmeticInstruction getOperator(String returnType); + + private InvokeInstruction convertValueToObject(DHBWInstructionFactory _factory, String returnType) { + if(returnType.equals("java.lang.Integer")){ + return _factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.INT}, Constants.INVOKESTATIC); + }else{ + throw new NotImplementedException(); + } + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java index 7cbe39364..0087c9ed5 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.java @@ -3,16 +3,10 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.end // ino.module.NotEqualOp.8606.import import java.util.Iterator; -import de.dhbwstuttgart.typeinference.Menge; -import de.dhbwstuttgart.myexception.CTypeReconstructionException; -import de.dhbwstuttgart.myexception.JVMCodeException; -import de.dhbwstuttgart.syntaxtree.statement.Binary; -import de.dhbwstuttgart.syntaxtree.statement.Expr; -import de.dhbwstuttgart.syntaxtree.statement.Null; -import de.dhbwstuttgart.syntaxtree.type.RefType; -import de.dhbwstuttgart.typeinference.Pair; -import de.dhbwstuttgart.typeinference.unify.Unify; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.IF_ACMPEQ; + // ino.class.NotEqualOp.24241.declaration public class NotEqualOp extends RelOp @@ -28,5 +22,10 @@ public class NotEqualOp extends RelOp } // ino.end + @Override + BranchInstruction getOperator() { + return new IF_ACMPEQ(null); + } + } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java index 4a2573ba1..25267dc1e 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; +import org.apache.commons.bcel6.Constants; import org.apache.commons.bcel6.generic.InstructionList; import de.dhbwstuttgart.typeinference.Menge; @@ -97,5 +98,13 @@ public abstract class Operator extends SyntaxTreeNode public Menge getChildren() { return new Menge<>(); } + + + protected InstructionList getInstructionListForOperand(ClassGenerator _cg, TypeinferenceResultSet rs, Expr operand, String returnType){ + InstructionList il = new InstructionList(); + il.append(operand.genByteCode(_cg, rs)); + il.append(_cg.getInstructionFactory().createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + return il; + } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java index 2c2c44aa9..cff0e1505 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java @@ -41,54 +41,9 @@ public class PlusOp extends AddOp super(offset,variableLength); } // ino.end - - @Override - public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { - // TODO Plus Operator ist bis jetzt nur für Integer implementiert - /* - 0: aload_1 - 1: invokevirtual #2 // Method java/lang/Integer.intValue:()I - 4: aload_1 - 5: invokevirtual #2 // Method java/lang/Integer.intValue:()I - 8: iadd - 9: invokestatic #3 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer; - 12: areturn - */ - DHBWInstructionFactory _factory = _cg.getInstructionFactory(); - - String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2()); - - InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); - - il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), returnType)); - - il.append(getOperator(returnType)); - - il.append(convertValueToObject(_factory, returnType)); - return il; - } - - private String getReturnType(Expr expr1, Expr expr2) { - return "java.lang.Integer"; - } - - private ArithmeticInstruction getOperator(String returnType) { + + ArithmeticInstruction getOperator(String returnType) { return new IADD(); } - private InvokeInstruction convertValueToObject(DHBWInstructionFactory _factory, String returnType) { - if(returnType.equals("java.lang.Integer")){ - return _factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.INT}, Constants.INVOKESTATIC); - }else{ - throw new NotImplementedException(); - } - } - - private InstructionList getInstructionListForOperand(ClassGenerator _cg, TypeinferenceResultSet rs, Expr operand, String returnType){ - InstructionList il = new InstructionList(); - il.append(operand.genByteCode(_cg, rs)); - il.append(_cg.getInstructionFactory().createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); - return il; - } - } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java index eb9178d74..3080ddf21 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/RelOp.java @@ -6,14 +6,24 @@ package de.dhbwstuttgart.syntaxtree.operator; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; -import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.GOTO; +import org.apache.commons.bcel6.generic.InstructionConstants; +import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.ObjectType; + +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.bytecode.ClassGenerator; +import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.typeinference.Pair; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -54,6 +64,45 @@ public abstract class RelOp extends Operator return ret; } + + @Override + public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { + /* + 0: aload_1 + 1: invokevirtual #3 // Method java/lang/Integer.intValue:()I + 4: aload_2 + 5: invokevirtual #3 // Method java/lang/Integer.intValue:()I + 8: if_icmplt 15 + 11: iconst_1 + 12: goto 16 + 15: iconst_0 + 16: invokestatic #2 // Method java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean; + 19: areturn + */ + + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), "java.lang.Boolean"); + + il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), "java.lang.Boolean")); + + BranchInstruction operatorBranchInstruction = getOperator(); + + il.append(operatorBranchInstruction); + + il.append(InstructionConstants.ICONST_1); + + BranchInstruction gotoInstruction = new GOTO(null); + + il.append(gotoInstruction); + + operatorBranchInstruction.setTarget(il.append(InstructionConstants.ICONST_0)); + gotoInstruction.setTarget(il.append(_factory.createInvoke("java.lang.Boolean", "valueOf", new ObjectType("java.lang.Boolean"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.BOOLEAN}, Constants.INVOKESTATIC))); + + return il; + } + + abstract BranchInstruction getOperator(); } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java index 6f47068d5..c43ff29c2 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java @@ -5,6 +5,9 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.TimesOp.8611.import import de.dhbwstuttgart.typeinference.Menge; +import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.IMUL; + import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; @@ -23,5 +26,10 @@ public class TimesOp extends MulOp } // ino.end + @Override + ArithmeticInstruction getOperator(String returnType) { + return new IMUL(); + } + } // ino.end diff --git a/test/bytecode/operators/DivOperator.jav b/test/bytecode/operators/DivOperator.jav new file mode 100644 index 000000000..6ba3d4fe4 --- /dev/null +++ b/test/bytecode/operators/DivOperator.jav @@ -0,0 +1,5 @@ +class DivOperator{ + Integer method(Integer x, Integer y){ + return x / y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/DivOperatorTest.java b/test/bytecode/operators/DivOperatorTest.java new file mode 100644 index 000000000..6b7db4e08 --- /dev/null +++ b/test/bytecode/operators/DivOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class DivOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "DivOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoIntegers() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Integer returnValue = (Integer) method.invoke(obj, x, y); + assertEquals(new Integer(0), returnValue); + } +} diff --git a/test/bytecode/operators/MulOperator.jav b/test/bytecode/operators/MulOperator.jav new file mode 100644 index 000000000..dd08e82e3 --- /dev/null +++ b/test/bytecode/operators/MulOperator.jav @@ -0,0 +1,5 @@ +class MulOperator{ + Integer method(Integer x, Integer y){ + return x * y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/MulOperatorTest.java b/test/bytecode/operators/MulOperatorTest.java new file mode 100644 index 000000000..2c6630210 --- /dev/null +++ b/test/bytecode/operators/MulOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class MulOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MulOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoIntegers() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Integer returnValue = (Integer) method.invoke(obj, x, y); + assertEquals(new Integer(2), returnValue); + } +} diff --git a/test/bytecode/operators/SubOperator.jav b/test/bytecode/operators/SubOperator.jav new file mode 100644 index 000000000..1c5915221 --- /dev/null +++ b/test/bytecode/operators/SubOperator.jav @@ -0,0 +1,5 @@ +class SubOperator{ + Integer method(Integer x, Integer y){ + return x - y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/SubOperatorTest.java b/test/bytecode/operators/SubOperatorTest.java new file mode 100644 index 000000000..a9b3294fd --- /dev/null +++ b/test/bytecode/operators/SubOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class SubOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "SubOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoIntegers() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Integer returnValue = (Integer) method.invoke(obj, x, y); + assertEquals(new Integer(-1), returnValue); + } +} From bbb79b1a1da117e0821b839aba9fb525e1d1cf52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Wed, 27 Apr 2016 15:41:49 +0200 Subject: [PATCH 16/26] =?UTF-8?q?-=20Tests=20f=C3=BCr=20Vergleichsoperator?= =?UTF-8?q?en=20angelegt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bytecode/operators/EqualOperatorTest.java | 28 +++--- .../operators/GreaterEqualOperator.jav | 5 ++ .../operators/GreaterEqualOperatorTest.java | 30 +++++++ test/bytecode/operators/GreaterOperator.jav | 5 ++ .../operators/GreaterOperatorTest.java | 30 +++++++ test/bytecode/operators/ModuloOperator.jav | 5 ++ .../operators/ModuloOperatorTest.java | 53 ++++++++++++ test/bytecode/operators/NotEqualOperator.jav | 5 ++ .../operators/NotEqualOperatorTest.java | 30 +++++++ ...ROperatorTest.java => OrOperatorTest.java} | 2 +- test/bytecode/operators/RelOperatorTest.java | 86 +++++++++++++++++++ .../operators/SmallerEqualOperator.jav | 5 ++ .../operators/SmallerEqualOperatorTest.java | 30 +++++++ test/bytecode/operators/SmallerOperator.jav | 5 ++ .../operators/SmallerOperatorTest.java | 30 +++++++ 15 files changed, 333 insertions(+), 16 deletions(-) create mode 100644 test/bytecode/operators/GreaterEqualOperator.jav create mode 100644 test/bytecode/operators/GreaterEqualOperatorTest.java create mode 100644 test/bytecode/operators/GreaterOperator.jav create mode 100644 test/bytecode/operators/GreaterOperatorTest.java create mode 100644 test/bytecode/operators/ModuloOperator.jav create mode 100644 test/bytecode/operators/ModuloOperatorTest.java create mode 100644 test/bytecode/operators/NotEqualOperator.jav create mode 100644 test/bytecode/operators/NotEqualOperatorTest.java rename test/bytecode/operators/{OROperatorTest.java => OrOperatorTest.java} (91%) create mode 100644 test/bytecode/operators/RelOperatorTest.java create mode 100644 test/bytecode/operators/SmallerEqualOperator.jav create mode 100644 test/bytecode/operators/SmallerEqualOperatorTest.java create mode 100644 test/bytecode/operators/SmallerOperator.jav create mode 100644 test/bytecode/operators/SmallerOperatorTest.java diff --git a/test/bytecode/operators/EqualOperatorTest.java b/test/bytecode/operators/EqualOperatorTest.java index b605799f3..46720335a 100644 --- a/test/bytecode/operators/EqualOperatorTest.java +++ b/test/bytecode/operators/EqualOperatorTest.java @@ -2,31 +2,29 @@ package bytecode.operators; import static org.junit.Assert.*; -import java.io.File; import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.Vector; - -import org.junit.Ignore; import org.junit.Test; - import bytecode.SourceFileBytecodeTest; -public class EqualOperatorTest extends SourceFileBytecodeTest{ +public class EqualOperatorTest extends RelOperatorTest{ @Override protected void init() { testName = "EqualOperator"; rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; } - @Test - public void testConstruct() throws Exception{ - ClassLoader classLoader = getClassLoader(); + @Override + protected Boolean getTest1x2ReturnValue() { + return new Boolean(false); + } + + @Override + protected Boolean getTest2x2ReturnValue() { + return new Boolean(true); + } - Class cls = classLoader.loadClass(testName); - - Object obj = cls.newInstance(); - assertTrue(true); + @Override + protected Boolean getTest2x1ReturnValue() { + return new Boolean(false); } } diff --git a/test/bytecode/operators/GreaterEqualOperator.jav b/test/bytecode/operators/GreaterEqualOperator.jav new file mode 100644 index 000000000..798891f98 --- /dev/null +++ b/test/bytecode/operators/GreaterEqualOperator.jav @@ -0,0 +1,5 @@ +class GreaterEqualOperator{ + Boolean method(Integer x, Integer y){ + return x >= y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/GreaterEqualOperatorTest.java b/test/bytecode/operators/GreaterEqualOperatorTest.java new file mode 100644 index 000000000..41834e73d --- /dev/null +++ b/test/bytecode/operators/GreaterEqualOperatorTest.java @@ -0,0 +1,30 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.lang.reflect.Method; +import org.junit.Test; +import bytecode.SourceFileBytecodeTest; + +public class GreaterEqualOperatorTest extends RelOperatorTest{ + @Override + protected void init() { + testName = "GreaterEqualOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Override + protected Boolean getTest1x2ReturnValue() { + return new Boolean(false); + } + + @Override + protected Boolean getTest2x2ReturnValue() { + return new Boolean(true); + } + + @Override + protected Boolean getTest2x1ReturnValue() { + return new Boolean(true); + } +} diff --git a/test/bytecode/operators/GreaterOperator.jav b/test/bytecode/operators/GreaterOperator.jav new file mode 100644 index 000000000..f2c28682e --- /dev/null +++ b/test/bytecode/operators/GreaterOperator.jav @@ -0,0 +1,5 @@ +class GreaterOperator{ + Boolean method(Integer x, Integer y){ + return x > y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/GreaterOperatorTest.java b/test/bytecode/operators/GreaterOperatorTest.java new file mode 100644 index 000000000..7a5624618 --- /dev/null +++ b/test/bytecode/operators/GreaterOperatorTest.java @@ -0,0 +1,30 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.lang.reflect.Method; +import org.junit.Test; +import bytecode.SourceFileBytecodeTest; + +public class GreaterOperatorTest extends RelOperatorTest{ + @Override + protected void init() { + testName = "GreaterOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Override + protected Boolean getTest1x2ReturnValue() { + return new Boolean(false); + } + + @Override + protected Boolean getTest2x2ReturnValue() { + return new Boolean(false); + } + + @Override + protected Boolean getTest2x1ReturnValue() { + return new Boolean(true); + } +} diff --git a/test/bytecode/operators/ModuloOperator.jav b/test/bytecode/operators/ModuloOperator.jav new file mode 100644 index 000000000..6a17f28ef --- /dev/null +++ b/test/bytecode/operators/ModuloOperator.jav @@ -0,0 +1,5 @@ +class ModuloOperator{ + Integer method(Integer x, Integer y){ + return x % y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/ModuloOperatorTest.java b/test/bytecode/operators/ModuloOperatorTest.java new file mode 100644 index 000000000..5c0c600fe --- /dev/null +++ b/test/bytecode/operators/ModuloOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class ModuloOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "ModuloOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoIntegers() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Integer returnValue = (Integer) method.invoke(obj, x, y); + assertEquals(new Integer(1), returnValue); + } +} diff --git a/test/bytecode/operators/NotEqualOperator.jav b/test/bytecode/operators/NotEqualOperator.jav new file mode 100644 index 000000000..68c8a1681 --- /dev/null +++ b/test/bytecode/operators/NotEqualOperator.jav @@ -0,0 +1,5 @@ +class NotEqualOperator{ + Boolean method(Integer x, Integer y){ + return x != y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/NotEqualOperatorTest.java b/test/bytecode/operators/NotEqualOperatorTest.java new file mode 100644 index 000000000..89b2d871d --- /dev/null +++ b/test/bytecode/operators/NotEqualOperatorTest.java @@ -0,0 +1,30 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.lang.reflect.Method; +import org.junit.Test; +import bytecode.SourceFileBytecodeTest; + +public class NotEqualOperatorTest extends RelOperatorTest{ + @Override + protected void init() { + testName = "NotEqualOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Override + protected Boolean getTest1x2ReturnValue() { + return new Boolean(true); + } + + @Override + protected Boolean getTest2x2ReturnValue() { + return new Boolean(false); + } + + @Override + protected Boolean getTest2x1ReturnValue() { + return new Boolean(true); + } +} diff --git a/test/bytecode/operators/OROperatorTest.java b/test/bytecode/operators/OrOperatorTest.java similarity index 91% rename from test/bytecode/operators/OROperatorTest.java rename to test/bytecode/operators/OrOperatorTest.java index 7c648e882..8d8faaa96 100644 --- a/test/bytecode/operators/OROperatorTest.java +++ b/test/bytecode/operators/OrOperatorTest.java @@ -13,7 +13,7 @@ import org.junit.Test; import bytecode.SourceFileBytecodeTest; -public class OROperatorTest extends SourceFileBytecodeTest{ +public class OrOperatorTest extends SourceFileBytecodeTest{ @Override protected void init() { testName = "OrOperator"; diff --git a/test/bytecode/operators/RelOperatorTest.java b/test/bytecode/operators/RelOperatorTest.java new file mode 100644 index 000000000..59f3ded7d --- /dev/null +++ b/test/bytecode/operators/RelOperatorTest.java @@ -0,0 +1,86 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.lang.reflect.Method; +import org.junit.Test; +import bytecode.SourceFileBytecodeTest; + +public abstract class RelOperatorTest extends SourceFileBytecodeTest{ + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void test1x2() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Boolean returnValue = (Boolean) method.invoke(obj, x, y); + assertEquals(getTest1x2ReturnValue(), returnValue); + } + + @Test + public void test2x2() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(2); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Boolean returnValue = (Boolean) method.invoke(obj, x, y); + assertEquals(getTest2x2ReturnValue(), returnValue); + } + + @Test + public void test2x1() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(2); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Boolean returnValue = (Boolean) method.invoke(obj, x, y); + assertEquals(getTest2x1ReturnValue(), returnValue); + } + + protected abstract Boolean getTest1x2ReturnValue(); + protected abstract Boolean getTest2x2ReturnValue(); + protected abstract Boolean getTest2x1ReturnValue(); +} diff --git a/test/bytecode/operators/SmallerEqualOperator.jav b/test/bytecode/operators/SmallerEqualOperator.jav new file mode 100644 index 000000000..b0448dbac --- /dev/null +++ b/test/bytecode/operators/SmallerEqualOperator.jav @@ -0,0 +1,5 @@ +class SmallerEqualOperator{ + Boolean method(Integer x, Integer y){ + return x <= y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/SmallerEqualOperatorTest.java b/test/bytecode/operators/SmallerEqualOperatorTest.java new file mode 100644 index 000000000..d4da5f6f7 --- /dev/null +++ b/test/bytecode/operators/SmallerEqualOperatorTest.java @@ -0,0 +1,30 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.lang.reflect.Method; +import org.junit.Test; +import bytecode.SourceFileBytecodeTest; + +public class SmallerEqualOperatorTest extends RelOperatorTest{ + @Override + protected void init() { + testName = "SmallerEqual"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Override + protected Boolean getTest1x2ReturnValue() { + return new Boolean(true); + } + + @Override + protected Boolean getTest2x2ReturnValue() { + return new Boolean(true); + } + + @Override + protected Boolean getTest2x1ReturnValue() { + return new Boolean(false); + } +} diff --git a/test/bytecode/operators/SmallerOperator.jav b/test/bytecode/operators/SmallerOperator.jav new file mode 100644 index 000000000..5ddc8c911 --- /dev/null +++ b/test/bytecode/operators/SmallerOperator.jav @@ -0,0 +1,5 @@ +class SmallerOperator{ + Boolean method(Integer x, Integer y){ + return x < y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/SmallerOperatorTest.java b/test/bytecode/operators/SmallerOperatorTest.java new file mode 100644 index 000000000..2609b70f6 --- /dev/null +++ b/test/bytecode/operators/SmallerOperatorTest.java @@ -0,0 +1,30 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.lang.reflect.Method; +import org.junit.Test; +import bytecode.SourceFileBytecodeTest; + +public class SmallerOperatorTest extends RelOperatorTest{ + @Override + protected void init() { + testName = "Smaller"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Override + protected Boolean getTest1x2ReturnValue() { + return new Boolean(true); + } + + @Override + protected Boolean getTest2x2ReturnValue() { + return new Boolean(false); + } + + @Override + protected Boolean getTest2x1ReturnValue() { + return new Boolean(false); + } +} From a31e7b11082d5527e8a4098617cecfcc587f91a9 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 28 Apr 2016 15:32:12 +0200 Subject: [PATCH 17/26] BCEL Framework aktualisiert. FunN Typen implementieren --- lib/commons-bcel6-6.0-SNAPSHOT.jar | Bin 687884 -> 690312 bytes .../bytecode/MethodGenerator.java | 2 +- .../statement/LambdaExpression.java | 33 +++--------------- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/lib/commons-bcel6-6.0-SNAPSHOT.jar b/lib/commons-bcel6-6.0-SNAPSHOT.jar index 11dcfef952c96f29f7af759a67a2861cc8b6e8f2..d84ca41f5bd28147a9a57a5898bed88d1037bbe1 100644 GIT binary patch delta 34922 zcmZTQ2Rv2%``pF7_TD>tk3f-uM0e-#)#!^BvEAp6~a3pXYq<{1U$zFF|8!h{h1eNdM8rC&$z5L(@V(O3K89 zJLV|__ayVXv~K-n?p}$PWEw7%DYi|`OnegwRq{Ng(`K=}p?Y|0aO=+FNngGF-^nFD zns29EP|LfNd`k|eFim}wQ2VU=;7a+xz4*Psr+|6Wg7P|=;@)D;sY-l zDMmgTO_$*91@T8VKXKd`R0@ig-X`?*5~sH0J<9ur*?a_fFZev$D4wu%c{=S8dRuUx zP}=9G)Za6-Z$7Z~98mMRd>G77e#0k|$ezNl)US7YT`(z{y6FY3my*%(=DCk~;sf&0 zUs-etWdTER^Dj>{*sT`r3^#u|Synf^IdoZvhIok|A#FE8Hi z?TvJ&R_;pfTMG0tyLfcRht8vN<-Ur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b/src/de/dhbwstuttgart/bytecode/MethodGenerator.java index 887766cec..d374f3f68 100644 --- a/src/de/dhbwstuttgart/bytecode/MethodGenerator.java +++ b/src/de/dhbwstuttgart/bytecode/MethodGenerator.java @@ -74,7 +74,7 @@ public class MethodGenerator extends MethodGen{ method.addAttribute(factory.createSignatureAttribute(paramTypesSig+retTypeSig)); - StackMap stackMap = new StackMapTableGen(this.getInstructionList(), cp).getStackMap(); + StackMap stackMap = new StackMapTableGen(this, cp).getStackMap(); if(stackMap != null)method.addCodeAttribute(stackMap); return method.getMethod(); diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java b/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java index 4acaa018d..04900cb0c 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/LambdaExpression.java @@ -164,38 +164,13 @@ public class LambdaExpression extends Expr{ ret.add(method_body.TYPEStmt(ArgumentAssumptions.add(assumptions))); //Es gibt die LambdaExpression nur mit einem Block als Method Body, nicht mit einer einzelnen Expression //Die Constraints für ParameterTypen und Ret Typ erstellen: - Menge modifiedParamTypes = new Menge<>(); - for(Type pT : paramTypes){ - if(pT instanceof WildcardType){ - //Auf Typfehler kontrollieren. Siehe Bug #12 Kommentar 3 - if(pT instanceof ExtendsWildcardType){ - throw new TypeinferenceException("Typfehler von Parametertyp "+pT,this); - }else{ - modifiedParamTypes.add(pT); - } - }else{ - modifiedParamTypes.add(new SuperWildcardType((ObjectType) pT)); - } - } + Type retType = method_body.getType(); - // PN < TPH PN - if(retType instanceof WildcardType){ - //Auf Typfehler kontrollieren. Siehe Bug #12 Kommentar 3 - if(retType instanceof SuperWildcardType){ - throw new TypeinferenceException("Typfehler von Parametertyp "+retType,this); - }else{ - //retType bleibt unverändert - } - }else{ - //Die LambdaExpression kann zu diesem Zeit schon feststellen, ob der Return-Type Void ist (Kein Return-Statement): - if(!typeIsVoid(retType)){ //Nur, wenn es nicht void ist, kann der ExtendsWildcardType gebildet werden. - retType = new ExtendsWildcardType((ObjectType) retType); - } - } + if(typeIsVoid(retType)){//In diesem Fall, muss der Typ des LambdaAusdrucks FunVoid sein - this.lambdaType = new FunVoidN(modifiedParamTypes); + this.lambdaType = new FunVoidN(paramTypes); }else{ - this.lambdaType = new FunN(retType, modifiedParamTypes); + this.lambdaType = new FunN(retType, paramTypes); } ret.add(ConstraintsSet.createSingleConstraint(lambdaType.TYPE(assumptions, this),this.getType().TYPE(assumptions, this))); From 324864f8d8c9ed0083b238b5d96db4527ec61198 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 29 Apr 2016 04:00:46 +0200 Subject: [PATCH 18/26] FunN Typen werden zu den entsprechenden UnifyTypen konvertiert --- .../syntaxtree/factory/UnifyTypeFactory.java | 3 +- .../dhbwstuttgart/syntaxtree/type/FunN.java | 45 ++++++++++++------- .../typeinference/FunNInterface.java | 13 ++++++ .../assumptions/TypeAssumptions.java | 12 ----- .../MultipleTypesInsertTester.java | 3 +- 5 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index c6a2f5b3b..ed809c631 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -124,7 +124,8 @@ public class UnifyTypeFactory { } public static UnifyType convert(GenericTypeVar t){ - return new PlaceholderType(t.get_Name()); + //return new PlaceholderType(t.get_Name()); + return new ReferenceType(t.get_Name()); } public static UnifyConstraintsSet convert(ConstraintsSet constraints) { diff --git a/src/de/dhbwstuttgart/syntaxtree/type/FunN.java b/src/de/dhbwstuttgart/syntaxtree/type/FunN.java index efe96c263..b2d277922 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/FunN.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/FunN.java @@ -1,15 +1,20 @@ package de.dhbwstuttgart.syntaxtree.type; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; + import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.bytecode.ClassGenerator; import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Method; import de.dhbwstuttgart.syntaxtree.ParameterList; +import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.exceptions.DebugException; /** * @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke @@ -23,7 +28,7 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; public class FunN extends RefType { private Type R; - private Menge T; + private List T; /** * @author Andreas Stadelmeier, a10023 @@ -33,7 +38,7 @@ public class FunN extends RefType { * @param T * @return */ - public FunN(Type R, Menge T) { + public FunN(Type R, List T) { super("",null,0); if(T==null || R == null)throw new NullPointerException(); setT(T); @@ -44,11 +49,11 @@ public class FunN extends RefType { /** * Spezieller Konstruktor um eine FunN ohne Returntype zu generieren */ - protected FunN(Menge T){ + protected FunN(List list){ super("",null,0); - if(T==null)throw new NullPointerException(); - setT(T); - this.name = new JavaClassName("Fun"+T.size());//getName(); + if(list==null)throw new NullPointerException(); + setT(list); + this.name = new JavaClassName("Fun"+list.size());//getName(); } /** @@ -68,15 +73,6 @@ public class FunN extends RefType { setT(t); this.name = new JavaClassName("Fun"+parameterCount); - /* - Menge t = new Menge(); - for(int i=0;i t = new Menge(); if(R!=null)t.add(R); if(T!=null)t.addAll(T); + for(Type type : t){ + if(type instanceof WildcardType){ + throw new DebugException("Der FunN-Typ darf keine Wildcards in den Parameter enthalten"); + } + } this.set_ParaList(t); } - protected void setT(Menge T){ - this.T = T; + protected void setT(List list){ + this.T = list; calculateNewParalist(); } protected void setR(Type R){ @@ -137,6 +138,16 @@ public class FunN extends RefType { return ret; } + @Override + public Type TYPE(TypeAssumptions ass, SyntaxTreeNode parent){ + //FunN Typen müssen nicht geprüft werden. Sie werden schließlich nur von unserem Typinferenzalgorithmus erstellt: + List paraList = new ArrayList<>(); + for(Type t : this.T){ + paraList.add(t.TYPE(ass, parent)); + } + FunN ret = new FunN(this.R.TYPE(ass, parent),paraList); + return ret; + } /* public CMethodTypeAssumption toCMethodTypeAssumption() { diff --git a/src/de/dhbwstuttgart/typeinference/FunNInterface.java b/src/de/dhbwstuttgart/typeinference/FunNInterface.java index 920b4899f..5a8e72803 100644 --- a/src/de/dhbwstuttgart/typeinference/FunNInterface.java +++ b/src/de/dhbwstuttgart/typeinference/FunNInterface.java @@ -2,9 +2,12 @@ package de.dhbwstuttgart.typeinference; import de.dhbwstuttgart.typeinference.Menge; +import java.util.List; + import de.dhbwstuttgart.parser.JavaClassName; import de.dhbwstuttgart.syntaxtree.Class; import de.dhbwstuttgart.syntaxtree.modifier.Modifiers; +import de.dhbwstuttgart.syntaxtree.type.FunN; import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar; import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.Type; @@ -78,5 +81,15 @@ public class FunNInterface extends Class{ return new FunNMethod(this.get_ParaList()); //return new FunNMethod(this.get_ParaList().size()-1); } + + @Override + public RefType getType() { + List paraList = this.get_ParaList(); + Type R = paraList.get(0); + paraList.remove(0); + return new FunN(R, paraList); + } + + } diff --git a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java index 7ece0a816..fe59bbd27 100755 --- a/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java +++ b/src/de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.java @@ -257,18 +257,6 @@ public class TypeAssumptions { * @return null, falls der Typ nicht vorhanden ist. */ public Type getTypeFor(Type t, SyntaxTreeNode inNode){ - /* - if(t instanceof WildcardType){ - WildcardType wt = (WildcardType)t; - Type innerType = wt.GetWildcardType(); - innerType = getTypeFor(innerType, t).getType(); - wt.SetWildcardType(innerType); - return new ConstraintType(wt); - } - - if(t instanceof TypePlaceholder) - return new ConstraintType((TypePlaceholder)t); //Handelt es sich um einen TypePlaceholder kann dieser nicht in den Assumptions vorkommen. - */ //Alle bekannten Klassen nach diesem Typ durchsuchen: JavaClassName typName = t.getName(); for(ClassAssumption ass : this.classAssumptions){ diff --git a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java index 4542f9f04..77e1c27bf 100755 --- a/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java +++ b/test/plugindevelopment/TypeInsertTests/MultipleTypesInsertTester.java @@ -69,11 +69,12 @@ public class MultipleTypesInsertTester extends TypeInsertTester{ } catch (IOException | yyException e) { e.printStackTrace(); TestCase.fail(); + }finally{ + writeLog(sourceFileToInfere+".log"); } for(String containString : mustContain){ TestCase.assertTrue("\""+containString+"\" muss in den inferierten Lösungen vorkommen",gesamterSrc.contains(containString)); } - writeLog(sourceFileToInfere+".log"); } public static void testSingleInsert(String sourceFileToInfere, Menge mustContain){ From dad06a562644e92500aad27aa234e729b0638c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Fri, 29 Apr 2016 09:43:36 +0200 Subject: [PATCH 19/26] Alle Bytecode Tests in SourceBytecodeTests transformiert --- test/bytecode/AssignTest.java | 21 ++++++---- test/bytecode/BinaryTest.java | 23 ++++++----- test/bytecode/BinaryTest2.java | 21 ++++++---- test/bytecode/BoolLitTest.java | 23 ++++++----- test/bytecode/CharLitTest.java | 21 ++++++---- test/bytecode/ConditionTest.java | 21 ++++++---- test/bytecode/EmptyClassTest.java | 21 ++++++---- test/bytecode/FieldDeclarationTest.java | 21 ++++++---- test/bytecode/ForTest.java | 20 ++++++---- test/bytecode/IdTest.java | 21 ++++++---- test/bytecode/IdentityField.jav | 2 +- test/bytecode/IdentityFieldTest.java | 21 ++++++---- test/bytecode/IdentityTest.java | 21 ++++++---- test/bytecode/IfElseIfStatement.jav | 2 + test/bytecode/IfElseIfStatementTest.java | 19 ++++++--- test/bytecode/IfElseStatementTest.java | 19 ++++++--- test/bytecode/IfStatementTest.java | 19 ++++++--- ...{LambdaExpr2.java => LambdaExpr2Test.java} | 22 ++++++----- .../{LambdaExpr.java => LambdaExprTest.java} | 23 ++++++----- test/bytecode/MainTest.java | 21 ++++++---- test/bytecode/Matrix_lambda.jav | 2 +- test/bytecode/Matrix_lambda2.jav | 2 +- test/bytecode/Matrix_lambda3.jav | 2 +- test/bytecode/Matrix_lambdaTest.java | 21 ++++++---- test/bytecode/Matrix_lambdaTest2.java | 21 ++++++---- test/bytecode/Matrix_lambdaTest3.java | 21 ++++++---- test/bytecode/MethodCallTest.java | 21 ++++++---- test/bytecode/MethodEmpty.java | 23 ++++++----- test/bytecode/MethodEmptyRetType.java | 23 ++++++----- test/bytecode/NewStatementTest.java | 39 ++++++------------- test/bytecode/ParameterTest.java | 23 ++++++----- test/bytecode/PostDecrement.java | 24 +++++++----- test/bytecode/PostIncrement.java | 24 +++++++----- test/bytecode/ReturnTest.java | 23 ++++++----- test/bytecode/RunnableTest.java | 21 ++++++---- test/bytecode/StringLitTest.java | 23 ++++++----- test/bytecode/SystemOutPrintlnTest.java | 23 ++++++----- test/bytecode/Test3.java | 2 +- test/bytecode/WhileTest.java | 21 ++++++---- 39 files changed, 455 insertions(+), 286 deletions(-) rename test/bytecode/{LambdaExpr2.java => LambdaExpr2Test.java} (63%) rename test/bytecode/{LambdaExpr.java => LambdaExprTest.java} (62%) diff --git a/test/bytecode/AssignTest.java b/test/bytecode/AssignTest.java index 232564dfd..03a328651 100644 --- a/test/bytecode/AssignTest.java +++ b/test/bytecode/AssignTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class AssignTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Assign.jav"; - public final static String outputFile = "Assign.class"; +public class AssignTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Assign"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/BinaryTest.java b/test/bytecode/BinaryTest.java index 37b0ab82a..3e73a2eaf 100644 --- a/test/bytecode/BinaryTest.java +++ b/test/bytecode/BinaryTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class BinaryTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Binary.jav"; - public final static String outputFile = "Binary.class"; +public class BinaryTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Binary"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/BinaryTest2.java b/test/bytecode/BinaryTest2.java index 842af0943..5ea335142 100644 --- a/test/bytecode/BinaryTest2.java +++ b/test/bytecode/BinaryTest2.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class BinaryTest2 { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Binary2.jav"; - public final static String outputFile = "Binary2.class"; +public class BinaryTest2 extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Binary2"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/BoolLitTest.java b/test/bytecode/BoolLitTest.java index 75bd41ed4..be459e8d8 100644 --- a/test/bytecode/BoolLitTest.java +++ b/test/bytecode/BoolLitTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class BoolLitTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "BoolLit.jav"; - public final static String outputFile = "BoolLit.class"; +public class BoolLitTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "BoolLit"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/CharLitTest.java b/test/bytecode/CharLitTest.java index 60f2c4d5a..87b35013c 100644 --- a/test/bytecode/CharLitTest.java +++ b/test/bytecode/CharLitTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class CharLitTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "CharLitTest.jav"; - public final static String outputFile = "CharLitTest.class"; +public class CharLitTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "CharLit"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/ConditionTest.java b/test/bytecode/ConditionTest.java index 851d6426e..dfbbadf92 100644 --- a/test/bytecode/ConditionTest.java +++ b/test/bytecode/ConditionTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class ConditionTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Condition.jav"; - public final static String outputFile = "Condition.class"; +public class ConditionTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Condition"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/EmptyClassTest.java b/test/bytecode/EmptyClassTest.java index de7d900a2..6050dd37f 100644 --- a/test/bytecode/EmptyClassTest.java +++ b/test/bytecode/EmptyClassTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class EmptyClassTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "EmptyClass.jav"; - public final static String outputFile = "EmptyClass.class"; +public class EmptyClassTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "EmptyClass"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/FieldDeclarationTest.java b/test/bytecode/FieldDeclarationTest.java index 7724c0e80..ea6b80622 100644 --- a/test/bytecode/FieldDeclarationTest.java +++ b/test/bytecode/FieldDeclarationTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class FieldDeclarationTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "FieldDeclaration.jav"; - public final static String outputFile = "FieldDeclaration.class"; +public class FieldDeclarationTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "FieldDeclaration"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/ForTest.java b/test/bytecode/ForTest.java index 497dc3759..d34b2a631 100644 --- a/test/bytecode/ForTest.java +++ b/test/bytecode/ForTest.java @@ -3,14 +3,20 @@ package bytecode; import org.junit.Ignore; import org.junit.Test; -public class ForTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "ForTest.jav"; - public final static String outputFile = "ForTest.class"; +public class ForTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "ForTest"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - @Ignore - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } } diff --git a/test/bytecode/IdTest.java b/test/bytecode/IdTest.java index f303e5d06..f5da1ab23 100644 --- a/test/bytecode/IdTest.java +++ b/test/bytecode/IdTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class IdTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Id.jav"; - public final static String outputFile = "Id.class"; +public class IdTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Id"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/IdentityField.jav b/test/bytecode/IdentityField.jav index 297814319..8063d0b30 100644 --- a/test/bytecode/IdentityField.jav +++ b/test/bytecode/IdentityField.jav @@ -1,3 +1,3 @@ -class Id { +class IdentityField { Fun1 op = (x) -> x; } \ No newline at end of file diff --git a/test/bytecode/IdentityFieldTest.java b/test/bytecode/IdentityFieldTest.java index e50b001e1..2a6e7ecd6 100644 --- a/test/bytecode/IdentityFieldTest.java +++ b/test/bytecode/IdentityFieldTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class IdentityFieldTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "IdentityField.jav"; - public final static String outputFile = "IdentityField.class"; +public class IdentityFieldTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "IdentityField"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/IdentityTest.java b/test/bytecode/IdentityTest.java index 7d5493ee8..2aa2563e4 100644 --- a/test/bytecode/IdentityTest.java +++ b/test/bytecode/IdentityTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class IdentityTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Identity.jav"; - public final static String outputFile = "Identity.class"; +public class IdentityTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Identity"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/IfElseIfStatement.jav b/test/bytecode/IfElseIfStatement.jav index 1b6fbb89a..caf9d524a 100644 --- a/test/bytecode/IfElseIfStatement.jav +++ b/test/bytecode/IfElseIfStatement.jav @@ -4,6 +4,8 @@ class IfElseIfStatement{ return 0; }else if(flag){ return 1; + }else{ + return 2; } } diff --git a/test/bytecode/IfElseIfStatementTest.java b/test/bytecode/IfElseIfStatementTest.java index 9ac14c4c2..6e60d3a64 100644 --- a/test/bytecode/IfElseIfStatementTest.java +++ b/test/bytecode/IfElseIfStatementTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class IfElseIfStatementTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "IfElseIfStatement.jav"; - public final static String outputFile = "IfElseIfStatement.class"; +public class IfElseIfStatementTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "IfElseIfStatement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } } diff --git a/test/bytecode/IfElseStatementTest.java b/test/bytecode/IfElseStatementTest.java index 9b491a6b0..3209b8d1e 100644 --- a/test/bytecode/IfElseStatementTest.java +++ b/test/bytecode/IfElseStatementTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class IfElseStatementTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "IfElseStatement.jav"; - public final static String outputFile = "IfElseStatement.class"; +public class IfElseStatementTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "IfElseStatement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } } diff --git a/test/bytecode/IfStatementTest.java b/test/bytecode/IfStatementTest.java index 848f46d46..baa8b9064 100644 --- a/test/bytecode/IfStatementTest.java +++ b/test/bytecode/IfStatementTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class IfStatementTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "IfStatement.jav"; - public final static String outputFile = "IfStatement.class"; +public class IfStatementTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "IfStatement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } } diff --git a/test/bytecode/LambdaExpr2.java b/test/bytecode/LambdaExpr2Test.java similarity index 63% rename from test/bytecode/LambdaExpr2.java rename to test/bytecode/LambdaExpr2Test.java index 83308ca54..ac85b8d05 100644 --- a/test/bytecode/LambdaExpr2.java +++ b/test/bytecode/LambdaExpr2Test.java @@ -21,16 +21,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class LambdaExpr2 { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "LambdaExpr2.jav"; - public final static String outputFile = "LambdaExpr2.class"; +public class LambdaExpr2Test extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "LambdaExpr"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - @Ignore - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/LambdaExpr.java b/test/bytecode/LambdaExprTest.java similarity index 62% rename from test/bytecode/LambdaExpr.java rename to test/bytecode/LambdaExprTest.java index c28dad562..c6b8e0f5e 100644 --- a/test/bytecode/LambdaExpr.java +++ b/test/bytecode/LambdaExprTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class LambdaExpr { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "LambdaExpr.jav"; - public final static String outputFile = "LambdaExpr.class"; +public class LambdaExprTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "LambdaExpr"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/MainTest.java b/test/bytecode/MainTest.java index 768c2fca3..97abece42 100644 --- a/test/bytecode/MainTest.java +++ b/test/bytecode/MainTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class MainTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Main.jav"; - public final static String outputFile = "Main.class"; +public class MainTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Main"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/Matrix_lambda.jav b/test/bytecode/Matrix_lambda.jav index 293f776e4..f531d2ba2 100644 --- a/test/bytecode/Matrix_lambda.jav +++ b/test/bytecode/Matrix_lambda.jav @@ -1,5 +1,5 @@ import java.util.Vector; -class Matrix extends Vector> { +class Matrix_lambda extends Vector> { op = (Matrix m) -> (f) -> f.apply(this, m); } \ No newline at end of file diff --git a/test/bytecode/Matrix_lambda2.jav b/test/bytecode/Matrix_lambda2.jav index e67ce40cc..667e02e29 100644 --- a/test/bytecode/Matrix_lambda2.jav +++ b/test/bytecode/Matrix_lambda2.jav @@ -1,4 +1,4 @@ -class Matrix2 { +class Matrix_lambda2 { op = (f) -> f.apply(2); } \ No newline at end of file diff --git a/test/bytecode/Matrix_lambda3.jav b/test/bytecode/Matrix_lambda3.jav index 7fc6dede7..f0341cdc6 100644 --- a/test/bytecode/Matrix_lambda3.jav +++ b/test/bytecode/Matrix_lambda3.jav @@ -1,4 +1,4 @@ -class Matrix3 { +class Matrix_lambda3 { op = (f) -> f.apply(); } \ No newline at end of file diff --git a/test/bytecode/Matrix_lambdaTest.java b/test/bytecode/Matrix_lambdaTest.java index 7cbf49328..5d8b4e39d 100644 --- a/test/bytecode/Matrix_lambdaTest.java +++ b/test/bytecode/Matrix_lambdaTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class Matrix_lambdaTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Matrix_lambda.jav"; - public final static String outputFile = "Matrix_lambda.class"; +public class Matrix_lambdaTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Matrix_lambda"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/Matrix_lambdaTest2.java b/test/bytecode/Matrix_lambdaTest2.java index 3264bfa03..374802a3c 100644 --- a/test/bytecode/Matrix_lambdaTest2.java +++ b/test/bytecode/Matrix_lambdaTest2.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class Matrix_lambdaTest2 { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Matrix_lambda2.jav"; - public final static String outputFile = "Matrix2.class"; +public class Matrix_lambdaTest2 extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Matrix_lambda2"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/Matrix_lambdaTest3.java b/test/bytecode/Matrix_lambdaTest3.java index a649ec937..6addc9fd9 100644 --- a/test/bytecode/Matrix_lambdaTest3.java +++ b/test/bytecode/Matrix_lambdaTest3.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class Matrix_lambdaTest3 { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Matrix_lambda3.jav"; - public final static String outputFile = "Matrix3.class"; +public class Matrix_lambdaTest3 extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Matrix_lambda3"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/MethodCallTest.java b/test/bytecode/MethodCallTest.java index 96d23eee0..c5bfa3522 100644 --- a/test/bytecode/MethodCallTest.java +++ b/test/bytecode/MethodCallTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class MethodCallTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "MethodCall.jav"; - public final static String outputFile = "MethodCall.class"; +public class MethodCallTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MethodCall"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } } diff --git a/test/bytecode/MethodEmpty.java b/test/bytecode/MethodEmpty.java index 1f6af8beb..ce72531be 100644 --- a/test/bytecode/MethodEmpty.java +++ b/test/bytecode/MethodEmpty.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class MethodEmpty { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "MethodEmpty.jav"; - public final static String outputFile = "MethodEmpty.class"; +public class MethodEmpty extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MethodEmpty"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/MethodEmptyRetType.java b/test/bytecode/MethodEmptyRetType.java index 272e3998b..82f8848be 100644 --- a/test/bytecode/MethodEmptyRetType.java +++ b/test/bytecode/MethodEmptyRetType.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class MethodEmptyRetType { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "MethodEmptyRetType.jav"; - public final static String outputFile = "MethodEmptyRetType.class"; +public class MethodEmptyRetType extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MethodEmptyRetType"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/NewStatementTest.java b/test/bytecode/NewStatementTest.java index 1272c626c..6f930699c 100644 --- a/test/bytecode/NewStatementTest.java +++ b/test/bytecode/NewStatementTest.java @@ -23,35 +23,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class NewStatementTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "NewStatement.jav"; - public final static String outputFile = "NewStatement.class"; +public class NewStatementTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "NewStatement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory); - } - /* - @Test - public void testUntypedVectorDeclaredMethods() { - try{ - File file = new File(System.getProperty("user.dir")+"/test/bytecode/types/"); - URL url = file.toURL(); - URL[] urls = new URL[]{url}; + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); - ClassLoader classLoader = new URLClassLoader(urls); - - Class untypedVectorTest = classLoader.loadClass("UntypedVector"); - - for(Method method: untypedVectorTest.getDeclaredMethods()){ - System.out.println(method.toGenericString()); - } - }catch(Exception e){ - throw new RuntimeException(e); - } + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } - */ - } diff --git a/test/bytecode/ParameterTest.java b/test/bytecode/ParameterTest.java index cd06eeefe..09993db35 100644 --- a/test/bytecode/ParameterTest.java +++ b/test/bytecode/ParameterTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class ParameterTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Parameter.jav"; - public final static String outputFile = "Parameter.class"; +public class ParameterTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Parameter"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/PostDecrement.java b/test/bytecode/PostDecrement.java index b0dbee20e..6ab8bbf37 100644 --- a/test/bytecode/PostDecrement.java +++ b/test/bytecode/PostDecrement.java @@ -21,16 +21,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class PostDecrement { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "PostDecrement.jav"; - public final static String outputFile = "PostDecrement.class"; +public class PostDecrement extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "PostDecrement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - @Ignore - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/PostIncrement.java b/test/bytecode/PostIncrement.java index da1fe1e31..83f189dc8 100644 --- a/test/bytecode/PostIncrement.java +++ b/test/bytecode/PostIncrement.java @@ -21,16 +21,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class PostIncrement { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "PostIncrement.jav"; - public final static String outputFile = "PostIncrement.class"; +public class PostIncrement extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "PostIncrement"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - @Ignore - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/ReturnTest.java b/test/bytecode/ReturnTest.java index a7179e11e..cad56bfad 100644 --- a/test/bytecode/ReturnTest.java +++ b/test/bytecode/ReturnTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class ReturnTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Return.jav"; - public final static String outputFile = "Return.class"; +public class ReturnTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Return"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/RunnableTest.java b/test/bytecode/RunnableTest.java index 2eb55d856..82b6abc8f 100644 --- a/test/bytecode/RunnableTest.java +++ b/test/bytecode/RunnableTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class RunnableTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "Runnable.jav"; - public final static String outputFile = "Runnable.class"; +public class RunnableTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "Runnable"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file diff --git a/test/bytecode/StringLitTest.java b/test/bytecode/StringLitTest.java index d4d93f197..690968e48 100644 --- a/test/bytecode/StringLitTest.java +++ b/test/bytecode/StringLitTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class StringLitTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "StringLitTest.jav"; - public final static String outputFile = "StringLitTest.class"; +public class StringLitTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "StringLitTest"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/SystemOutPrintlnTest.java b/test/bytecode/SystemOutPrintlnTest.java index b42a21c17..39db74e3f 100644 --- a/test/bytecode/SystemOutPrintlnTest.java +++ b/test/bytecode/SystemOutPrintlnTest.java @@ -20,15 +20,20 @@ import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; -public class SystemOutPrintlnTest { - - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "SystemOutPrintln.jav"; - public final static String outputFile = "SystemOutPrintln.class"; +public class SystemOutPrintlnTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "SystemOutPrintln"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); - } + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); -} + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} \ No newline at end of file diff --git a/test/bytecode/Test3.java b/test/bytecode/Test3.java index 5c1fc6a31..6bc9a7371 100644 --- a/test/bytecode/Test3.java +++ b/test/bytecode/Test3.java @@ -1,6 +1,6 @@ class Test3{ public static void main(String[] args){ -System.out.println(new LambdaExpr2().op.apply()); +System.out.println(new LambdaExpr2Test().op.apply()); } } diff --git a/test/bytecode/WhileTest.java b/test/bytecode/WhileTest.java index cd7e4f8f9..be51a8133 100644 --- a/test/bytecode/WhileTest.java +++ b/test/bytecode/WhileTest.java @@ -2,13 +2,20 @@ package bytecode; import org.junit.Test; -public class WhileTest { - public final static String rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; - public final static String testFile = "WhileTest.jav"; - public final static String outputFile = "WhileTest.class"; +public class WhileTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "WhileTest"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } @Test - public void test() { - SingleClassTester.compileToBytecode(rootDirectory+testFile, rootDirectory+outputFile); + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); } -} +} \ No newline at end of file From ba6ae74ad12db7715f6db60a29ff7cfa21ef9471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Fri, 29 Apr 2016 10:00:33 +0200 Subject: [PATCH 20/26] =?UTF-8?q?-Tests=20f=C3=BCr=20for=20und=20While=20S?= =?UTF-8?q?chleife=20korrigiert=20-=20While=20teilweise=20implementiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../syntaxtree/statement/ForStmt.java | 4 ---- .../syntaxtree/statement/WhileStmt.java | 20 +++++++++++++++++-- test/bytecode/ForTest.jav | 6 +++--- test/bytecode/WhileTest.jav | 10 ++++++---- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java index eeff85ba2..699986383 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/ForStmt.java @@ -39,10 +39,6 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import de.dhbwstuttgart.typeinference.unify.Unify; - - - - public class ForStmt extends Statement { diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java b/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java index dd95b912d..f9816ade8 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/WhileStmt.java @@ -6,7 +6,11 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; +import org.apache.commons.bcel6.generic.BranchInstruction; import org.apache.commons.bcel6.generic.ClassGen; +import org.apache.commons.bcel6.generic.DUP; +import org.apache.commons.bcel6.generic.GOTO; +import org.apache.commons.bcel6.generic.IFEQ; import org.apache.commons.bcel6.generic.InstructionList; import de.dhbwstuttgart.typeinference.Menge; @@ -139,8 +143,20 @@ public class WhileStmt extends Statement @Override public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs) { - // TODO Bytecode - throw new NotImplementedException(); + //TOD: while Statement + InstructionList il = expr.genByteCode(_cg, rs); + + BranchInstruction ifeq = new IFEQ(null); + il.append(ifeq); + + il.append(loop_block.genByteCode(_cg, rs)); + + il.append(new GOTO(il.getStart())); + + ifeq.setTarget(il.append(new DUP())); + + + return il; } } // ino.end diff --git a/test/bytecode/ForTest.jav b/test/bytecode/ForTest.jav index 649b71b04..d2723cf4c 100644 --- a/test/bytecode/ForTest.jav +++ b/test/bytecode/ForTest.jav @@ -1,6 +1,6 @@ -class IfElse{ - method(){ - for( i = 0; i < 10 ; i = i++){ +class ForTest{ + void method(){ + for(Integer i = 0; i < 10 ; i = i + 1){ } } diff --git a/test/bytecode/WhileTest.jav b/test/bytecode/WhileTest.jav index 7343a1b89..fa39c9052 100644 --- a/test/bytecode/WhileTest.jav +++ b/test/bytecode/WhileTest.jav @@ -1,7 +1,9 @@ -class IfElse{ - method(){ - while(true){ - +class WhileTest{ + void method(){ + Integer i; + i = 1; + while(i < 10){ + i = i + 1; } } } \ No newline at end of file From d03e20df90ee3b6cded18e3463af89b32ef063ee Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 29 Apr 2016 15:23:42 +0200 Subject: [PATCH 21/26] FunN Typen konvertieren. FunVoidN Typen werden nicht mehr benutzt --- src/de/dhbwstuttgart/core/MyCompiler.java | 10 +++++----- src/de/dhbwstuttgart/syntaxtree/type/FunN.java | 5 ++++- .../dhbwstuttgart/typeinference/FunNInterface.java | 12 +++++++++--- .../typeinference/unify/model/FunNType.java | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/de/dhbwstuttgart/core/MyCompiler.java b/src/de/dhbwstuttgart/core/MyCompiler.java index c91596484..9a194a03c 100755 --- a/src/de/dhbwstuttgart/core/MyCompiler.java +++ b/src/de/dhbwstuttgart/core/MyCompiler.java @@ -159,11 +159,11 @@ public class MyCompiler implements MyCompilerAPI{ FunNInterface funN = new FunNInterface(i); ret.add(funN.getPublicFieldAssumptions()); } - for(int i = 0; i<6; i++){ - FunVoidNInterface funN = new FunVoidNInterface(i); - ret.add(funN.getPublicFieldAssumptions()); - } - + //Keine FunVoidInterfaces in den Assumptions. + //for(int i = 0; i<6; i++){ + // FunVoidNInterface funN = new FunVoidNInterface(i); + // ret.add(funN.getPublicFieldAssumptions()); + //} return ret; } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/FunN.java b/src/de/dhbwstuttgart/syntaxtree/type/FunN.java index b2d277922..0e23a2a27 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/FunN.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/FunN.java @@ -15,6 +15,7 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; import de.dhbwstuttgart.typeinference.assumptions.MethodAssumption; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; +import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; /** * @see Spezifikation "Complete Typeinference in Java 8" von Martin Plümicke @@ -143,7 +144,9 @@ public class FunN extends RefType { //FunN Typen müssen nicht geprüft werden. Sie werden schließlich nur von unserem Typinferenzalgorithmus erstellt: List paraList = new ArrayList<>(); for(Type t : this.T){ - paraList.add(t.TYPE(ass, parent)); + Type toAdd = t.TYPE(ass, parent); + //if(toAdd == null)throw new TypeinferenceException("Typ "+toAdd+" ist in den Assumptions nicht vorhanden",this); + paraList.add(toAdd); } FunN ret = new FunN(this.R.TYPE(ass, parent),paraList); return ret; diff --git a/src/de/dhbwstuttgart/typeinference/FunNInterface.java b/src/de/dhbwstuttgart/typeinference/FunNInterface.java index 5a8e72803..877e06329 100644 --- a/src/de/dhbwstuttgart/typeinference/FunNInterface.java +++ b/src/de/dhbwstuttgart/typeinference/FunNInterface.java @@ -2,6 +2,8 @@ package de.dhbwstuttgart.typeinference; import de.dhbwstuttgart.typeinference.Menge; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import de.dhbwstuttgart.parser.JavaClassName; @@ -85,9 +87,13 @@ public class FunNInterface extends Class{ @Override public RefType getType() { List paraList = this.get_ParaList(); - Type R = paraList.get(0); - paraList.remove(0); - return new FunN(R, paraList); + Iterator paraIter = paraList.iterator(); + Type R = paraIter.next(); + List paraListNew = new ArrayList<>(); + while(paraIter.hasNext()){ + paraListNew.add(paraIter.next()); + } + return new FunN(R, paraListNew); } diff --git a/src/de/dhbwstuttgart/typeinference/unify/model/FunNType.java b/src/de/dhbwstuttgart/typeinference/unify/model/FunNType.java index b7e5c60e5..cf2c86ae5 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/model/FunNType.java +++ b/src/de/dhbwstuttgart/typeinference/unify/model/FunNType.java @@ -14,7 +14,7 @@ public class FunNType extends UnifyType { * Creates a FunN-Type with the specified TypeParameters. */ protected FunNType(TypeParams p) { - super("FuN", p); + super("Fun"+(p.size()-1), p); } /** From 32741f41e9aba8c69472a224b9b22d865ad15064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Fri, 29 Apr 2016 15:52:20 +0200 Subject: [PATCH 22/26] =?UTF-8?q?-=20Addition=20f=C3=BCr=20alle=20Typen=20?= =?UTF-8?q?implementiert=20-=20Mehrere=20Klassen=20in=20einer=20jav=20Date?= =?UTF-8?q?i=20m=C3=B6glich=20-=20OLTest=20l=C3=A4uft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../syntaxtree/operator/AddOp.java | 73 +++++++++++++++---- .../syntaxtree/operator/Operator.java | 19 ++++- .../syntaxtree/operator/PlusOp.java | 16 +++- .../exceptions/NotImplementedException.java | 6 ++ test/bytecode/MultiClass.jav | 5 ++ test/bytecode/MultiClassTest.java | 49 +++++++++++++ test/bytecode/SingleClassTester.java | 24 +++--- test/bytecode/operators/AddDoubleOperator.jav | 5 ++ .../operators/AddDoubleOperatorTest.java | 53 ++++++++++++++ test/bytecode/operators/AddFloatOperator.jav | 5 ++ .../operators/AddFloatOperatorTest.java | 53 ++++++++++++++ .../bytecode/operators/AddIntegerOperator.jav | 5 ++ .../operators/AddIntegerOperatorTest.java | 53 ++++++++++++++ test/bytecode/operators/AddLongOperator.jav | 5 ++ .../operators/AddLongOperatorTest.java | 53 ++++++++++++++ test/bytecode/operators/AddOperator.jav | 4 +- test/bytecode/operators/AddOperatorTest.java | 65 +++++++++++++++-- test/bytecode/types/OL.jav | 16 +--- test/bytecode/types/OLTest.java | 26 +++++++ 19 files changed, 488 insertions(+), 47 deletions(-) create mode 100644 test/bytecode/MultiClass.jav create mode 100644 test/bytecode/MultiClassTest.java create mode 100644 test/bytecode/operators/AddDoubleOperator.jav create mode 100644 test/bytecode/operators/AddDoubleOperatorTest.java create mode 100644 test/bytecode/operators/AddFloatOperator.jav create mode 100644 test/bytecode/operators/AddFloatOperatorTest.java create mode 100644 test/bytecode/operators/AddIntegerOperator.jav create mode 100644 test/bytecode/operators/AddIntegerOperatorTest.java create mode 100644 test/bytecode/operators/AddLongOperator.jav create mode 100644 test/bytecode/operators/AddLongOperatorTest.java diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java index ac4ac40a5..4094f76a0 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java @@ -8,6 +8,7 @@ import java.util.Iterator; import org.apache.commons.bcel6.Constants; import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.DUP; import org.apache.commons.bcel6.generic.IADD; import org.apache.commons.bcel6.generic.InstructionList; import org.apache.commons.bcel6.generic.InvokeInstruction; @@ -20,8 +21,11 @@ import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; import de.dhbwstuttgart.syntaxtree.type.Type; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.Pair; import de.dhbwstuttgart.typeinference.SingleConstraint; @@ -75,7 +79,6 @@ public abstract class AddOp extends Operator @Override public InstructionList genByteCode(ClassGenerator _cg, TypeinferenceResultSet rs, Binary operator) { - // TODO Plus Operator ist bis jetzt nur für Integer implementiert /* 0: aload_1 1: invokevirtual #2 // Method java/lang/Integer.intValue:()I @@ -85,22 +88,60 @@ public abstract class AddOp extends Operator 9: invokestatic #3 // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer; 12: areturn */ - DHBWInstructionFactory _factory = _cg.getInstructionFactory(); - String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2()); + String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2(), rs); + + if(returnType.equals("java.lang.String")){ + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); - InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); - - il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), returnType)); - - il.append(getOperator(returnType)); - - il.append(convertValueToObject(_factory, returnType)); - return il; + ObjectType objectType = new ObjectType("java.lang.StringBuilder"); + + InstructionList il = new InstructionList(); + il.append(_factory.createNew("java.lang.StringBuilder")); + il.append(new DUP()); + il.append(_cg.getInstructionFactory().createInvoke("java.lang.StringBuilder", "", org.apache.commons.bcel6.generic.Type.VOID, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKESPECIAL)); + + il.append(operator.get_Expr1().genByteCode(_cg, rs)); + + + il.append(_cg.getInstructionFactory().createInvoke("java.lang.StringBuilder", "append", objectType, new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.STRING}, Constants.INVOKEVIRTUAL)); + + il.append(operator.get_Expr2().genByteCode(_cg, rs)); + + il.append(_cg.getInstructionFactory().createInvoke("java.lang.StringBuilder", "append", objectType, new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.STRING}, Constants.INVOKEVIRTUAL)); + + il.append(_cg.getInstructionFactory().createInvoke("java.lang.StringBuilder", "toString", new ObjectType("java.lang.String"), new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + + return il; + }else{ + DHBWInstructionFactory _factory = _cg.getInstructionFactory(); + + InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); + + il.append(getInstructionListForOperand(_cg, rs, operator.get_Expr2(), returnType)); + + il.append(getOperator(returnType)); + + il.append(convertValueToObject(_factory, returnType)); + return il; + } } - private String getReturnType(Expr expr1, Expr expr2) { - return "java.lang.Integer"; + private String getReturnType(Expr expr1, Expr expr2, TypeinferenceResultSet rs) { + Type type = expr1.getType(); + if(type instanceof TypePlaceholder){ + Type tphType = rs.getTypeOfPlaceholder((TypePlaceholder) expr1.getType()); + if(tphType instanceof ExtendsWildcardType){ + return ((ExtendsWildcardType) tphType).get_ExtendsType().get_Name(); + }else if(tphType instanceof SuperWildcardType){ + return ((SuperWildcardType) tphType).get_SuperType().get_Name(); + }else{ + return tphType.getName().toString(); + } + }else{ + return type.get_Name(); + } + } abstract ArithmeticInstruction getOperator(String returnType); @@ -108,6 +149,12 @@ public abstract class AddOp extends Operator private InvokeInstruction convertValueToObject(DHBWInstructionFactory _factory, String returnType) { if(returnType.equals("java.lang.Integer")){ return _factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.INT}, Constants.INVOKESTATIC); + }else if(returnType.equals("java.lang.Double")){ + return _factory.createInvoke("java.lang.Double", "valueOf", new ObjectType("java.lang.Double"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.DOUBLE}, Constants.INVOKESTATIC); + }else if(returnType.equals("java.lang.Float")){ + return _factory.createInvoke("java.lang.Float", "valueOf", new ObjectType("java.lang.Float"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.FLOAT}, Constants.INVOKESTATIC); + }else if(returnType.equals("java.lang.Long")){ + return _factory.createInvoke("java.lang.Long", "valueOf", new ObjectType("java.lang.Long"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.LONG}, Constants.INVOKESTATIC); }else{ throw new NotImplementedException(); } diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java index 25267dc1e..80d2530b1 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/Operator.java @@ -7,7 +7,11 @@ import java.util.Hashtable; import java.util.Iterator; import org.apache.commons.bcel6.Constants; +import org.apache.commons.bcel6.generic.DADD; +import org.apache.commons.bcel6.generic.FADD; +import org.apache.commons.bcel6.generic.IADD; import org.apache.commons.bcel6.generic.InstructionList; +import org.apache.commons.bcel6.generic.LADD; import de.dhbwstuttgart.typeinference.Menge; import de.dhbwstuttgart.bytecode.ClassGenerator; @@ -27,6 +31,7 @@ import de.dhbwstuttgart.typeinference.SingleConstraint; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.UndConstraint; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; +import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; import de.dhbwstuttgart.typeinference.unify.Unify; @@ -103,7 +108,19 @@ public abstract class Operator extends SyntaxTreeNode protected InstructionList getInstructionListForOperand(ClassGenerator _cg, TypeinferenceResultSet rs, Expr operand, String returnType){ InstructionList il = new InstructionList(); il.append(operand.genByteCode(_cg, rs)); - il.append(_cg.getInstructionFactory().createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + if(returnType.equals("java.lang.Integer")){ + il.append(_cg.getInstructionFactory().createInvoke("java.lang.Integer", "intValue", org.apache.commons.bcel6.generic.Type.INT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + }else if(returnType.equals("java.lang.Double")){ + il.append(_cg.getInstructionFactory().createInvoke("java.lang.Double", "doubleValue", org.apache.commons.bcel6.generic.Type.DOUBLE, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + }else if(returnType.equals("java.lang.Float")){ + il.append(_cg.getInstructionFactory().createInvoke("java.lang.Float", "floatValue", org.apache.commons.bcel6.generic.Type.FLOAT, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + }else if(returnType.equals("java.lang.Long")){ + il.append(_cg.getInstructionFactory().createInvoke("java.lang.Long", "longValue", org.apache.commons.bcel6.generic.Type.LONG, new org.apache.commons.bcel6.generic.Type[] {}, Constants.INVOKEVIRTUAL)); + }else if(returnType.equals("java.lang.String")){ + + }else{ + throw new NotImplementedException(returnType); + } return il; } } diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java index cff0e1505..73acd1b93 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java @@ -9,6 +9,8 @@ import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import org.apache.commons.bcel6.Constants; import org.apache.commons.bcel6.generic.ArithmeticInstruction; import org.apache.commons.bcel6.generic.BranchInstruction; +import org.apache.commons.bcel6.generic.DADD; +import org.apache.commons.bcel6.generic.FADD; import org.apache.commons.bcel6.generic.GOTO; import org.apache.commons.bcel6.generic.IADD; import org.apache.commons.bcel6.generic.IFEQ; @@ -16,6 +18,7 @@ import org.apache.commons.bcel6.generic.IFNE; import org.apache.commons.bcel6.generic.InstructionConstants; import org.apache.commons.bcel6.generic.InstructionList; import org.apache.commons.bcel6.generic.InvokeInstruction; +import org.apache.commons.bcel6.generic.LADD; import org.apache.commons.bcel6.generic.ObjectType; import de.dhbwstuttgart.bytecode.ClassGenerator; @@ -43,7 +46,18 @@ public class PlusOp extends AddOp // ino.end ArithmeticInstruction getOperator(String returnType) { - return new IADD(); + if(returnType.equals("java.lang.Integer")){ + return new IADD(); + }else if(returnType.equals("java.lang.Double")){ + return new DADD(); + }else if(returnType.equals("java.lang.Float")){ + return new FADD(); + }else if(returnType.equals("java.lang.Long")){ + return new LADD(); + }else{ + throw new NotImplementedException(); + } + } } // ino.end diff --git a/src/de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.java b/src/de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.java index 5daaef67c..bf7e77797 100644 --- a/src/de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.java +++ b/src/de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.java @@ -1,5 +1,11 @@ package de.dhbwstuttgart.typeinference.exceptions; public class NotImplementedException extends RuntimeException { + + public NotImplementedException() { + } + public NotImplementedException(String string) { + super(string); + } } diff --git a/test/bytecode/MultiClass.jav b/test/bytecode/MultiClass.jav new file mode 100644 index 000000000..11114b32a --- /dev/null +++ b/test/bytecode/MultiClass.jav @@ -0,0 +1,5 @@ +class MultiClass{ +} + +class MultiClass2{ +} \ No newline at end of file diff --git a/test/bytecode/MultiClassTest.java b/test/bytecode/MultiClassTest.java new file mode 100644 index 000000000..54b51f47a --- /dev/null +++ b/test/bytecode/MultiClassTest.java @@ -0,0 +1,49 @@ +package bytecode; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; + +import junit.framework.TestCase; + +import org.junit.Test; + +import plugindevelopment.TypeInsertTester; +import de.dhbwstuttgart.core.MyCompiler; +import de.dhbwstuttgart.core.MyCompilerAPI; +import de.dhbwstuttgart.logger.LoggerConfiguration; +import de.dhbwstuttgart.logger.Section; +import de.dhbwstuttgart.parser.JavaParser.yyException; +import de.dhbwstuttgart.typeinference.ByteCodeResult; +import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; +import de.dhbwstuttgart.typeinference.typedeployment.TypeInsertSet; + +public class MultiClassTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "MultiClass"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testConstruct2() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName+2); + + Object obj = cls.newInstance(); + assertTrue(true); + } +} diff --git a/test/bytecode/SingleClassTester.java b/test/bytecode/SingleClassTester.java index 5c4eface1..034a780cb 100644 --- a/test/bytecode/SingleClassTester.java +++ b/test/bytecode/SingleClassTester.java @@ -38,20 +38,20 @@ public class SingleClassTester { Menge bytecode = compiler.generateBytecode(sourceFiles, results); //System.out.println(bytecode); - - - ByteCodeResult result = bytecode.firstElement(); - - JavaClass javaClass = result.getByteCode().getJavaClass(); - javaClass.dump(new File(outputDirectory+javaClass.getClassName()+".class")); - - for(ClassGenerator cg: result.getByteCode().getExtraClasses().values()){ - JavaClass jc = cg.getJavaClass(); - jc.dump(new File(outputDirectory+jc.getClassName()+".class")); + for(ByteCodeResult result: bytecode){ + JavaClass javaClass = result.getByteCode().getJavaClass(); + javaClass.dump(new File(outputDirectory+javaClass.getClassName()+".class")); + + for(ClassGenerator cg: result.getByteCode().getExtraClasses().values()){ + JavaClass jc = cg.getJavaClass(); + jc.dump(new File(outputDirectory+jc.getClassName()+".class")); + } + + Logger.getLogger("SingleClassTester").error(result.getByteCode().getJavaClass().toString(), Section.CODEGEN); + } - Logger.getLogger("SingleClassTester").error(result.getByteCode().getJavaClass().toString(), Section.CODEGEN); - + } catch (IOException | yyException e) { diff --git a/test/bytecode/operators/AddDoubleOperator.jav b/test/bytecode/operators/AddDoubleOperator.jav new file mode 100644 index 000000000..2ed1848cb --- /dev/null +++ b/test/bytecode/operators/AddDoubleOperator.jav @@ -0,0 +1,5 @@ +class AddDoubleOperator{ + Double method(Double x, Double y){ + return x + y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/AddDoubleOperatorTest.java b/test/bytecode/operators/AddDoubleOperatorTest.java new file mode 100644 index 000000000..5461b1726 --- /dev/null +++ b/test/bytecode/operators/AddDoubleOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class AddDoubleOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "AddDoubleOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoDoubles() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Double x = new Double(1); + Double y = new Double(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Double returnValue = (Double) method.invoke(obj, x, y); + assertEquals(new Double(3.0), returnValue); + } +} diff --git a/test/bytecode/operators/AddFloatOperator.jav b/test/bytecode/operators/AddFloatOperator.jav new file mode 100644 index 000000000..b7968498d --- /dev/null +++ b/test/bytecode/operators/AddFloatOperator.jav @@ -0,0 +1,5 @@ +class AddFloatOperator{ + Float method(Float x, Float y){ + return x + y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/AddFloatOperatorTest.java b/test/bytecode/operators/AddFloatOperatorTest.java new file mode 100644 index 000000000..205c48564 --- /dev/null +++ b/test/bytecode/operators/AddFloatOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class AddFloatOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "AddFloatOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoFloats() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Float x = new Float(1.0); + Float y = new Float(2.0); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Float returnValue = (Float) method.invoke(obj, x, y); + assertEquals(new Float(3.0), returnValue); + } +} diff --git a/test/bytecode/operators/AddIntegerOperator.jav b/test/bytecode/operators/AddIntegerOperator.jav new file mode 100644 index 000000000..7a1ee0b34 --- /dev/null +++ b/test/bytecode/operators/AddIntegerOperator.jav @@ -0,0 +1,5 @@ +class AddIntegerOperator{ + Integer method(Integer x, Integer y){ + return x + y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/AddIntegerOperatorTest.java b/test/bytecode/operators/AddIntegerOperatorTest.java new file mode 100644 index 000000000..a012307d8 --- /dev/null +++ b/test/bytecode/operators/AddIntegerOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class AddIntegerOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "AddIntegerOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoIntegers() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Integer x = new Integer(1); + Integer y = new Integer(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Integer returnValue = (Integer) method.invoke(obj, x, y); + assertEquals(new Integer(3), returnValue); + } +} diff --git a/test/bytecode/operators/AddLongOperator.jav b/test/bytecode/operators/AddLongOperator.jav new file mode 100644 index 000000000..86cba0834 --- /dev/null +++ b/test/bytecode/operators/AddLongOperator.jav @@ -0,0 +1,5 @@ +class AddLongOperator{ + Long method(Long x, Long y){ + return x + y; + } +} \ No newline at end of file diff --git a/test/bytecode/operators/AddLongOperatorTest.java b/test/bytecode/operators/AddLongOperatorTest.java new file mode 100644 index 000000000..7dc791f39 --- /dev/null +++ b/test/bytecode/operators/AddLongOperatorTest.java @@ -0,0 +1,53 @@ +package bytecode.operators; + +import static org.junit.Assert.*; + +import java.io.File; +import java.lang.reflect.Method; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Vector; + +import org.junit.Ignore; +import org.junit.Test; + +import bytecode.SourceFileBytecodeTest; + +public class AddLongOperatorTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "AddLongOperator"; + rootDirectory = System.getProperty("user.dir")+"/test/bytecode/operators/"; + } + + @Test + public void testConstruct() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + assertTrue(true); + } + + @Test + public void testTwoLongs() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Long x = new Long(1); + Long y = new Long(2); + + Class[] params = new Class[]{ + x.getClass(), + y.getClass(), + }; + + Method method = cls.getDeclaredMethod("method", params); + Long returnValue = (Long) method.invoke(obj, x, y); + assertEquals(new Long(3), returnValue); + } +} diff --git a/test/bytecode/operators/AddOperator.jav b/test/bytecode/operators/AddOperator.jav index ec305c058..8eec40b39 100644 --- a/test/bytecode/operators/AddOperator.jav +++ b/test/bytecode/operators/AddOperator.jav @@ -1,5 +1,5 @@ class AddOperator{ - Integer method(Integer x, Integer y){ - return x + y; + method(x){ + return x + x; } } \ No newline at end of file diff --git a/test/bytecode/operators/AddOperatorTest.java b/test/bytecode/operators/AddOperatorTest.java index edd2c3e2d..3f6230386 100644 --- a/test/bytecode/operators/AddOperatorTest.java +++ b/test/bytecode/operators/AddOperatorTest.java @@ -39,15 +39,70 @@ public class AddOperatorTest extends SourceFileBytecodeTest{ Object obj = cls.newInstance(); Integer x = new Integer(1); - Integer y = new Integer(2); Class[] params = new Class[]{ - x.getClass(), - y.getClass(), + x.getClass() }; Method method = cls.getDeclaredMethod("method", params); - Integer returnValue = (Integer) method.invoke(obj, x, y); - assertEquals(new Integer(3), returnValue); + Integer returnValue = (Integer) method.invoke(obj, x); + assertEquals(new Integer(2), returnValue); + } + + @Test + public void testTwoDoubles() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Double x = new Double(1.0); + + Class[] params = new Class[]{ + x.getClass() + }; + + Method method = cls.getDeclaredMethod("method", params); + Double returnValue = (Double) method.invoke(obj, x); + assertEquals(new Double(2.0), returnValue); + } + + @Test + public void testTwoFloats() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Float x = new Float(1.0); + + Class[] params = new Class[]{ + x.getClass() + }; + + Method method = cls.getDeclaredMethod("method", params); + Float returnValue = (Float) method.invoke(obj, x); + assertEquals(new Float(2.0), returnValue); + } + + @Test + public void testTwoLongs() throws Exception{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + Long x = new Long(1); + + Class[] params = new Class[]{ + x.getClass() + }; + + Method method = cls.getDeclaredMethod("method", params); + Long returnValue = (Long) method.invoke(obj, x); + assertEquals(new Long(3), returnValue); } } diff --git a/test/bytecode/types/OL.jav b/test/bytecode/types/OL.jav index f98887b20..c6349bdc2 100644 --- a/test/bytecode/types/OL.jav +++ b/test/bytecode/types/OL.jav @@ -1,16 +1,6 @@ class OL { - Integer m(Integer x) { return x + x; } + m(x) { return x + x; } - Boolean m(Boolean x) {return x || x; } -} - -class Main { - - main(x) { - ol; - ol = new OL(); - return ol.m(x); - } - -} + Boolean m(Boolean x) {return x; } +} \ No newline at end of file diff --git a/test/bytecode/types/OLTest.java b/test/bytecode/types/OLTest.java index a425b77ba..7f3263048 100644 --- a/test/bytecode/types/OLTest.java +++ b/test/bytecode/types/OLTest.java @@ -46,6 +46,32 @@ public class OLTest extends SourceFileBytecodeTest{ } } + @Test + public void testString() { + try{ + ClassLoader classLoader = getClassLoader(); + + Class cls = classLoader.loadClass(testName); + + Object obj = cls.newInstance(); + + File file = new File(rootDirectory); + URL url = file.toURL(); + URL[] urls = new URL[]{url}; + + String string = "foo"; + + Class[] params = new Class[1]; + params[0] = string.getClass(); + + Method method = cls.getDeclaredMethod("m", params); + method.invoke(obj, string); + assertTrue(true); + }catch(Exception e){ + throw new RuntimeException(e); + } + } + @Test public void testBoolen() { try{ From 46f1134bade8cd3179a67038be6aad1c039a09fa Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 29 Apr 2016 16:03:38 +0200 Subject: [PATCH 23/26] =?UTF-8?q?Aufr=C3=A4umen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/dhbwstuttgart/bytecode/ClassGenerator.java | 4 ++-- src/de/dhbwstuttgart/syntaxtree/Class.java | 2 +- .../dhbwstuttgart/typeinference/ConstraintsSet.java | 13 ------------- .../typeinference/TypeinferenceResults.java | 10 ++++++---- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/de/dhbwstuttgart/bytecode/ClassGenerator.java b/src/de/dhbwstuttgart/bytecode/ClassGenerator.java index 393d2e6ef..decb0f8bf 100644 --- a/src/de/dhbwstuttgart/bytecode/ClassGenerator.java +++ b/src/de/dhbwstuttgart/bytecode/ClassGenerator.java @@ -68,7 +68,7 @@ public class ClassGenerator extends ClassGen{ //return getNearestType((TypePlaceholder) t); return new TypePlaceholderType((TypePlaceholder) t); }else{ - return t.getBytecodeType(this, getTypeinferenceResults().getTypeReconstructions().firstElement()); + return t.getBytecodeType(this, getTypeinferenceResults().getTypeReconstructions().get(0)); } } public org.apache.commons.bcel6.generic.Type getNearestUsedType(TypePlaceholder toTPH){ @@ -150,7 +150,7 @@ public class ClassGenerator extends ClassGen{ TypePlaceholder tph = it.next(); //ret += tph.getBytecodeMethodSignature(this); //ret += ":"; - ret += tph.getClassSignature(this, getTypeinferenceResults().getTypeReconstructions().firstElement()); + ret += tph.getClassSignature(this, getTypeinferenceResults().getTypeReconstructions().get(0)); } ret += ">"; } diff --git a/src/de/dhbwstuttgart/syntaxtree/Class.java b/src/de/dhbwstuttgart/syntaxtree/Class.java index 5c46d4501..7e6ce4611 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Class.java +++ b/src/de/dhbwstuttgart/syntaxtree/Class.java @@ -111,7 +111,7 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I } InstructionList fieldInitializations = new InstructionList(); for(FieldDeclaration f : fieldDeclarations){ - fieldInitializations.append(f.genByteCode(_cg, typeinferenceResults.getTypeReconstructions().firstElement())); + fieldInitializations.append(f.genByteCode(_cg, typeinferenceResults.getTypeReconstructions().get(0))); } //Die Konstruktoren müssen die Feld initialisierungswerte beinhalten: for(Constructor c : constructors){ diff --git a/src/de/dhbwstuttgart/typeinference/ConstraintsSet.java b/src/de/dhbwstuttgart/typeinference/ConstraintsSet.java index e9f9918db..dd4a2ff1b 100755 --- a/src/de/dhbwstuttgart/typeinference/ConstraintsSet.java +++ b/src/de/dhbwstuttgart/typeinference/ConstraintsSet.java @@ -71,19 +71,6 @@ public class ConstraintsSet extends UndMenge implements Iterable filterUndConstraints() { - Vector ret = new Vector<>(); - for(OderConstraint con : constraintsSet){ - UndConstraint filtered = con.filterUndConstraints(); - if(filtered != null)ret.add(filtered); - } - return ret; - } public void add(UndConstraint singleConstraint) { OderConstraint toAdd = new OderConstraint(); diff --git a/src/de/dhbwstuttgart/typeinference/TypeinferenceResults.java b/src/de/dhbwstuttgart/typeinference/TypeinferenceResults.java index 5ce7a4456..d4f01d534 100644 --- a/src/de/dhbwstuttgart/typeinference/TypeinferenceResults.java +++ b/src/de/dhbwstuttgart/typeinference/TypeinferenceResults.java @@ -1,5 +1,7 @@ package de.dhbwstuttgart.typeinference; +import java.util.List; + import de.dhbwstuttgart.bytecode.ClassGenerator; import de.dhbwstuttgart.logger.Logger; import de.dhbwstuttgart.logger.Section; @@ -9,21 +11,21 @@ import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; public class TypeinferenceResults { - private Menge typeReconstructions; + private List typeReconstructions; public TypeinferenceResults() { typeReconstructions = new Menge<>(); } - public TypeinferenceResults(Menge typeReconstructions) { + public TypeinferenceResults(List typeReconstructions) { this.typeReconstructions = typeReconstructions; } - public Menge getTypeReconstructions() { + public List getTypeReconstructions() { return typeReconstructions; } - public Menge getTypeReconstructions(Method method, ClassGenerator cg) { + public List getTypeReconstructions(Method method, ClassGenerator cg) { return typeReconstructions; } } \ No newline at end of file From c2d3fce75ee6a53a5af621feb32160cd7daaadea Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Fri, 29 Apr 2016 16:52:35 +0200 Subject: [PATCH 24/26] FormalParameter getDiscription Fix --- src/de/dhbwstuttgart/syntaxtree/FormalParameter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java b/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java index f2f9099e3..bc529a129 100755 --- a/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java +++ b/src/de/dhbwstuttgart/syntaxtree/FormalParameter.java @@ -237,7 +237,7 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns public String getDescription(){ String ret = ""; if(this.getType() != null && !(this.getType() instanceof TypePlaceholder)){ - ret += this.getType().getBytecodeSignature(null, null); + ret += this.getType().toString();//getBytecodeSignature(null, null); } return ret+this.getIdentifier(); } From e5fc8c8288f20281c6bef4eb37a13c84bfc5d297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6dter?= Date: Sat, 30 Apr 2016 11:14:24 +0200 Subject: [PATCH 25/26] =?UTF-8?q?-=20Div=20und=20MulOperatoren=20f=C3=BCr?= =?UTF-8?q?=20alle=20numerischen=20Datentypen=20implementiert=20(Nur=20wen?= =?UTF-8?q?n=20beide=20Operanten=20den=20gleichen=20Typ=20haben)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../syntaxtree/operator/AddOp.java | 1 - .../syntaxtree/operator/DivideOp.java | 23 +++++++++++++--- .../syntaxtree/operator/MulOp.java | 27 ++++++++++++++++--- .../syntaxtree/operator/PlusOp.java | 1 - .../syntaxtree/operator/TimesOp.java | 19 ++++++++++--- test/bytecode/operators/DivOperator.jav | 2 +- test/bytecode/operators/MulOperator.jav | 2 +- 7 files changed, 62 insertions(+), 13 deletions(-) diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java index 8a8324c63..c2811decb 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/AddOp.java @@ -142,7 +142,6 @@ public abstract class AddOp extends Operator }else{ return type.get_Name(); } - } abstract ArithmeticInstruction getOperator(String returnType); diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java index 850d2ba0f..e776617cf 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/DivideOp.java @@ -3,9 +3,17 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.end // ino.module.DivideOp.8596.import import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.DADD; +import org.apache.commons.bcel6.generic.DDIV; +import org.apache.commons.bcel6.generic.FADD; +import org.apache.commons.bcel6.generic.FDIV; +import org.apache.commons.bcel6.generic.IADD; import org.apache.commons.bcel6.generic.IDIV; +import org.apache.commons.bcel6.generic.LADD; +import org.apache.commons.bcel6.generic.LDIV; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode; @@ -28,10 +36,19 @@ public class DivideOp extends MulOp super(offset,variableLength); } // ino.end - - @Override + ArithmeticInstruction getOperator(String returnType) { - return new IDIV(); + if(returnType.equals("java.lang.Integer")){ + return new IDIV(); + }else if(returnType.equals("java.lang.Double")){ + return new DDIV(); + }else if(returnType.equals("java.lang.Float")){ + return new FDIV(); + }else if(returnType.equals("java.lang.Long")){ + return new LDIV(); + }else{ + throw new NotImplementedException(); + } } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java index d0b335593..d84690d82 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/MulOp.java @@ -19,8 +19,11 @@ import de.dhbwstuttgart.bytecode.DHBWInstructionFactory; import de.dhbwstuttgart.myexception.CTypeReconstructionException; import de.dhbwstuttgart.syntaxtree.statement.Binary; import de.dhbwstuttgart.syntaxtree.statement.Expr; +import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType; import de.dhbwstuttgart.syntaxtree.type.RefType; +import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; import de.dhbwstuttgart.syntaxtree.type.Type; +import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.typeinference.Pair; import de.dhbwstuttgart.typeinference.TypeinferenceResultSet; import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; @@ -75,7 +78,7 @@ public abstract class MulOp extends Operator */ DHBWInstructionFactory _factory = _cg.getInstructionFactory(); - String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2()); + String returnType = getReturnType(operator.get_Expr1(), operator.get_Expr2(), rs); InstructionList il = getInstructionListForOperand(_cg, rs, operator.get_Expr1(), returnType); @@ -87,8 +90,20 @@ public abstract class MulOp extends Operator return il; } - private String getReturnType(Expr expr1, Expr expr2) { - return "java.lang.Integer"; + private String getReturnType(Expr expr1, Expr expr2, TypeinferenceResultSet rs) { + Type type = expr1.getType(); + if(type instanceof TypePlaceholder){ + Type tphType = rs.getTypeOfPlaceholder((TypePlaceholder) expr1.getType()); + if(tphType instanceof ExtendsWildcardType){ + return ((ExtendsWildcardType) tphType).get_ExtendsType().get_Name(); + }else if(tphType instanceof SuperWildcardType){ + return ((SuperWildcardType) tphType).get_SuperType().get_Name(); + }else{ + return tphType.getName().toString(); + } + }else{ + return type.get_Name(); + } } abstract ArithmeticInstruction getOperator(String returnType); @@ -96,6 +111,12 @@ public abstract class MulOp extends Operator private InvokeInstruction convertValueToObject(DHBWInstructionFactory _factory, String returnType) { if(returnType.equals("java.lang.Integer")){ return _factory.createInvoke("java.lang.Integer", "valueOf", new ObjectType("java.lang.Integer"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.INT}, Constants.INVOKESTATIC); + }else if(returnType.equals("java.lang.Double")){ + return _factory.createInvoke("java.lang.Double", "valueOf", new ObjectType("java.lang.Double"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.DOUBLE}, Constants.INVOKESTATIC); + }else if(returnType.equals("java.lang.Float")){ + return _factory.createInvoke("java.lang.Float", "valueOf", new ObjectType("java.lang.Float"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.FLOAT}, Constants.INVOKESTATIC); + }else if(returnType.equals("java.lang.Long")){ + return _factory.createInvoke("java.lang.Long", "valueOf", new ObjectType("java.lang.Long"), new org.apache.commons.bcel6.generic.Type[] {org.apache.commons.bcel6.generic.Type.LONG}, Constants.INVOKESTATIC); }else{ throw new NotImplementedException(); } diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java index 73acd1b93..53fbae1ca 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/PlusOp.java @@ -57,7 +57,6 @@ public class PlusOp extends AddOp }else{ throw new NotImplementedException(); } - } } // ino.end diff --git a/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java b/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java index c43ff29c2..e54693cbe 100755 --- a/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java +++ b/src/de/dhbwstuttgart/syntaxtree/operator/TimesOp.java @@ -4,9 +4,13 @@ package de.dhbwstuttgart.syntaxtree.operator; // ino.module.TimesOp.8611.import import de.dhbwstuttgart.typeinference.Menge; +import de.dhbwstuttgart.typeinference.exceptions.NotImplementedException; import org.apache.commons.bcel6.generic.ArithmeticInstruction; +import org.apache.commons.bcel6.generic.DMUL; +import org.apache.commons.bcel6.generic.FMUL; import org.apache.commons.bcel6.generic.IMUL; +import org.apache.commons.bcel6.generic.LMUL; import de.dhbwstuttgart.myexception.JVMCodeException; import de.dhbwstuttgart.syntaxtree.statement.Binary; @@ -25,10 +29,19 @@ public class TimesOp extends MulOp super(offset,variableLength); } // ino.end - - @Override + ArithmeticInstruction getOperator(String returnType) { - return new IMUL(); + if(returnType.equals("java.lang.Integer")){ + return new IMUL(); + }else if(returnType.equals("java.lang.Double")){ + return new DMUL(); + }else if(returnType.equals("java.lang.Float")){ + return new FMUL(); + }else if(returnType.equals("java.lang.Long")){ + return new LMUL(); + }else{ + throw new NotImplementedException(); + } } } diff --git a/test/bytecode/operators/DivOperator.jav b/test/bytecode/operators/DivOperator.jav index 6ba3d4fe4..d23c04baa 100644 --- a/test/bytecode/operators/DivOperator.jav +++ b/test/bytecode/operators/DivOperator.jav @@ -1,5 +1,5 @@ class DivOperator{ - Integer method(Integer x, Integer y){ + method(x, y){ return x / y; } } \ No newline at end of file diff --git a/test/bytecode/operators/MulOperator.jav b/test/bytecode/operators/MulOperator.jav index dd08e82e3..8efd6349f 100644 --- a/test/bytecode/operators/MulOperator.jav +++ b/test/bytecode/operators/MulOperator.jav @@ -1,5 +1,5 @@ class MulOperator{ - Integer method(Integer x, Integer y){ + method(x, y){ return x * y; } } \ No newline at end of file From ca8952a43c0e335be33906b396034709ac93f092 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Tue, 3 May 2016 12:46:32 +0200 Subject: [PATCH 26/26] Void Reference-Typen wieder zu Void RefTypes konvertieren --- src/de/dhbwstuttgart/logger/Logger.java | 1 + .../syntaxtree/factory/UnifyTypeFactory.java | 2 ++ test/unify/UnifyTest.java | 32 +++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/de/dhbwstuttgart/logger/Logger.java b/src/de/dhbwstuttgart/logger/Logger.java index c1bbd93e3..725c6fd5c 100755 --- a/src/de/dhbwstuttgart/logger/Logger.java +++ b/src/de/dhbwstuttgart/logger/Logger.java @@ -94,6 +94,7 @@ public class Logger { public static String getWholeLog(){ String ret = ""; + LOG_HISTORY.removeIf((logLine)->logLine==null); Logger.LOG_HISTORY.sort((log1, log2)->log1.timestamp.compareTo(log2.timestamp)); ret += Logger.LOG_HISTORY.toString(); return ret; diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java index 66553dc91..06069bc6a 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java @@ -15,6 +15,7 @@ import de.dhbwstuttgart.syntaxtree.type.RefType; import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType; import de.dhbwstuttgart.syntaxtree.type.Type; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; +import de.dhbwstuttgart.syntaxtree.type.Void; import de.dhbwstuttgart.syntaxtree.type.WildcardType; import de.dhbwstuttgart.typeinference.ConstraintsSet; import de.dhbwstuttgart.typeinference.EinzelElement; @@ -171,6 +172,7 @@ public class UnifyTypeFactory { public static Type convert(ReferenceType t) { //TODO: Hier kann man die GTVs extrahieren + if(t.getName() == "void")return new Void(NULL_NODE, 0); RefType ret = new RefType(t.getName(),null,0); ret.set_ParaList(convert(t.getTypeParams())); return ret; diff --git a/test/unify/UnifyTest.java b/test/unify/UnifyTest.java index d4f36b391..825fd40d2 100644 --- a/test/unify/UnifyTest.java +++ b/test/unify/UnifyTest.java @@ -850,6 +850,38 @@ public class UnifyTest { //Assert.assertEquals(expected, actual); } + @Test + public void unifyTestVector(){ + /* + * Vector < T1 + * T1 < Vector + */ + TypeFactory tf = new TypeFactory(); + FiniteClosureBuilder fcb = new FiniteClosureBuilder(); + + UnifyType tphT1 = tf.getPlaceholderType("T1"); + UnifyType tphT2 = tf.getPlaceholderType("T2"); + + UnifyType gtv = tf.getSimpleType("gtv"); + UnifyType vector = tf.getSimpleType("Vector", gtv); + UnifyType vectorE = tf.getSimpleType("Vector", tphT2); + UnifyType string = tf.getSimpleType("String"); + UnifyType vectorString = tf.getSimpleType("Vector", string); + + fcb.add(vector, vector); + + IFiniteClosure fc = fcb.getFiniteClosure(); + + Set eq = new HashSet(); + eq.add(new UnifyPair(tphT1, vectorString, PairOperator.SMALLERDOT)); + eq.add(new UnifyPair(vectorE, tphT1, PairOperator.SMALLERDOT)); + + Set> actual = new TypeUnify().unifySequential(eq, fc); + + System.out.println("Test OverloadingVector:"); + System.out.println(actual); + } + @Test public void unifyTestOverloading(){ /*