forked from JavaTX/JavaCompilerCore
Fix incorrect generics for derived FunN
This commit is contained in:
parent
b5af3a42a8
commit
d93836d110
7
Test.java
Normal file
7
Test.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
public interface Test<A, B> extends Base<A, B> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Base<A, B> {
|
||||||
|
|
||||||
|
}
|
@ -1025,6 +1025,8 @@ public class Codegen {
|
|||||||
if (!method.txGenerics().isEmpty())
|
if (!method.txGenerics().isEmpty())
|
||||||
mv.visitAttribute(new JavaTXSignatureAttribute(method.getTXSignature()));
|
mv.visitAttribute(new JavaTXSignatureAttribute(method.getTXSignature()));
|
||||||
|
|
||||||
|
System.out.println(method.getDescriptor());
|
||||||
|
System.out.println(method.getSignature());
|
||||||
mv.visitCode();
|
mv.visitCode();
|
||||||
var state = new State(method.returnType(), mv, method.isStatic() ? 0 : 1);
|
var state = new State(method.returnType(), mv, method.isStatic() ? 0 : 1);
|
||||||
for (var param: method.parameters())
|
for (var param: method.parameters())
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.dhbwstuttgart.bytecode;
|
package de.dhbwstuttgart.bytecode;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.target.tree.TargetGeneric;
|
||||||
import de.dhbwstuttgart.target.tree.type.TargetGenericType;
|
import de.dhbwstuttgart.target.tree.type.TargetGenericType;
|
||||||
import de.dhbwstuttgart.target.tree.type.TargetRefType;
|
import de.dhbwstuttgart.target.tree.type.TargetRefType;
|
||||||
import de.dhbwstuttgart.target.tree.type.TargetType;
|
import de.dhbwstuttgart.target.tree.type.TargetType;
|
||||||
@ -66,7 +67,7 @@ public class FunNGenerator {
|
|||||||
List<TargetType> parameters = Stream
|
List<TargetType> parameters = Stream
|
||||||
.concat(argumentTypes.stream(), Stream.of(returnType))
|
.concat(argumentTypes.stream(), Stream.of(returnType))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
StringBuilder funNClassSignature = new StringBuilder(objectSignature + applySignature(new TargetRefType(getSuperClassName(argumentTypes.size()), parameters)));
|
StringBuilder funNClassSignature = new StringBuilder(objectSignature + applyDescriptor(new TargetRefType(getSuperClassName(argumentTypes.size()), parameters)));
|
||||||
boolean containsGeneric = false;
|
boolean containsGeneric = false;
|
||||||
|
|
||||||
String genericSignature = "<";
|
String genericSignature = "<";
|
||||||
@ -74,13 +75,12 @@ public class FunNGenerator {
|
|||||||
//ToDo Etienne: Refactor
|
//ToDo Etienne: Refactor
|
||||||
if (typeArgument instanceof TargetGenericType generic){
|
if (typeArgument instanceof TargetGenericType generic){
|
||||||
//if(genericSignature.contains(generic.name())) continue;
|
//if(genericSignature.contains(generic.name())) continue;
|
||||||
genericSignature += String.format("%s:%s", generic.name(), applyDescriptor(generic));
|
genericSignature += String.format("%s:%s", generic.name(), objectSignature);
|
||||||
containsGeneric = true;
|
containsGeneric = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
genericSignature += ">";
|
genericSignature += ">";
|
||||||
if (containsGeneric) funNClassSignature.insert(0, genericSignature);
|
if (containsGeneric) funNClassSignature.insert(0, genericSignature);
|
||||||
System.out.println(funNClassSignature.toString());
|
|
||||||
|
|
||||||
ClassWriter classWriter = new ClassWriter(0);
|
ClassWriter classWriter = new ClassWriter(0);
|
||||||
classWriter.visit(bytecodeVersion, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, getSpecializedClassName(argumentTypes, returnType), funNClassSignature.toString(), objectSuperType, new String[]{getSuperClassName(argumentTypes.size())});
|
classWriter.visit(bytecodeVersion, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, getSpecializedClassName(argumentTypes, returnType), funNClassSignature.toString(), objectSuperType, new String[]{getSuperClassName(argumentTypes.size())});
|
||||||
|
@ -233,7 +233,6 @@ public class TestComplete {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void matrixTest() throws Exception {
|
public void matrixTest() throws Exception {
|
||||||
var classFiles = generateClassFiles("Matrix.jav", new ByteArrayClassLoader());
|
var classFiles = generateClassFiles("Matrix.jav", new ByteArrayClassLoader());
|
||||||
var matrix = classFiles.get("Matrix");
|
var matrix = classFiles.get("Matrix");
|
||||||
|
Loading…
Reference in New Issue
Block a user