jdk-24/test/langtools/tools/javac/conditional/Conditional.java

20 lines
465 B
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* @test /nodynamiccopyright/
2007-12-01 00:00:00 +00:00
* @bug 5077054
* @summary Conditional operator applies assignment conversion
* @author Tim Hanson, BEA
*
* @compile Conditional.java
* @compile/fail/ref=Conditional.out -XDrawDiagnostics -source 7 -Xlint:-options Conditional.java
2007-12-01 00:00:00 +00:00
*/
import java.util.*;
class Conditional {
void test() {
String[] sa = null;
List<String> ls = sa == null ? Arrays.asList(sa) :
Collections.emptyList();
}
}