--- a/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java Wed Jul 09 10:49:32 2014 -0400
+++ b/langtools/test/tools/javac/diags/examples/NeitherConditionalSubtype.java Thu Jul 10 13:57:27 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,10 +22,13 @@
*/
// key: compiler.err.neither.conditional.subtype
-// options: -source 1.4 -Xlint:-options
-class X {
- Object m(boolean b) {
- return (b ? 3 : b);
+class NeitherConditionalSubtype {
+ public int test(Object o) {
+ // Should fail to compile since Object.wait() has a void return type.
+ System.out.println(o instanceof String ? o.hashCode() : o.wait());
+ return 0;
}
}
+
+