1 /*
 2  * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
 3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  *
 5  * This code is free software; you can redistribute it and/or modify it
 6  * under the terms of the GNU General Public License version 2 only, as
 7  * published by the Free Software Foundation.  Oracle designates this
 8  * particular file as subject to the "Classpath" exception as provided
 9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 /*
27  * @test
28  * @bug 8222634
29  * @summary Check various code snippets that were incorrectly failing to compile.
30  * @compile AssortedTests.java
31  */
32 
33 primitive class MyValue1 {
34     final int x = 0;
35 }
36 
37 class X {
38     static final MyValue1 vField = new MyValue1();
39 
40     primitive class MyValue2 {
41         final MyValue1.ref vBoxField;
42 
43         public MyValue2() {
44             vBoxField = new MyValue1();
45         }
46     }
47 
48     public static void main(String[] args) { }
49 }
50 
51 primitive class MyValue3 {
52     final int x = 0;
53     public int hash() { return 0; }
54 }
55 
56 class Y {
57 
58     primitive class MyValue4 {
59         final MyValue3.ref vBoxField = null;
60 
61         public int test() {
62             return vBoxField.hash();
63         }
64     }
65 
66     public static void main(String[] args) { }
67 }
68 
69 interface MyInterface {
70     public void test(MyValue5.ref vt);
71 }
72 
73 primitive class MyValue5 implements MyInterface {
74     final int x = 0;
75 
76     @Override
77     public void test(MyValue5.ref vt) { }
78 }