Add bug for #328
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Has been cancelled
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Has been cancelled
This commit is contained in:
parent
a5c314c5c5
commit
c76ee355d8
8
resources/bytecode/javFiles/Bug328.jav
Normal file
8
resources/bytecode/javFiles/Bug328.jav
Normal file
@ -0,0 +1,8 @@
|
||||
import java.lang.Integer;
|
||||
import Bug328B;
|
||||
|
||||
public class Bug328 extends Bug328B {
|
||||
public Bug328() {
|
||||
super(1);
|
||||
}
|
||||
}
|
3
resources/bytecode/javFiles/Bug328B.java
Normal file
3
resources/bytecode/javFiles/Bug328B.java
Normal file
@ -0,0 +1,3 @@
|
||||
public class Bug328B {
|
||||
public Bug328B(int a) {}
|
||||
}
|
@ -380,6 +380,7 @@ public class OutputGenerator implements ASTVisitor {
|
||||
out.append("super(");
|
||||
superCall.arglist.accept(this);
|
||||
out.append(")");
|
||||
out.append(" Signature: " + superCall.signature);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -387,6 +388,7 @@ public class OutputGenerator implements ASTVisitor {
|
||||
out.append("this(");
|
||||
thisCall.arglist.accept(this);
|
||||
out.append(")");
|
||||
out.append(" Signature: " + thisCall.signature);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -301,7 +301,7 @@ public class StatementToTargetExpression implements ASTVisitor {
|
||||
var aSuper = converter.convert(superCall.receiver.getType());
|
||||
var type = converter.convert(superCall.getType());
|
||||
var receiverName = new JavaClassName(converter.convert(superCall.receiver.getType()).name());
|
||||
var clazz = converter.compiler.getClass(converter.compiler.getClass(receiverName).getSuperClass().getName());
|
||||
var clazz = converter.compiler.getClass(receiverName);
|
||||
var signature = superCall.signatureArguments().stream().map(converter::convert).toList();
|
||||
var method = converter.findConstructor(clazz, signature);
|
||||
var params = superCall.getArgumentList().getArguments().stream().map(converter::convert).toList();
|
||||
|
@ -592,6 +592,7 @@ public class TYPEStmt implements StatementVisitor {
|
||||
var params = convertParams(ctor.getParameterList(), info);
|
||||
if (params.size() != superCall.arglist.getArguments().size()) continue;
|
||||
var assumption = new MethodAssumption(null, new Void(new NullToken()), params, createTypeScope(clazz, ctor), ctor.isInherited);
|
||||
System.out.println(params);
|
||||
|
||||
GenericsResolver resolver = getResolverInstance();
|
||||
Set<Constraint<Pair>> oneMethodConstraints = generateConstraint(superCall, assumption, info, resolver);
|
||||
@ -682,6 +683,7 @@ public class TYPEStmt implements StatementVisitor {
|
||||
extendsMethodConstraint.addAll(parameterContraints);
|
||||
|
||||
Set<Pair> methodSignatureConstraint = generatemethodSignatureConstraint(forMethod, assumption, info, resolver);
|
||||
System.out.println(methodSignatureConstraint);
|
||||
|
||||
//System.out.println("methodSignatureConstraint: " + methodSignatureConstraint);
|
||||
//System.out.println("methodConstraint: " + methodConstraint);
|
||||
@ -716,7 +718,7 @@ public class TYPEStmt implements StatementVisitor {
|
||||
Set<Pair> ret = new HashSet<>();
|
||||
|
||||
for (int i = 0; i < foMethod.arglist.getArguments().size(); i++) {
|
||||
|
||||
System.out.println(foMethod.signature);
|
||||
// Zuordnung von MethoCall.signature (Argumenttypen) zu der Argumenttypen der ausgewaehlten Methode (assumption.params)
|
||||
ret.add(new Pair(foMethod.signature.get(i), assumption.getArgTypes().get(i), PairOperator.EQUALSDOT));
|
||||
|
||||
|
@ -1084,4 +1084,13 @@ public class TestComplete {
|
||||
var res = clazz.getDeclaredMethod("convert", List.class).invoke(instance, list);
|
||||
assertEquals(res, List.of(6, 7, 8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBug328() throws Exception {
|
||||
var loader = new ByteArrayClassLoader();
|
||||
loader.loadClass(TestCodegen.path.resolve("Bug328B.class"));
|
||||
var classFiles = generateClassFiles(loader, "Bug328.jav");
|
||||
var clazz = classFiles.get("Bug328");
|
||||
var instance = clazz.getDeclaredConstructor().newInstance();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user