new file: ../../AllgemeinTest/Pair.jav

new file:   ../../AllgemeinTest/UseWildcardPair.jav
	modified:   ../../../src/test/java/AllgemeinTest.java
This commit is contained in:
pl@gohorb.ba-horb.de 2023-03-07 08:51:31 +01:00
parent 2d82dc1ae4
commit 1c31b6d769
3 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,26 @@
import java.util.Vector;
import java.lang.Boolean;
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;
}
/*
compare(p) {
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
}
*/
}

View File

@ -0,0 +1,12 @@
import java.util.Vector;
import java.lang.Boolean;
class UseWildcardPair{
void m(Pair<?, ?> p, Vector<?> b)
{
p.compare(p); //1, type incorrect
p.compare(p.make(b)); //2, OK
}
}

View File

@ -51,7 +51,9 @@ public class AllgemeinTest {
//String className = "VectorConstAdd";
//String className = "VectorNotObject";
//String className = "WildcardCaptureConversionTest";
String className = "CaptureConversion";
//String className = "CaptureConversion";
String className = "Pair";
//String className = "UseWildcardPair";
//PL 2019-10-24: genutzt fuer unterschiedliche Tests
path = System.getProperty("user.dir")+"/resources/AllgemeinTest/" + className + ".jav";
//path = System.getProperty("user.dir")+"/src/test/resources/AllgemeinTest/Overloading_Generics.jav";