Fix incorrect signatures

This commit is contained in:
Daniel Holle 2023-05-24 16:51:53 +02:00
parent 1d7e755a98
commit 337ff8b865
4 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,5 @@
import java.lang.Integer;
//import java.lang.Double;
import java.lang.Double;
public class Fac {

View File

@ -1,4 +1,4 @@
public class Id {
public class Id <FAU> {
// a;
// id(b){
// return b;

View File

@ -33,18 +33,22 @@ public class FunNGenerator {
private static String applyDescriptor(TargetType type, int[] start) {
var res = "L" + type.getInternalName() + "<";
var res = "L" + type.getInternalName();
if (type instanceof TargetSpecializedType a)
for (var param : a.params()) {
if (param instanceof TargetGenericType gp) {
res += "TT" + start[0] + ";";
start[0] += 1;
} else {
res += applyDescriptor(param, start);
if (a.params().size() > 0) {
res += "<";
for (var param : a.params()) {
if (param instanceof TargetGenericType gp) {
res += "TT" + start[0] + ";";
start[0] += 1;
} else {
res += applyDescriptor(param, start);
}
}
res += ">";
}
else return type.toDescriptor();
res += ">;";
res += ";";
return res;
}

View File

@ -156,6 +156,7 @@ public class ASTFactory {
List<FormalParameter> params = new ArrayList<>();
int i = 0;
for(Type jreParam : jreGenericParams){
if (jreParam == null) continue;
RefTypeOrTPHOrWildcardOrGeneric paramType = createType(jreParam);
params.add(new FormalParameter(jreParams[i].getName(),paramType, new NullToken()));
i++;
@ -188,6 +189,7 @@ public class ASTFactory {
List<FormalParameter> params = new ArrayList<>();
int i = 0;
for(Type jreParam : jreGenericParams){
if (jreParam == null) continue;
RefTypeOrTPHOrWildcardOrGeneric paramType = createType(jreParam);
params.add(new FormalParameter(jreParams[i].getName(),paramType, new NullToken()));
i++;
@ -333,7 +335,7 @@ public class ASTFactory {
}
private static RefTypeOrTPHOrWildcardOrGeneric createType(java.lang.reflect.Type type){
if(type.getTypeName().equals("void")){
if(type == null || type.getTypeName().equals("void")){
return new Void(new NullToken());
}else if(type.getTypeName().equals("int")){
return new RefType(new JavaClassName("java.lang.Integer"), new ArrayList<>(), new NullToken());