8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 8223305 8226522
27 * @summary Ensure proper errors are returned for yields.
28 * @compile/fail/ref=WrongYieldTest.out --enable-preview -source ${jdk.version} -XDrawDiagnostics -XDshould-stop.at=ATTR WrongYieldTest.java
29 */
30
31 package t;
32
33 //ERROR - type called yield:
34 import t.WrongYieldTest.yield;
35
36 public class WrongYieldTest {
37
38 // ERROR - class called yield
39 class yield { }
40
41 // OK to have fields called yield
42 String[] yield = null;
43
44 // ERROR - field of type yield
45 yield y;
46
47 // OK to have methods called yield
48 // Nullary yield method
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 8223305 8226522
27 * @summary Ensure proper errors are returned for yields.
28 * @compile/fail/ref=WrongYieldTest.out -XDrawDiagnostics -XDshould-stop.at=ATTR WrongYieldTest.java
29 */
30
31 package t;
32
33 //ERROR - type called yield:
34 import t.WrongYieldTest.yield;
35
36 public class WrongYieldTest {
37
38 // ERROR - class called yield
39 class yield { }
40
41 // OK to have fields called yield
42 String[] yield = null;
43
44 // ERROR - field of type yield
45 yield y;
46
47 // OK to have methods called yield
48 // Nullary yield method
|