Merge branch 'targetBytecode' of gohorb.ba-horb.de:/bahome/projekt/git/JavaCompilerCore into targetBytecode
This commit is contained in:
commit
02c8dd9804
@ -116,6 +116,8 @@ public class ASTToTargetAST {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
} else if (input.stream().anyMatch(p -> p.getLeft().equals(pair.getLeft()))) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
input.add(pair);
|
input.add(pair);
|
||||||
@ -605,14 +607,14 @@ public class ASTToTargetAST {
|
|||||||
if (left.equals(tph)) {
|
if (left.equals(tph)) {
|
||||||
var pair = new PairTPHsmallerTPH(tph, right);
|
var pair = new PairTPHsmallerTPH(tph, right);
|
||||||
if (!generics.contains(pair)) {
|
if (!generics.contains(pair)) {
|
||||||
generics.add(pair);
|
addToPairs(generics, pair);
|
||||||
findAllBounds(right, generics, equality);
|
findAllBounds(right, generics, equality);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
generics.add(new PairTPHequalRefTypeOrWildcardType(tph, OBJECT));
|
addToPairs(generics, new PairTPHequalRefTypeOrWildcardType(tph, OBJECT));
|
||||||
} else if (type instanceof RefType refType) {
|
} else if (type instanceof RefType refType) {
|
||||||
refType.getParaList().forEach(t -> findAllBounds(t, generics, equality));
|
refType.getParaList().forEach(t -> findAllBounds(t, generics, equality));
|
||||||
}
|
}
|
||||||
@ -663,7 +665,6 @@ public class ASTToTargetAST {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void findTphs(RefTypeOrTPHOrWildcardOrGeneric type, Set<TypePlaceholder> tphs, Map<TypePlaceholder, TypePlaceholder> equality) {
|
void findTphs(RefTypeOrTPHOrWildcardOrGeneric type, Set<TypePlaceholder> tphs, Map<TypePlaceholder, TypePlaceholder> equality) {
|
||||||
|
@ -158,33 +158,30 @@ public class TestGenerics {
|
|||||||
|
|
||||||
var generics = result.genericsResults.get(0);
|
var generics = result.genericsResults.get(0);
|
||||||
assertEquals(1, generics.get(result.clazz).size());
|
assertEquals(1, generics.get(result.clazz).size());
|
||||||
assertEquals(3, generics.get(id).size());
|
assertEquals(2, generics.get(id).size());
|
||||||
assertEquals(2, generics.get(m).size());
|
assertEquals(2, generics.get(m).size());
|
||||||
assertEquals(3, generics.get(main).size());
|
assertEquals(3, generics.get(main).size());
|
||||||
|
|
||||||
var M = generics.getBounds(a.getType(), result.clazz);
|
var N = generics.getBounds(a.getType(), result.clazz);
|
||||||
assertEquals(M, new BoundsList(new Bound(false, ASTToTargetAST.OBJECT)));
|
assertEquals(N, new BoundsList(new Bound(false, ASTToTargetAST.OBJECT)));
|
||||||
|
|
||||||
var O = generics.getBounds(id.getParameterList().getParameterAt(0).getType(), result.clazz, id);
|
var P = generics.getBounds(id.getParameterList().getParameterAt(0).getType(), result.clazz, id);
|
||||||
var OChain = new BoundsList(new Bound(true, TypePlaceholder.of("P")), new Bound(true, ASTToTargetAST.OBJECT));
|
var O = generics.getBounds(id.getReturnType(), result.clazz, id);
|
||||||
assertEquals(O, OChain);
|
assertEquals(P, O);
|
||||||
var AK = generics.getBounds(id.getReturnType(), result.clazz, id);
|
assertEquals(O, new BoundsList(new Bound(true, ASTToTargetAST.OBJECT)));
|
||||||
var AKChain = new BoundsList(new Bound(true, ASTToTargetAST.OBJECT));
|
|
||||||
assertEquals(AK, AKChain);
|
|
||||||
|
|
||||||
// TODO Shouldn't AK and AK2 be the same and on the class?
|
assertEquals(generics.resolve(m.getParameterList().getParameterAt(0).getType()), generics.resolve(m.getReturnType()));
|
||||||
var AK2 = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m);
|
var Y = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m);
|
||||||
var Y = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m);
|
var AA = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m);
|
||||||
assertEquals(AK2, AKChain);
|
assertEquals(Y, AA);
|
||||||
assertEquals(Y, AKChain);
|
assertEquals(AA, new BoundsList(new Bound(true, ASTToTargetAST.OBJECT)));
|
||||||
|
|
||||||
var AF = generics.getBounds(main.getParameterList().getParameterAt(0).getType(), result.clazz, main);
|
var AI = generics.getBounds(m.getParameterList().getParameterAt(0).getType(), result.clazz, m);
|
||||||
var AG= generics.getBounds(main.getParameterList().getParameterAt(1).getType(), result.clazz, main);
|
var AJ = generics.getBounds(m.getParameterList().getParameterAt(1).getType(), result.clazz, m);
|
||||||
var AK3 = generics.getBounds(main.getReturnType(), result.clazz, main);
|
var AH = generics.getBounds(m.getReturnType(), result.clazz, m);
|
||||||
var AFChain = new BoundsList(new Bound(true, TypePlaceholder.of("AG")), new Bound(true, ASTToTargetAST.OBJECT));
|
assertEquals(AI, AJ);
|
||||||
assertEquals(AF, AFChain);
|
assertEquals(AJ, AH);
|
||||||
assertEquals(AG, AKChain);
|
assertEquals(AH, new BoundsList(new Bound(true, ASTToTargetAST.OBJECT)));
|
||||||
assertEquals(AK3, AKChain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user