Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2
This commit is contained in:
commit
cee86a6b61
@ -658,13 +658,13 @@ public class BytecodeGenMethod implements StatementVisitor {
|
|||||||
methodCall.arglist.accept(this);
|
methodCall.arglist.accept(this);
|
||||||
|
|
||||||
MethodFromMethodCall method = new MethodFromMethodCall(methodCall.arglist, methodCall.getType(),
|
MethodFromMethodCall method = new MethodFromMethodCall(methodCall.arglist, methodCall.getType(),
|
||||||
genericsAndBoundsMethod, genericsAndBounds);
|
receiverName, genericsAndBoundsMethod, genericsAndBounds);
|
||||||
String mDesc = method.accept(new DescriptorToString(resultSet));
|
String mDesc = method.accept(new DescriptorToString(resultSet));
|
||||||
System.out.println("Methodcall Desc : " + mDesc);
|
System.out.println("Methodcall Desc : " + mDesc);
|
||||||
// is methodCall.receiver functional Interface)?
|
// is methodCall.receiver functional Interface)?
|
||||||
if (varsFunInterface.contains(methodCall.receiver.getType())) {
|
if (varsFunInterface.contains(methodCall.receiver.getType())) {
|
||||||
mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, getResolvedType(methodCall.receiver.getType()), methodCall.name,
|
mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, getResolvedType(methodCall.receiver.getType()), methodCall.name,
|
||||||
mDesc, false);
|
mDesc, true);
|
||||||
} else {
|
} else {
|
||||||
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, getResolvedType(methodCall.receiver.getType()), methodCall.name,
|
mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, getResolvedType(methodCall.receiver.getType()), methodCall.name,
|
||||||
mDesc, isInterface);
|
mDesc, isInterface);
|
||||||
|
@ -172,7 +172,7 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
for(Expression e : methodFromMethodCall.getArgList().getArguments()) {
|
for(Expression e : methodFromMethodCall.getArgList().getArguments()) {
|
||||||
String d = resultSet.resolveType(e.getType()).resolvedType.acceptTV(new TypeToDescriptor());
|
String d = resultSet.resolveType(e.getType()).resolvedType.acceptTV(new TypeToDescriptor());
|
||||||
|
|
||||||
if(d.substring(0, 4).equals("TPH ") ||d.contains("<")) {
|
if(d.substring(0, 4).equals("TPH ") ||d.contains("<") || methodFromMethodCall.getReceiverName().contains("$$")) {
|
||||||
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
if(methodFromMethodCall.getGenericsAndBoundsMethod().containsKey(d)) {
|
if(methodFromMethodCall.getGenericsAndBoundsMethod().containsKey(d)) {
|
||||||
@ -189,7 +189,7 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
System.out.println("DescriptorToString retType = " + retType);
|
System.out.println("DescriptorToString retType = " + retType);
|
||||||
if(retType.equals("void")) {
|
if(retType.equals("void")) {
|
||||||
desc += ")V";
|
desc += ")V";
|
||||||
}else if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<")){
|
}else if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<") || methodFromMethodCall.getReceiverName().contains("$$")){
|
||||||
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
if(methodFromMethodCall.getGenericsAndBoundsMethod().containsKey(retType)) {
|
if(methodFromMethodCall.getGenericsAndBoundsMethod().containsKey(retType)) {
|
||||||
|
@ -9,13 +9,16 @@ import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
|||||||
public class MethodFromMethodCall {
|
public class MethodFromMethodCall {
|
||||||
private ArgumentList argList;
|
private ArgumentList argList;
|
||||||
private RefTypeOrTPHOrWildcardOrGeneric returnType;
|
private RefTypeOrTPHOrWildcardOrGeneric returnType;
|
||||||
|
private String receiverName;
|
||||||
private HashMap<String, String> genericsAndBoundsMethod;
|
private HashMap<String, String> genericsAndBoundsMethod;
|
||||||
private HashMap<String,String> genericsAndBounds;
|
private HashMap<String,String> genericsAndBounds;
|
||||||
|
|
||||||
public MethodFromMethodCall(ArgumentList argList,RefTypeOrTPHOrWildcardOrGeneric returnType,
|
public MethodFromMethodCall(ArgumentList argList,RefTypeOrTPHOrWildcardOrGeneric returnType,
|
||||||
HashMap<String, String> genericsAndBoundsMethod,HashMap<String,String> genericsAndBounds) {
|
String receiverName, HashMap<String, String> genericsAndBoundsMethod,
|
||||||
|
HashMap<String,String> genericsAndBounds) {
|
||||||
this.argList = argList;
|
this.argList = argList;
|
||||||
this.returnType = returnType;
|
this.returnType = returnType;
|
||||||
|
this.receiverName = receiverName;
|
||||||
this.genericsAndBoundsMethod = genericsAndBoundsMethod;
|
this.genericsAndBoundsMethod = genericsAndBoundsMethod;
|
||||||
this.genericsAndBounds = genericsAndBounds;
|
this.genericsAndBounds = genericsAndBounds;
|
||||||
}
|
}
|
||||||
@ -28,6 +31,10 @@ public class MethodFromMethodCall {
|
|||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getReceiverName() {
|
||||||
|
return receiverName;
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<String, String> getGenericsAndBoundsMethod(){
|
public HashMap<String, String> getGenericsAndBoundsMethod(){
|
||||||
return genericsAndBoundsMethod;
|
return genericsAndBoundsMethod;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ public class Lambda {
|
|||||||
var lam1 = (x) -> {
|
var lam1 = (x) -> {
|
||||||
return x;
|
return x;
|
||||||
};
|
};
|
||||||
|
|
||||||
return lam1.apply(new Apply());
|
return lam1.apply(new Apply());
|
||||||
//return lam1;
|
//return lam1;
|
||||||
// return new Vector();
|
// return new Vector();
|
||||||
|
Loading…
Reference in New Issue
Block a user