forked from JavaTX/JavaCompilerCore
Merge mit Bytecode
This commit is contained in:
commit
52b6f438b0
@ -78,15 +78,12 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
|
|||||||
private Modifiers modifiers;
|
private Modifiers modifiers;
|
||||||
protected static Logger inferencelog = Logger.getLogger("inference");
|
protected static Logger inferencelog = Logger.getLogger("inference");
|
||||||
protected static Logger parserlog = Logger.getLogger("parser");
|
protected static Logger parserlog = Logger.getLogger("parser");
|
||||||
|
|
||||||
protected Menge<org.apache.commons.bcel6.generic.Type[]> createdMethods = new Menge<>();
|
|
||||||
|
|
||||||
public Method(int offset) {
|
public Method(int offset) {
|
||||||
super(offset);
|
super(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Method(String name, Type returnType, ParameterList parameterList,
|
public Method(String name, Type returnType, ParameterList parameterList, Block block, GenericDeclarationList gtvDeclarations, int offset) {
|
||||||
Block block, GenericDeclarationList gtvDeclarations, int offset) {
|
|
||||||
this(offset);
|
this(offset);
|
||||||
/*
|
/*
|
||||||
* if(parameterList != null)parameterList.parserPostProcessing(this);
|
* if(parameterList != null)parameterList.parserPostProcessing(this);
|
||||||
|
@ -602,17 +602,18 @@ public class RefType extends ObjectType implements IMatchable
|
|||||||
sb.append(((RefType) type).getCombinedType(cg, rs).replace(".", "%"));
|
sb.append(((RefType) type).getCombinedType(cg, rs).replace(".", "%"));
|
||||||
}else if(type instanceof TypePlaceholder){
|
}else if(type instanceof TypePlaceholder){
|
||||||
sb.append(((TypePlaceholder) type).getBytecodeType(cg, rs).toString().replace(".", "%"));
|
sb.append(((TypePlaceholder) type).getBytecodeType(cg, rs).toString().replace(".", "%"));
|
||||||
|
}else if(type instanceof WildcardType){
|
||||||
|
return this.getName().toString();
|
||||||
}else{
|
}else{
|
||||||
sb.append(type.getBytecodeType(cg, rs).toString().replace(".", "%"));
|
sb.append(type.getBytecodeType(cg, rs).toString().replace(".", "%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.append("%");
|
sb.append("%");
|
||||||
}
|
}
|
||||||
}else{
|
return sb.toString();
|
||||||
sb.append(this.getName().toString());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
return sb.append(this.getName().toString()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericClassType getGenericClassType(){
|
public GenericClassType getGenericClassType(){
|
||||||
|
@ -17,11 +17,6 @@ import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
|
|||||||
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||||
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||||
|
|
||||||
class Test {
|
|
||||||
void methode(ArrayList<? super Integer> t){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Die Klasse Type muss abstract werden!
|
//TODO: Die Klasse Type muss abstract werden!
|
||||||
// ino.class.Type.26716.declaration
|
// ino.class.Type.26716.declaration
|
||||||
|
15
test/bytecode/UninitializedVariable.jav
Normal file
15
test/bytecode/UninitializedVariable.jav
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
39
test/bytecode/UninitializedVariableTest.java
Normal file
39
test/bytecode/UninitializedVariableTest.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -61,7 +61,7 @@ public class ExtendsVectorStringTest extends ASTBytecodeTest{
|
|||||||
|
|
||||||
Object obj = cls.newInstance();
|
Object obj = cls.newInstance();
|
||||||
|
|
||||||
Class objectClass = classLoader.loadClass("java.lang.Object");
|
Class objectClass = classLoader.loadClass("java.lang.String");
|
||||||
|
|
||||||
Class[] params = new Class[1];
|
Class[] params = new Class[1];
|
||||||
params[0] = objectClass;
|
params[0] = objectClass;
|
||||||
|
@ -15,5 +15,4 @@ class Main {
|
|||||||
return ol.m(x);
|
return ol.m(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +1,11 @@
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
class SuperType{
|
class WildcardTest{
|
||||||
Vector<Number> numberVector;
|
void lower(Vector<? super Integer> v) {
|
||||||
|
|
||||||
void method() {
|
|
||||||
method(numberVector);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void method(Vector<? super Integer> v) {
|
void upper(Vector<? extends Integer> v) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ import bytecode.SourceFileBytecodeTest;
|
|||||||
public class WildcardTest extends SourceFileBytecodeTest{
|
public class WildcardTest extends SourceFileBytecodeTest{
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
testName = "Wildcard";
|
testName = "WildcardTest";
|
||||||
rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/";
|
rootDirectory = System.getProperty("user.dir")+"/test/bytecode/types/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user