test/tools/javac/expression/DeeplyChainedNonPolyExpressionTest.java

changeset 2811
610ec7dcf431
equal deleted inserted replaced
2810:1b59f823d630 2811:610ec7dcf431
1 /*
2 * Copyright (c) 2015, 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.
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 8079613
27 * @summary Ensure that compiler ascertains a class of patently non-poly expressions as such
28 * @run main/timeout=10 DeeplyChainedNonPolyExpressionTest
29 */
30
31 public class DeeplyChainedNonPolyExpressionTest {
32 static class JSO {
33
34 JSO put(String s, Object y) {
35 return null;
36 }
37
38 JSO put(java.lang.String x, java.util.Collection<String> y) {
39 return null;
40 }
41
42 JSO put(java.lang.String x, int y) {
43 return null;
44 }
45
46 JSO put(java.lang.String x, long y) {
47 return null;
48 }
49
50 JSO put(java.lang.String x, double y) {
51 return null;
52 }
53
54 JSO put(java.lang.String x, java.util.Map<String, String> y) {
55 return null;
56 }
57
58 JSO put(java.lang.String x, boolean y) {
59 return null;
60 }
61 }
62
63 static class JSA {
64
65 JSA put(Object o) {
66 return null;
67 }
68
69 JSA put(int i, Object x) {
70 return null;
71 }
72
73 JSA put(boolean x) {
74 return null;
75 }
76
77 JSA put(int x) {
78 return null;
79 }
80
81 JSA put(int i, int x) {
82 return null;
83 }
84
85 JSA put(int x, boolean y) {
86 return null;
87 }
88
89 JSA put(int i, long x) {
90 return null;
91 }
92
93 JSA put(long x) {
94 return null;
95 }
96
97 JSA put(java.util.Collection<String> x) {
98 return null;
99 }
100
101 JSA put(int i, java.util.Collection<String> x) {
102 return null;
103 }
104
105 JSA put(int i, java.util.Map<String, String> x) {
106 return null;
107 }
108
109 JSA put(java.util.Map<String, String> x) {
110 return null;
111 }
112
113 JSA put(int i, double x) {
114 return null;
115 }
116
117 JSA put(double x) {
118 return null;
119 }
120 }
121
122 public static void main(String [] args) {
123 }
124 public static void foo() {
125 new JSO()
126 .put("s", new JSA())
127 .put("s", new JSA())
128 .put("s", new JSO()
129 .put("s", new JSO()
130 .put("s", new JSA().put("s"))
131 .put("s", new JSA())
132 .put("s", new JSO()
133 .put("s", new JSO()
134 .put("s", new JSA().put("s").put("s"))
135 .put("s", new JSA())
136 .put("s", new JSO()
137 .put("s", new JSO()
138 .put("s", new JSA().put("s").put("s").put("s")
139 .put("s").put("s").put("s")
140 .put("s").put("s"))
141 .put("s", new JSA())
142 .put("s", new JSO()
143 .put("s", new JSO()
144 .put("s", new JSA().put("s"))
145 .put("s", new JSA())
146 )
147 )
148 )
149 )
150 )
151 .put("s", new JSO()
152 .put("s", new JSA().put("s"))
153 .put("s", new JSA())
154 .put("s", new JSO()
155 .put("s", new JSO()
156 .put("s", new JSA().put("s").put("s"))
157 .put("s", new JSA())
158 .put("s", new JSO()
159 .put("s", new JSO()
160 .put("s", new JSA().put("s").put("s").put("s")
161 .put("s").put("s").put("s")
162 .put("s").put("s"))
163 .put("s", new JSA())
164 .put("s", new JSO()
165 .put("s", new JSO()
166 .put("s", new JSA().put("s"))
167 .put("s", new JSA()))
168 )
169 )
170 )
171 )
172 )
173 )
174 )
175 )
176 );
177 }
178 }

mercurial