diff --git a/src/de/dhbwstuttgart/syntaxtree/Method.java b/src/de/dhbwstuttgart/syntaxtree/Method.java index dfff897c..c50f8416 100755 --- a/src/de/dhbwstuttgart/syntaxtree/Method.java +++ b/src/de/dhbwstuttgart/syntaxtree/Method.java @@ -78,15 +78,12 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable private Modifiers modifiers; protected static Logger inferencelog = Logger.getLogger("inference"); protected static Logger parserlog = Logger.getLogger("parser"); - - protected Menge createdMethods = new Menge<>(); public Method(int offset) { super(offset); } - public Method(String name, Type returnType, ParameterList parameterList, - Block block, GenericDeclarationList gtvDeclarations, int offset) { + public Method(String name, Type returnType, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, int offset) { this(offset); /* * if(parameterList != null)parameterList.parserPostProcessing(this); diff --git a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java index 20e8fe25..2df27dba 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/RefType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/RefType.java @@ -602,17 +602,18 @@ public class RefType extends ObjectType implements IMatchable sb.append(((RefType) type).getCombinedType(cg, rs).replace(".", "%")); }else if(type instanceof TypePlaceholder){ sb.append(((TypePlaceholder) type).getBytecodeType(cg, rs).toString().replace(".", "%")); + }else if(type instanceof WildcardType){ + return this.getName().toString(); }else{ sb.append(type.getBytecodeType(cg, rs).toString().replace(".", "%")); } sb.append("%"); } - }else{ - sb.append(this.getName().toString()); - } + return sb.toString(); + } - return sb.toString(); + return sb.append(this.getName().toString()).toString(); } public GenericClassType getGenericClassType(){ diff --git a/src/de/dhbwstuttgart/syntaxtree/type/Type.java b/src/de/dhbwstuttgart/syntaxtree/type/Type.java index 7d57e1e9..6fc42efa 100755 --- a/src/de/dhbwstuttgart/syntaxtree/type/Type.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/Type.java @@ -17,11 +17,6 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions; import de.dhbwstuttgart.typeinference.exceptions.DebugException; import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException; -class Test { - void methode(ArrayList t){ - - } -} //TODO: Die Klasse Type muss abstract werden! // ino.class.Type.26716.declaration diff --git a/test/bytecode/UninitializedVariable.jav b/test/bytecode/UninitializedVariable.jav new file mode 100644 index 00000000..0854d0a9 --- /dev/null +++ b/test/bytecode/UninitializedVariable.jav @@ -0,0 +1,15 @@ +import java.util.Vector; + +class UninitializedVariable{ + + Integer method(Integer v) { + return v; + } + + public static void main(String[] args) { + UninitializedVariable ol; + ol = new UninitializedVariable(); + Integer v; + ol.method(v); + } +} \ No newline at end of file diff --git a/test/bytecode/UninitializedVariableTest.java b/test/bytecode/UninitializedVariableTest.java new file mode 100644 index 00000000..838d9708 --- /dev/null +++ b/test/bytecode/UninitializedVariableTest.java @@ -0,0 +1,39 @@ +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 UninitializedVariableTest extends SourceFileBytecodeTest{ + @Override + protected void init() { + testName = "UninitializedVariable"; + 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); + } +} diff --git a/test/bytecode/types/ExtendsTypeTest.java b/test/bytecode/types/ExtendsTypeTest.java deleted file mode 100644 index a3560b9c..00000000 --- a/test/bytecode/types/ExtendsTypeTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package bytecode.types; - -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 ExtendsTypeTest extends SourceFileBytecodeTest{ - @Override - protected void init() { - testName = "ExtendsType"; - rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; - } - - @Test - @Ignore - public void testConstruct() throws Exception{ - ClassLoader classLoader = getClassLoader(); - - Class cls = classLoader.loadClass(testName); - - Object obj = cls.newInstance(); - assertTrue(true); - } -} diff --git a/test/bytecode/types/ExtendsVectorStringTest.java b/test/bytecode/types/ExtendsVectorStringTest.java index f92c61ad..c106fbee 100644 --- a/test/bytecode/types/ExtendsVectorStringTest.java +++ b/test/bytecode/types/ExtendsVectorStringTest.java @@ -61,7 +61,7 @@ public class ExtendsVectorStringTest extends ASTBytecodeTest{ Object obj = cls.newInstance(); - Class objectClass = classLoader.loadClass("java.lang.Object"); + Class objectClass = classLoader.loadClass("java.lang.String"); Class[] params = new Class[1]; params[0] = objectClass; diff --git a/test/bytecode/types/OL.jav b/test/bytecode/types/OL.jav index 30bf0906..080a2542 100644 --- a/test/bytecode/types/OL.jav +++ b/test/bytecode/types/OL.jav @@ -15,5 +15,4 @@ class Main { return ol.m(x); } -} - +} \ No newline at end of file diff --git a/test/bytecode/types/SuperType.java b/test/bytecode/types/SuperType.java deleted file mode 100644 index 42a8d77b..00000000 --- a/test/bytecode/types/SuperType.java +++ /dev/null @@ -1,37 +0,0 @@ -package bytecode.types; - -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 SuperType extends SourceFileBytecodeTest{ - - @Override - protected void init() { - testName = "ExtendsType"; - rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; - } - - @Test - @Ignore - public void testConstruct() throws Exception{ - ClassLoader classLoader = getClassLoader(); - - Class cls = classLoader.loadClass(testName); - - Object obj = cls.newInstance(); - assertTrue(true); - } -} diff --git a/test/bytecode/types/WildcardTest.jav b/test/bytecode/types/WildcardTest.jav index f029c2d0..647d7b66 100644 --- a/test/bytecode/types/WildcardTest.jav +++ b/test/bytecode/types/WildcardTest.jav @@ -1,13 +1,11 @@ import java.util.Vector; -class SuperType{ - Vector numberVector; - - void method() { - method(numberVector); +class WildcardTest{ + void lower(Vector v) { + } - void method(Vector v) { + void upper(Vector v) { } } \ No newline at end of file diff --git a/test/bytecode/types/WildcardTest.java b/test/bytecode/types/WildcardTest.java index 6dd41df8..44df73a9 100644 --- a/test/bytecode/types/WildcardTest.java +++ b/test/bytecode/types/WildcardTest.java @@ -12,7 +12,7 @@ import bytecode.SourceFileBytecodeTest; public class WildcardTest extends SourceFileBytecodeTest{ @Override protected void init() { - testName = "Wildcard"; + testName = "WildcardTest"; rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/"; }