forked from JavaTX/JavaCompilerCore
Merge mit unify
This commit is contained in:
commit
040a1f4088
@ -18,6 +18,7 @@ public class JavaClassName {
|
|||||||
|
|
||||||
public JavaClassName(String name){
|
public JavaClassName(String name){
|
||||||
if(name == null)throw new NullPointerException();
|
if(name == null)throw new NullPointerException();
|
||||||
|
|
||||||
String[] names = name.split("[.]");
|
String[] names = name.split("[.]");
|
||||||
boolean match = true;
|
boolean match = true;
|
||||||
if(names.length == 1){
|
if(names.length == 1){
|
||||||
|
@ -53,4 +53,10 @@ public class ASTFactory {
|
|||||||
|
|
||||||
return generatedClass;
|
return generatedClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Class createObjectClass() {
|
||||||
|
Class generatedClass = new Class("java.lang.Object", 0);
|
||||||
|
|
||||||
|
return generatedClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -850,14 +850,15 @@ public class RefType extends ObjectType implements IMatchable
|
|||||||
|
|
||||||
//TODO: bytecode woher bekommt ich die parent klasse
|
//TODO: bytecode woher bekommt ich die parent klasse
|
||||||
String combinedType = getCombinedType(cg);
|
String combinedType = getCombinedType(cg);
|
||||||
if(!combinedType.equals(get_Name())){
|
if(!combinedType.equals(getName().toString())){
|
||||||
// TODO bytecode createClass
|
// TODO bytecode statt getParentClass die eigene Class?!?!
|
||||||
Class generatedClass = ASTFactory.createClass(getCombinedType(cg), getParentClass());
|
Class classObject = ASTFactory.createClass(getName().toString(), ASTFactory.createObjectClass());
|
||||||
|
Class generatedClass = ASTFactory.createClass(getCombinedType(cg), classObject);
|
||||||
|
|
||||||
cg.addExtraClass(generatedClass.genByteCode(new TypeinferenceResultSet(generatedClass, new Menge<>(), new ResultSet())).getByteCode());
|
cg.addExtraClass(generatedClass.genByteCode(new TypeinferenceResultSet(generatedClass, new Menge<>(), new ResultSet())).getByteCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
return "L"+getCombinedType(cg)+";";
|
return "L"+combinedType+";";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCombinedType(ClassGenerator cg){
|
public String getCombinedType(ClassGenerator cg){
|
||||||
@ -865,14 +866,14 @@ public class RefType extends ObjectType implements IMatchable
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
if(parameter != null && parameter.size() > 0){
|
if(parameter != null && parameter.size() > 0){
|
||||||
sb.append(this.get_Name().replace(".", "%"));
|
sb.append(getName().toString().replace(".", "%"));
|
||||||
sb.append("%%");
|
sb.append("%%");
|
||||||
for(Type type: parameter){
|
for(Type type: parameter){
|
||||||
sb.append(((RefType) type).getCombinedType(cg).replace(".", "%"));
|
sb.append(((RefType) type).getCombinedType(cg).replace(".", "%"));
|
||||||
sb.append("%");
|
sb.append("%");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
sb.append(this.get_Name());
|
sb.append(this.getName().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
12
test/bytecode/types/Test.java
Normal file
12
test/bytecode/types/Test.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Overloading o = new Overloading();
|
||||||
|
Vector<String> stringVector = new Vector<String>();
|
||||||
|
|
||||||
|
o.method(stringVector);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user