Merge mit Bytecode

This commit is contained in:
JanUlrich 2016-05-25 18:18:05 +02:00
commit 52b6f438b0
11 changed files with 67 additions and 93 deletions

View File

@ -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<org.apache.commons.bcel6.generic.Type[]> 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);

View File

@ -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(){

View File

@ -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<? super Integer> t){
}
}
//TODO: Die Klasse Type muss abstract werden!
// ino.class.Type.26716.declaration

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;

View File

@ -15,5 +15,4 @@ class Main {
return ol.m(x);
}
}
}

View File

@ -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);
}
}

View File

@ -1,13 +1,11 @@
import java.util.Vector;
class SuperType{
Vector<Number> numberVector;
void method() {
method(numberVector);
class WildcardTest{
void lower(Vector<? super Integer> v) {
}
void method(Vector<? super Integer> v) {
void upper(Vector<? extends Integer> v) {
}
}

View File

@ -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/";
}