Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8243623: [lworld] Syntax and other mechanical changes in langtools tests for JDK-8237072 #29

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8222634
* @summary Check array creation with V and V?
* @summary Check array creation with V and V.ref
* @modules jdk.compiler/com.sun.tools.javac.util jdk.jdeps/com.sun.tools.javap
* @compile ArrayCreationWithQuestion.java
* @run main/othervm -Xverify:none ArrayCreationWithQuestion
@@ -38,8 +38,8 @@
public class ArrayCreationWithQuestion {

static inline class VT {
VT?[] a1 = new VT?[42];
VT?[] a2 = new VT?[42];
VT.ref[] a1 = new VT.ref[42];
VT.ref[] a2 = new VT.ref[42];
VT[] a3 = new VT[42];
VT[] a4 = new VT[42];
}
@@ -53,10 +53,10 @@ void run() {
Paths.get(System.getProperty("test.classes"),
"ArrayCreationWithQuestion$VT.class").toString() };
runCheck(params, new String [] {
" 6: anewarray #3 // class ArrayCreationWithQuestion$VT",
" 17: anewarray #3 // class ArrayCreationWithQuestion$VT",
" 28: anewarray #11 // class \"QArrayCreationWithQuestion$VT;\"",
" 39: anewarray #11 // class \"QArrayCreationWithQuestion$VT;\"",
" 6: anewarray #3 // class ArrayCreationWithQuestion$VT$ref",
" 17: anewarray #3 // class ArrayCreationWithQuestion$VT$ref",
" 28: anewarray #12 // class \"QArrayCreationWithQuestion$VT;\"",
" 39: anewarray #12 // class \"QArrayCreationWithQuestion$VT;\"",
});

}
@@ -35,7 +35,7 @@
int x = 42;

public static void main(String [] args) {
ArrayRelationsTest? [] la = new ArrayRelationsTest?[10];
ArrayRelationsTest.ref [] la = new ArrayRelationsTest.ref[10];
ArrayRelationsTest [] qa = new ArrayRelationsTest[10];
boolean cce = false;
try {
@@ -47,7 +47,7 @@ public static void main(String [] args) {
throw new AssertionError("Missing CCE");
}
la = qa;
ArrayRelationsTest?[] la2 = qa;
ArrayRelationsTest.ref[] la2 = qa;
ArrayRelationsTest [] qa2 = (ArrayRelationsTest []) la2;
boolean npe = false;
try {
@@ -71,7 +71,7 @@ public static void main(String [] args) {

// round trip;
Object o = oa = la = qa;
qa = (ArrayRelationsTest[]) (la = (ArrayRelationsTest? []) (oa = (Object []) o));
qa = (ArrayRelationsTest[]) (la = (ArrayRelationsTest.ref []) (oa = (Object []) o));
qa [0] = new ArrayRelationsTest();

npe = false;
@@ -84,7 +84,7 @@ public static void main(String [] args) {
throw new AssertionError("Missing NPE");
}

la = new ArrayRelationsTest? [10];
la = new ArrayRelationsTest.ref [10];

cce = false;
try {
@@ -38,7 +38,7 @@
static final MyValue1 vField = new MyValue1();

inline class MyValue2 {
final MyValue1? vBoxField;
final MyValue1.ref vBoxField;

public MyValue2() {
vBoxField = new MyValue1();
@@ -56,7 +56,7 @@ public static void main(String[] args) { }
class Y {

inline class MyValue4 {
final MyValue3? vBoxField = null;
final MyValue3.ref vBoxField = null;

public int test() {
return vBoxField.hash();
@@ -67,12 +67,12 @@ public static void main(String[] args) { }
}

interface MyInterface {
public void test(MyValue5? vt);
public void test(MyValue5.ref vt);
}

inline class MyValue5 implements MyInterface {
final int x = 0;

@Override
public void test(MyValue5? vt) { }
public void test(MyValue5.ref vt) { }
}
@@ -30,6 +30,6 @@
*/

public class BogusIncompatibility {
MyValue? field = MyValue.create();
MyValue? field2 = MyValue.create();
MyValue.ref field = MyValue.create();
MyValue.ref field2 = MyValue.create();
}
@@ -39,13 +39,13 @@

static inline class VT {
int f = 0;
static final VT? vtbox = (VT?) new VT(); // no binary cast
static final VT.ref vtbox = (VT.ref) new VT(); // no binary cast
static VT vt = (VT) vtbox; // binary cast
static VT? box = vt; // no binary cast
static VT? box2 = (VT) box; // no binary cast
static VT? box3 = id(new VT()); // no binary cast + binary cast
static VT.ref box = vt; // no binary cast
static VT.ref box2 = (VT) box; // binary cast
static VT.ref box3 = id(new VT()); // no binary cast + no binary cast

static VT id(VT? vtb) {
static VT id(VT.ref vtb) {
return (VT) vtb; // binary
}
}
@@ -50,19 +50,19 @@ public static void main(String[] args) throws Exception {
throw new Exception("Bad descriptor for field1");
} else if (fld.getName(cls.constant_pool).equals("f2")) {
fCount++;
if (!fld.descriptor.getValue(cls.constant_pool).equals("LCheckFieldDescriptors;"))
if (!fld.descriptor.getValue(cls.constant_pool).equals("LCheckFieldDescriptors$ref;"))
throw new Exception("Bad descriptor for field2");
} else if (fld.getName(cls.constant_pool).equals("f3")) {
fCount++;
if (!fld.descriptor.getValue(cls.constant_pool).equals("LCheckFieldDescriptors;"))
if (!fld.descriptor.getValue(cls.constant_pool).equals("LCheckFieldDescriptors$ref;"))
throw new Exception("Bad descriptor for field3");
} else if (fld.getName(cls.constant_pool).equals("a1")) {
fCount++;
if (!fld.descriptor.getValue(cls.constant_pool).equals("[LCheckFieldDescriptors;"))
if (!fld.descriptor.getValue(cls.constant_pool).equals("[LCheckFieldDescriptors$ref;"))
throw new Exception("Bad descriptor for field4");
} else if (fld.getName(cls.constant_pool).equals("a2")) {
fCount++;
if (!fld.descriptor.getValue(cls.constant_pool).equals("[LCheckFieldDescriptors;"))
if (!fld.descriptor.getValue(cls.constant_pool).equals("[LCheckFieldDescriptors$ref;"))
throw new Exception("Bad descriptor for field5");
} else if (fld.getName(cls.constant_pool).equals("a3")) {
fCount++;
@@ -83,11 +83,11 @@ public static void main(String[] args) throws Exception {
class CheckFieldDescriptorsAuxilliary {

CheckFieldDescriptors f1;
CheckFieldDescriptors? f2;
CheckFieldDescriptors? f3;
CheckFieldDescriptors.ref f2;
CheckFieldDescriptors.ref f3;

CheckFieldDescriptors?[] a1 = new CheckFieldDescriptors?[42];
CheckFieldDescriptors?[] a2 = new CheckFieldDescriptors?[42];
CheckFieldDescriptors.ref[] a1 = new CheckFieldDescriptors.ref[42];
CheckFieldDescriptors.ref[] a2 = new CheckFieldDescriptors.ref[42];
CheckFieldDescriptors[] a3 = new CheckFieldDescriptors[42];
CheckFieldDescriptors[] a4 = new CheckFieldDescriptors[42];
}
@@ -26,23 +26,23 @@
/*
* @test
* @bug 8222634
* @summary Check null assignment/comparisons against VT?
* @summary Check null assignment/comparisons against VT.ref
* @compile CheckNullWithQuestion.java
*/

inline class CheckNullWithQuestion {
final int x = 0;
void foo(boolean flag) {
CheckNullWithQuestion? vBox = null;
CheckNullWithQuestion.ref vBox = null;
if (vBox != null) {}
CheckNullWithQuestion? val = flag ? vBox : null;
CheckNullWithQuestion.ref val = flag ? vBox : null;
}
}

class X {
void foo(boolean flag) {
CheckNullWithQuestion? vBox = null;
CheckNullWithQuestion.ref vBox = null;
if (vBox != null) {}
CheckNullWithQuestion? val = flag ? vBox : null;
CheckNullWithQuestion.ref val = flag ? vBox : null;
}
}
@@ -9,6 +9,6 @@
import java.util.List;

inline class X {
List<X?> ls = new Object();
X?[] xa = new Object?[10];
List<X.ref> ls = new Object();
X.ref[] xa = new Object[10]; // no support for Object.ref yet, but they are the same.
}
@@ -1,3 +1,3 @@
CheckQuestionInMessages.java:12:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, java.util.List<X?>)
CheckQuestionInMessages.java:13:15: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object[], X?[])
CheckQuestionInMessages.java:12:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object, java.util.List<X$ref>)
CheckQuestionInMessages.java:13:18: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object[], X$ref[])
2 errors
@@ -43,7 +43,7 @@ public Point(int x, int y) {
}


static void testCastingFromBoxToVal(Point? p) {
static void testCastingFromBoxToVal(Point.ref p) {
boolean npe = false;
try {
Point pv = (Point) p;
@@ -32,7 +32,7 @@

class CompilesFine {

static Point? nfspQm;
static Point.ref nfspQm;

public static void main(String[] args) {
nfspQm = null;
@@ -51,7 +51,7 @@ public static void main(String[] args) {
class CompilesJustFine {

static final inline class Value {
final PointBug2? nfpQm;
final PointBug2.ref nfpQm;

private Value() {
nfpQm = PointBug2.createPoint(0, 0);
@@ -75,15 +75,15 @@ public int orElse(int other) {
public final class ExplicitLambdaWithNullableTypes {

public static void main(String[] args) {
List<OptionalInt?> opts = new ArrayList<>();
List<OptionalInt.ref> opts = new ArrayList<>();
for (int i=0; i < 5; i++) {
opts.add(OptionalInt.of(i));
opts.add(OptionalInt.empty());
opts.add(null);
}

Integer total = opts.stream()
.map((OptionalInt? o) -> {
.map((OptionalInt.ref o) -> {
if (o == null)
return 0;

@@ -76,15 +76,15 @@ public int orElse(int other) {
public final class ExplicitLambdaWithNullableTypes2 {

public static void main(String[] args) {
List<OptionalInt?> opts = new ArrayList<>();
List<OptionalInt.ref> opts = new ArrayList<>();
for (int i=0; i < 5; i++) {
opts.add(OptionalInt.of(i));
opts.add(OptionalInt.empty());
opts.add(null);
}

Stream<OptionalInt?> soi = opts.stream();
ToIntFunction<OptionalInt?> f = (OptionalInt? o) -> {
Stream<OptionalInt.ref> soi = opts.stream();
ToIntFunction<OptionalInt.ref> f = (OptionalInt.ref o) -> {
if (o == null) return 0;
OptionalInt op = (OptionalInt)o;
return op.orElse(0);
@@ -76,15 +76,15 @@ public int orElse(int other) {
public final class ExplicitLambdaWithNullableTypes3 {

public static void main(String[] args) {
List<OptionalInt?> opts = new ArrayList<>();
List<OptionalInt.ref> opts = new ArrayList<>();
for (int i=0; i < 5; i++) {
opts.add(OptionalInt.of(i));
opts.add(OptionalInt.empty());
opts.add(null);
}

Stream<OptionalInt?> soi = opts.stream();
ToIntFunction<OptionalInt?> f = o -> {
Stream<OptionalInt.ref> soi = opts.stream();
ToIntFunction<OptionalInt.ref> f = o -> {
if (o == null) return 0;
OptionalInt op = (OptionalInt)o;
return op.orElse(0);
@@ -34,7 +34,7 @@

interface Sample<K extends Comparable<? super K>, V> {
void doesCompile(InlineType<? extends K> argument);
void doesNotCompile(java.util.Map.Entry<InlineType<? extends K>?, ? extends V> arg);
void doesNotCompile(java.util.Map.Entry<InlineType.ref<? extends K>, ? extends V> arg);
}

private E element;
@@ -87,16 +87,16 @@ public String toString() {

public static void main(String[] args) {

List<Optional<Integer>?> opts = new ArrayList<>();
List<Optional.ref<Integer>> opts = new ArrayList<>();
for (int i=0; i < 6; i++) {
Optional<Integer> oi = Optional.of(i);
opts.add((Optional<Integer>?)oi);
opts.add((Optional.ref<Integer>)oi);
Optional<Integer> oe = Optional.empty();
opts.add((Optional<Integer>?)oe);
opts.add((Optional.ref<Integer>)oe);
}

Integer total = opts.stream()
.map((Optional<Integer>? o) -> {
.map((Optional.ref<Integer> o) -> {
Optional<Integer> op = (Optional<Integer>)o;
return op.orElse(0);
})
@@ -43,8 +43,8 @@ public static Inner create(int v) {
}

// Uncomment the next line, and Inner ceases to be a value type
public static final Inner? ZERO = Inner.create(0);
public static final Inner? ZERO2 = Inner.create(0);
public static final Inner.ref ZERO = Inner.create(0);
public static final Inner.ref ZERO2 = Inner.create(0);
}

public static void main(String[] args) {
@@ -26,7 +26,7 @@
/*
* @test
* @bug 8222974
* @summary javac doesn't like "?" syntax in instanceof type expression
* @summary javac doesn't like "?" syntax in instanceof type expression (syntax is dead)
* @compile InstanceofProjectionArray.java
*/

@@ -37,11 +37,11 @@
public InstanceofProjectionArray() { this.value = 0; }

public static void main(String[] args) throws Throwable {
InstanceofProjectionArray?[] foos = new InstanceofProjectionArray?[1];
if (!(foos instanceof InstanceofProjectionArray?[])) {
InstanceofProjectionArray.ref[] foos = new InstanceofProjectionArray.ref[1];
if (!(foos instanceof InstanceofProjectionArray.ref[])) {
throw new RuntimeException("Thought that should work");
}
InstanceofProjectionArray?[][] xx = null;
if (xx instanceof InstanceofProjectionArray?[][]) {}
InstanceofProjectionArray.ref[][] xx = null;
if (xx instanceof InstanceofProjectionArray.ref[][]) {}
}
}