We actually need the signature of the class
This commit is contained in:
parent
21fb477ee1
commit
62fad15b6f
@ -979,7 +979,7 @@ public class Codegen {
|
||||
}
|
||||
|
||||
private void generateConstructor(TargetConstructor constructor) {
|
||||
MethodVisitor mv = cw.visitMethod(constructor.access() | ACC_PUBLIC, "<init>", constructor.getDescriptor(), null, null);
|
||||
MethodVisitor mv = cw.visitMethod(constructor.access() | ACC_PUBLIC, "<init>", constructor.getDescriptor(), constructor.getSignature(), null);
|
||||
mv.visitCode();
|
||||
var state = new State(null, mv, 1);
|
||||
for (var param: constructor.parameters())
|
||||
@ -1028,7 +1028,7 @@ public class Codegen {
|
||||
|
||||
public byte[] generate() {
|
||||
cw.visit(V1_8, clazz.modifiers() | ACC_PUBLIC | ACC_SUPER, clazz.qualifiedName(),
|
||||
null, clazz.superType() != null ? clazz.superType().getInternalName(): "java/lang/Object",
|
||||
generateSignature(clazz), clazz.superType() != null ? clazz.superType().getInternalName(): "java/lang/Object",
|
||||
clazz.implementingInterfaces().stream().map(TargetType::toSignature).toArray(String[]::new)
|
||||
);
|
||||
clazz.fields().forEach(this::generateField);
|
||||
|
@ -135,7 +135,7 @@ public class ASTToTargetAST {
|
||||
typeVariablesOfFields.addAll(findTypeVariables(field.getType()));
|
||||
}
|
||||
|
||||
//findTypeVariables(method.getReturnType(), typeVariables);
|
||||
typeVariables.addAll(findTypeVariables(method.getReturnType()));
|
||||
for (var arg : method.getParameterList().getFormalparalist()) {
|
||||
typeVariables.addAll(findTypeVariables(arg.getType()));
|
||||
}
|
||||
@ -459,7 +459,6 @@ public class ASTToTargetAST {
|
||||
addToPairs(result, new PairTPHequalRefTypeOrWildcardType(pair.right, OBJECT));
|
||||
}
|
||||
}
|
||||
|
||||
eliminateCyclesAndInfima(result);
|
||||
usedTPHsOfMethods.put(method, typeVariables);
|
||||
|
||||
@ -471,7 +470,7 @@ public class ASTToTargetAST {
|
||||
}
|
||||
typeVariablesOfSignature.addAll(findTypeVariables(method.getReturnType()));
|
||||
|
||||
eliminateInnerTypeVariables(typeVariablesOfSignature, result);
|
||||
//eliminateInnerTypeVariables(typeVariablesOfSignature, result);
|
||||
System.out.println(method.name + ": " + result);
|
||||
|
||||
return result;
|
||||
|
@ -226,7 +226,6 @@ public class TestGenerics {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("This doesn't work properly")
|
||||
public void testThreeArgs() throws Exception {
|
||||
var result = computeGenerics("TestThreeArgs.jav");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user