subString durch contains ersetzt
This commit is contained in:
parent
6a2a8313e6
commit
ee932892c6
@ -356,7 +356,7 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
System.out.println(acc);
|
System.out.println(acc);
|
||||||
|
|
||||||
/*Prüfe, ob die Rückgabe-Type der Methode eine Type-Variable ist*/
|
/*Prüfe, ob die Rückgabe-Type der Methode eine Type-Variable ist*/
|
||||||
boolean hasGenInParameterList = genericsAndBounds.containsKey(retType) || retType.subSequence(0, 4).equals("TPH ") ||
|
boolean hasGenInParameterList = genericsAndBounds.containsKey(retType) || retType.contains("TPH ") ||
|
||||||
resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature()).contains("<");
|
resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature()).contains("<");
|
||||||
/*Wenn die Rückgabe-Type eine Typ-variable ist, erzeuge direkt die Signature, wenn nicht,
|
/*Wenn die Rückgabe-Type eine Typ-variable ist, erzeuge direkt die Signature, wenn nicht,
|
||||||
* prüfe, ob einer der Parameter Typ-Variable als Typ hat*/
|
* prüfe, ob einer der Parameter Typ-Variable als Typ hat*/
|
||||||
@ -364,7 +364,7 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
for(String paramName : methodParamsAndTypes.keySet()) {
|
for(String paramName : methodParamsAndTypes.keySet()) {
|
||||||
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToDescriptor());
|
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToDescriptor());
|
||||||
String sigOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToSignature());
|
String sigOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToSignature());
|
||||||
if(genericsAndBounds.containsKey(typeOfParam)||typeOfParam.substring(0, 4).equals("TPH ")||sigOfParam.contains("<")) {
|
if(genericsAndBounds.containsKey(typeOfParam)||typeOfParam.contains("TPH ")||sigOfParam.contains("<")) {
|
||||||
hasGenInParameterList = true;
|
hasGenInParameterList = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
while(itr.hasNext()) {
|
while(itr.hasNext()) {
|
||||||
FormalParameter fp = itr.next();
|
FormalParameter fp = itr.next();
|
||||||
String d = resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor());
|
String d = resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor());
|
||||||
if(d.substring(0, 4).equals("TPH ") ||d.contains("<")) {
|
if(d.contains("TPH ") ||d.contains("<")) {
|
||||||
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
desc = desc + "L"+ d + ";";
|
desc = desc + "L"+ d + ";";
|
||||||
@ -171,7 +171,7 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
|
|
||||||
String retType = resultSet.resolveType(lambdaExpression.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
|
String retType = resultSet.resolveType(lambdaExpression.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
|
||||||
|
|
||||||
if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<")){
|
if(retType.contains("TPH ")|| retType.contains("<")){
|
||||||
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
desc = desc + ")"+"L"+retType+";";
|
desc = desc + ")"+"L"+retType+";";
|
||||||
@ -187,7 +187,7 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
RefTypeOrTPHOrWildcardOrGeneric rt = itr.next();
|
RefTypeOrTPHOrWildcardOrGeneric rt = itr.next();
|
||||||
String d = resultSet.resolveType(rt).resolvedType.acceptTV(new TypeToDescriptor());
|
String d = resultSet.resolveType(rt).resolvedType.acceptTV(new TypeToDescriptor());
|
||||||
|
|
||||||
if(d.substring(0, 4).equals("TPH ") ||d.contains("<")) {
|
if(d.contains("TPH ") ||d.contains("<")) {
|
||||||
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
desc += "L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
desc += "L"+ d + ";";
|
desc += "L"+ d + ";";
|
||||||
@ -196,7 +196,7 @@ public class DescriptorToString implements DescriptorVisitor{
|
|||||||
}
|
}
|
||||||
String retType = resultSet.resolveType(samMethod.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
|
String retType = resultSet.resolveType(samMethod.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
|
||||||
|
|
||||||
if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<")){
|
if(retType.contains("TPH ")|| retType.contains("<")){
|
||||||
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
desc += ")L"+Type.getInternalName(Object.class)+ ";";
|
||||||
}else {
|
}else {
|
||||||
desc = desc + ")"+"L"+retType+";";
|
desc = desc + ")"+"L"+retType+";";
|
||||||
@ -210,7 +210,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("<") || methodFromMethodCall.getReceiverName().contains("$$")) {
|
if(d.contains("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)) {
|
||||||
@ -227,7 +227,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("<") || methodFromMethodCall.getReceiverName().contains("$$")){
|
}else if(retType.contains("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)) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
public class TypedID<L extends K,K> {
|
public class TypedID/*<L extends K,K> */ {
|
||||||
|
|
||||||
id(L b){
|
<K> id(K b){
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user