Anmerkungen zur Type Erasure und weitere Stellen zur Änderung markiert.
This commit is contained in:
parent
7eaddd67a3
commit
2ba966a4e7
@ -876,6 +876,7 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
if(parentBinary || isBinaryExp) {
|
if(parentBinary || isBinaryExp) {
|
||||||
doUnboxing(resolver.getResolvedType(methodCall.getType()));
|
doUnboxing(resolver.getResolvedType(methodCall.getType()));
|
||||||
}
|
}
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
} else if(receiverName.contains(CONSTANTS.$$) && !methCallType.equals(Type.getInternalName(Object.class))) {
|
} else if(receiverName.contains(CONSTANTS.$$) && !methCallType.equals(Type.getInternalName(Object.class))) {
|
||||||
helper.createCheckCast(methodCall,mv);
|
helper.createCheckCast(methodCall,mv);
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
//TODO: generate a class java%% ... %%
|
//TODO: generate a class java%% ... %%
|
||||||
else if(resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor()).contains(CONSTANTS.ANGLEBRACKET)){
|
else if(resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor()).contains(CONSTANTS.ANGLEBRACKET)){
|
||||||
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "$$").replace(CONSTANTS.ANGLEBRACKET, "$$$").replace(">", "$$$")+ ";";
|
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "$$").replace(CONSTANTS.ANGLEBRACKET, "$$$").replace(">", "$$$")+ ";";
|
||||||
|
@ -19,6 +19,12 @@ import java.io.IOException;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
//ToDo Etienne: Anpassung für TypeErasure
|
//ToDo Etienne: Anpassung für TypeErasure
|
||||||
|
//static Attribut (HashSet<int>) welches Anzahl Attribute hält -> Wenn Anzahl Attribute vorhanden, dann existiert Interface bereits
|
||||||
|
//schneller als bytecode auf Vorhandensein zu prüfen?!
|
||||||
|
//Wenn FunN$$ nicht vorhanden, dann erstellen
|
||||||
|
//Name ändern nach Konvention (FunN$$$_$...$_$)
|
||||||
|
//Muss FunN$$$_$...$_$ nun Interface sein oder?
|
||||||
|
//Frage: Worin wird Implementierung "gespeichert"?! --> Was/Wo ist der Bytecode hierfür?
|
||||||
public class ByteCodeForFunNGenerator {
|
public class ByteCodeForFunNGenerator {
|
||||||
|
|
||||||
public static void generateBCForFunN(LambdaExpression lambdaExpression, String methDesc, File path) {
|
public static void generateBCForFunN(LambdaExpression lambdaExpression, String methDesc, File path) {
|
||||||
|
@ -185,6 +185,7 @@ public class TypeGenerator {
|
|||||||
}else{
|
}else{
|
||||||
Pattern p = Pattern.compile("Fun(\\d+)[$][$]");
|
Pattern p = Pattern.compile("Fun(\\d+)[$][$]");
|
||||||
Matcher m = p.matcher(name);
|
Matcher m = p.matcher(name);
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
if (m.matches()) {//es ist FunN$$-Type
|
if (m.matches()) {//es ist FunN$$-Type
|
||||||
return new RefType(new JavaClassName(name), convert(typeArguments, reg, generics), offset);
|
return new RefType(new JavaClassName(name), convert(typeArguments, reg, generics), offset);
|
||||||
} else {
|
} else {
|
||||||
|
@ -63,6 +63,7 @@ public class MethodAssumption extends Assumption{
|
|||||||
//Die Generics werden alle zu TPHs umgewandelt.
|
//Die Generics werden alle zu TPHs umgewandelt.
|
||||||
params.add(resolver.resolve(new GenericRefType(gtv.getName(), new NullToken())));
|
params.add(resolver.resolve(new GenericRefType(gtv.getName(), new NullToken())));
|
||||||
}
|
}
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
RefTypeOrTPHOrWildcardOrGeneric receiverType;
|
RefTypeOrTPHOrWildcardOrGeneric receiverType;
|
||||||
if(receiver instanceof FunNClass){
|
if(receiver instanceof FunNClass){
|
||||||
receiverType = new RefType(new JavaClassName(receiver.getClassName().toString()+"$$"), params, new NullToken()); // new FunN(params);
|
receiverType = new RefType(new JavaClassName(receiver.getClassName().toString()+"$$"), params, new NullToken()); // new FunN(params);
|
||||||
|
@ -68,6 +68,7 @@ public class TYPEStmt implements StatementVisitor{
|
|||||||
lambdaParams.add(tphRetType);
|
lambdaParams.add(tphRetType);
|
||||||
//lambdaParams.add(0,tphRetType);
|
//lambdaParams.add(0,tphRetType);
|
||||||
constraintsSet.addUndConstraint(
|
constraintsSet.addUndConstraint(
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
new Pair(lambdaExpression.getType(),
|
new Pair(lambdaExpression.getType(),
|
||||||
new RefType(new JavaClassName("Fun"+(lambdaParams.size()-1)+"$$"), lambdaParams, new NullToken()),
|
new RefType(new JavaClassName("Fun"+(lambdaParams.size()-1)+"$$"), lambdaParams, new NullToken()),
|
||||||
//new FunN(lambdaParams),
|
//new FunN(lambdaParams),
|
||||||
|
@ -21,6 +21,7 @@ public class FunNType extends UnifyType {
|
|||||||
/**
|
/**
|
||||||
* Creates a FunN-Type with the specified TypeParameters.
|
* Creates a FunN-Type with the specified TypeParameters.
|
||||||
*/
|
*/
|
||||||
|
//ToDo Etienne: Für Type Erasure wichtig?!
|
||||||
protected FunNType(TypeParams p) {
|
protected FunNType(TypeParams p) {
|
||||||
super("Fun"+(p.size()-1)+"$$", p);
|
super("Fun"+(p.size()-1)+"$$", p);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user