forked from JavaTX/JavaCompilerCore
Merge branch 'targetBytecode' of gohorb.ba-horb.de:/bahome/projekt/git/JavaCompilerCore into targetBytecode
This commit is contained in:
commit
034faf1f66
32
resources/bytecode/javFiles/Pair.jav
Normal file
32
resources/bytecode/javFiles/Pair.jav
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import java.util.Vector;
|
||||||
|
import java.lang.Boolean;
|
||||||
|
import java.lang.Object;
|
||||||
|
|
||||||
|
class Pair<U, T> {
|
||||||
|
U a;
|
||||||
|
T b;
|
||||||
|
|
||||||
|
make(x) {
|
||||||
|
var ret = new Pair<>();
|
||||||
|
ret.a = x.elementAt(0);
|
||||||
|
ret.b = x.elementAt(1);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
eq(a, b) {
|
||||||
|
b = a;
|
||||||
|
return a == b;
|
||||||
|
}
|
||||||
|
|
||||||
|
compare( p) {
|
||||||
|
return eq(p.a, p.b);
|
||||||
|
//return p.a == p.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
void m(Pair<?, ?> p, List<? extends Eq> b)
|
||||||
|
{
|
||||||
|
//this.compare(p); //1, type incorrect
|
||||||
|
this.compare(this.make(b)); //2, OK
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@ -445,7 +445,6 @@ public class ASTToTargetAST {
|
|||||||
addToPairs(result, minimalPair);
|
addToPairs(result, minimalPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// All unbounded type variables (bounds not in method)
|
// All unbounded type variables (bounds not in method)
|
||||||
outer:
|
outer:
|
||||||
for (var typeVariable : typeVariables) {
|
for (var typeVariable : typeVariables) {
|
||||||
@ -482,7 +481,8 @@ public class ASTToTargetAST {
|
|||||||
typeVariablesOfClass.add((TypePlaceholder) pair.getLeft());
|
typeVariablesOfClass.add((TypePlaceholder) pair.getLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
typeVariables.addAll(findTypeVariables(method.getReturnType(), equality));
|
if (!(method instanceof Constructor))
|
||||||
|
typeVariables.addAll(findTypeVariables(method.getReturnType(), equality));
|
||||||
for (var arg : method.getParameterList().getFormalparalist()) {
|
for (var arg : method.getParameterList().getFormalparalist()) {
|
||||||
typeVariables.addAll(findTypeVariables(arg.getType(), equality));
|
typeVariables.addAll(findTypeVariables(arg.getType(), equality));
|
||||||
}
|
}
|
||||||
|
@ -598,4 +598,10 @@ public class TestComplete {
|
|||||||
var classFiles = generateClassFiles("OLFun2.jav", new ByteArrayClassLoader());
|
var classFiles = generateClassFiles("OLFun2.jav", new ByteArrayClassLoader());
|
||||||
var instance = classFiles.get("OLFun2").getDeclaredConstructor().newInstance();
|
var instance = classFiles.get("OLFun2").getDeclaredConstructor().newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void pairTest() throws Exception {
|
||||||
|
var classFiles = generateClassFiles("Pair.jav", new ByteArrayClassLoader());
|
||||||
|
var instance = classFiles.get("Pair").getDeclaredConstructor().newInstance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user