Merge mit unify

This commit is contained in:
JanUlrich 2015-10-23 18:07:37 +02:00
commit 040a1f4088
4 changed files with 26 additions and 6 deletions

View File

@ -18,6 +18,7 @@ public class JavaClassName {
public JavaClassName(String name){
if(name == null)throw new NullPointerException();
String[] names = name.split("[.]");
boolean match = true;
if(names.length == 1){

View File

@ -53,4 +53,10 @@ public class ASTFactory {
return generatedClass;
}
public static Class createObjectClass() {
Class generatedClass = new Class("java.lang.Object", 0);
return generatedClass;
}
}

View File

@ -850,14 +850,15 @@ public class RefType extends ObjectType implements IMatchable
//TODO: bytecode woher bekommt ich die parent klasse
String combinedType = getCombinedType(cg);
if(!combinedType.equals(get_Name())){
// TODO bytecode createClass
Class generatedClass = ASTFactory.createClass(getCombinedType(cg), getParentClass());
if(!combinedType.equals(getName().toString())){
// TODO bytecode statt getParentClass die eigene Class?!?!
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());
}
return "L"+getCombinedType(cg)+";";
return "L"+combinedType+";";
}
public String getCombinedType(ClassGenerator cg){
@ -865,14 +866,14 @@ public class RefType extends ObjectType implements IMatchable
StringBuilder sb = new StringBuilder();
if(parameter != null && parameter.size() > 0){
sb.append(this.get_Name().replace(".", "%"));
sb.append(getName().toString().replace(".", "%"));
sb.append("%%");
for(Type type: parameter){
sb.append(((RefType) type).getCombinedType(cg).replace(".", "%"));
sb.append("%");
}
}else{
sb.append(this.get_Name());
sb.append(this.getName().toString());
}
return sb.toString();

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