Merge branch 'targetBytecode' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into targetBytecode

Conflicts:
	src/test/java/targetast/TestComplete.java
This commit is contained in:
pl@gohorb.ba-horb.de 2022-08-09 17:14:09 +02:00
commit 5d5f3ee627
2 changed files with 16 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package de.dhbwstuttgart.target.generate;
import com.google.j2objc.annotations.LoopTranslation;
import de.dhbwstuttgart.bytecode.funN.FunNGenerator;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.parser.NullToken;
@ -145,7 +146,7 @@ public class ASTToTargetAST {
findTypeVariables(field.getType(), typeVariablesOfFields);
}
findTypeVariables(method.getReturnType(), typeVariables);
//findTypeVariables(method.getReturnType(), typeVariables);
for (var arg : method.getParameterList().getFormalparalist()) {
findTypeVariables(arg.getType(), typeVariables);
}
@ -155,6 +156,15 @@ public class ASTToTargetAST {
public void visit(LocalVarDecl localVarDecl) {
findTypeVariables(localVarDecl.getType(), typeVariables);
}
@Override
public void visit(MethodCall methodCall) {
super.visit(methodCall);
findTypeVariables(methodCall.getType(), typeVariables);
}
@Override
public void visit(Assign assign) {}
});
// Type variables with bounds that are also type variables of the method
@ -221,6 +231,7 @@ public class ASTToTargetAST {
for (var pair2 : simplifiedConstraints) {
if (!(pair2.right.equals(tph2) && pair2.left.equals(type)))
continue;
if (tph.equals(tph2)) continue;
var newPair = new PairTPHsmallerTPH(tph, tph2);
newPairs.add(newPair);
@ -572,6 +583,8 @@ public class ASTToTargetAST {
for (var i = 0; i < pars.size(); i++) {
var type1 = convert(pars.get(i).getType());
var type2 = convert(arguments.get(i).getType());
if (type2 instanceof TargetGenericType && type1 instanceof TargetGenericType)
return true;
if (!type1.equals(type2)) return false;
}

View File

@ -355,8 +355,8 @@ public class TestComplete {
@Test
public void tph4Test() throws Exception {
var classFiles = generateClassFiles("Tph4.jav", new ByteArrayClassLoader());
var tph5 = classFiles.get("Tph4");
var instance = tph5.getDeclaredConstructor().newInstance();
var tph4 = classFiles.get("Tph4");
var instance = tph4.getDeclaredConstructor().newInstance();
}
@Test