author | iignatyev |
Fri, 26 Apr 2013 07:21:41 -0700 | |
changeset 17126 | 42a942feeea2 |
parent 17015 | 92390f57e8b1 |
child 19282 | 9764b5a041b6 |
permissions | -rw-r--r-- |
15621 | 1 |
/* |
2 |
* Copyright (c) 2013, 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 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
24 |
import com.sun.management.HotSpotDiagnosticMXBean; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
25 |
import com.sun.management.VMOption; |
15621 | 26 |
import sun.hotspot.WhiteBox; |
27 |
import sun.management.ManagementFactoryHelper; |
|
28 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
29 |
import java.lang.reflect.Constructor; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
30 |
import java.lang.reflect.Executable; |
15621 | 31 |
import java.lang.reflect.Method; |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
32 |
import java.util.Objects; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
33 |
import java.util.concurrent.Callable; |
15621 | 34 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
35 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
36 |
* Abstract class for WhiteBox testing of JIT. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
37 |
* |
15621 | 38 |
* @author igor.ignatyev@oracle.com |
39 |
*/ |
|
40 |
public abstract class CompilerWhiteBoxTest { |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
41 |
/** {@code CompLevel::CompLevel_none} -- Interpreter */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
42 |
protected static int COMP_LEVEL_NONE = 0; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
43 |
/** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
44 |
protected static int COMP_LEVEL_ANY = -1; |
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
45 |
/** {@code CompLevel::CompLevel_simple} -- C1 */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
46 |
protected static int COMP_LEVEL_SIMPLE = 1; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
47 |
/** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
48 |
protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
49 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
50 |
/** Instance of WhiteBox */ |
15621 | 51 |
protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
52 |
/** Value of {@code -XX:CompileThreshold} */ |
15621 | 53 |
protected static final int COMPILE_THRESHOLD |
54 |
= Integer.parseInt(getVMOption("CompileThreshold", "10000")); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
55 |
/** Value of {@code -XX:BackgroundCompilation} */ |
16367 | 56 |
protected static final boolean BACKGROUND_COMPILATION |
57 |
= Boolean.valueOf(getVMOption("BackgroundCompilation", "true")); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
58 |
/** Value of {@code -XX:TieredCompilation} */ |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
59 |
protected static final boolean TIERED_COMPILATION |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
60 |
= Boolean.valueOf(getVMOption("TieredCompilation", "false")); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
61 |
/** Value of {@code -XX:TieredStopAtLevel} */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
62 |
protected static final int TIERED_STOP_AT_LEVEL |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
63 |
= Integer.parseInt(getVMOption("TieredStopAtLevel", "0")); |
15621 | 64 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
65 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
66 |
* Returns value of VM option. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
67 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
68 |
* @param name option's name |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
69 |
* @return value of option or {@code null}, if option doesn't exist |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
70 |
* @throws NullPointerException if name is null |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
71 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
72 |
protected static String getVMOption(String name) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
73 |
Objects.requireNonNull(name); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
74 |
HotSpotDiagnosticMXBean diagnostic |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
75 |
= ManagementFactoryHelper.getDiagnosticMXBean(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
76 |
VMOption tmp; |
15621 | 77 |
try { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
78 |
tmp = diagnostic.getVMOption(name); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
79 |
} catch (IllegalArgumentException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
80 |
tmp = null; |
15621 | 81 |
} |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
82 |
return (tmp == null ? null : tmp.getValue()); |
15621 | 83 |
} |
84 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
85 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
86 |
* Returns value of VM option or default value. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
87 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
88 |
* @param name option's name |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
89 |
* @param defaultValue default value |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
90 |
* @return value of option or {@code defaultValue}, if option doesn't exist |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
91 |
* @throws NullPointerException if name is null |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
92 |
* @see #getVMOption(String) |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
93 |
*/ |
16367 | 94 |
protected static String getVMOption(String name, String defaultValue) { |
95 |
String result = getVMOption(name); |
|
15621 | 96 |
return result == null ? defaultValue : result; |
97 |
} |
|
98 |
||
17126
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
99 |
/** copy of is_c1_compile(int) from utilities/globalDefinitions.hpp */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
100 |
protected static boolean isC1Compile(int compLevel) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
101 |
return (compLevel > COMP_LEVEL_NONE) |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
102 |
&& (compLevel < COMP_LEVEL_FULL_OPTIMIZATION); |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
103 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
104 |
|
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
105 |
/** copy of is_c2_compile(int) from utilities/globalDefinitions.hpp */ |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
106 |
protected static boolean isC2Compile(int compLevel) { |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
107 |
return compLevel == COMP_LEVEL_FULL_OPTIMIZATION; |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
108 |
} |
42a942feeea2
8012322: Tiered: CompilationPolicy::can_be_compiled(CompLevel_all) mistakenly return false
iignatyev
parents:
17015
diff
changeset
|
109 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
110 |
/** tested method */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
111 |
protected final Executable method; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
112 |
private final Callable<Integer> callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
113 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
114 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
115 |
* Constructor. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
116 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
117 |
* @param testCase object, that contains tested method and way to invoke it. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
118 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
119 |
protected CompilerWhiteBoxTest(TestCase testCase) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
120 |
Objects.requireNonNull(testCase); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
121 |
System.out.println("TEST CASE:" + testCase.name()); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
122 |
method = testCase.executable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
123 |
callable = testCase.callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
124 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
125 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
126 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
127 |
* Template method for testing. Prints tested method's info before |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
128 |
* {@linkplain #test()} and after {@linkplain #test()} or on thrown |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
129 |
* exception. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
130 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
131 |
* @throws RuntimeException if method {@linkplain #test()} throws any |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
132 |
* exception |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
133 |
* @see #test() |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
134 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
135 |
protected final void runTest() { |
15621 | 136 |
if (ManagementFactoryHelper.getCompilationMXBean() == null) { |
137 |
System.err.println( |
|
138 |
"Warning: test is not applicable in interpreted mode"); |
|
139 |
return; |
|
140 |
} |
|
141 |
System.out.println("at test's start:"); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
142 |
printInfo(); |
15621 | 143 |
try { |
144 |
test(); |
|
145 |
} catch (Exception e) { |
|
146 |
System.out.printf("on exception '%s':", e.getMessage()); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
147 |
printInfo(); |
16367 | 148 |
e.printStackTrace(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
149 |
if (e instanceof RuntimeException) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
150 |
throw (RuntimeException) e; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
151 |
} |
15621 | 152 |
throw new RuntimeException(e); |
153 |
} |
|
154 |
System.out.println("at test's end:"); |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
155 |
printInfo(); |
15621 | 156 |
} |
157 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
158 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
159 |
* Checks, that {@linkplain #method} is not compiled. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
160 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
161 |
* @throws RuntimeException if {@linkplain #method} is in compiler queue or |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
162 |
* is compiled, or if {@linkplain #method} has zero |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
163 |
* compilation level. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
164 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
165 |
protected final void checkNotCompiled() { |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
166 |
if (WHITE_BOX.isMethodQueuedForCompilation(method)) { |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
167 |
throw new RuntimeException(method + " must not be in queue"); |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
168 |
} |
15621 | 169 |
if (WHITE_BOX.isMethodCompiled(method)) { |
170 |
throw new RuntimeException(method + " must be not compiled"); |
|
171 |
} |
|
172 |
if (WHITE_BOX.getMethodCompilationLevel(method) != 0) { |
|
173 |
throw new RuntimeException(method + " comp_level must be == 0"); |
|
174 |
} |
|
175 |
} |
|
176 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
177 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
178 |
* Checks, that {@linkplain #method} is compiled. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
179 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
180 |
* @throws RuntimeException if {@linkplain #method} isn't in compiler queue |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
181 |
* and isn't compiled, or if {@linkplain #method} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
182 |
* has nonzero compilation level |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
183 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
184 |
protected final void checkCompiled() { |
15621 | 185 |
final long start = System.currentTimeMillis(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
186 |
waitBackgroundCompilation(); |
15621 | 187 |
if (WHITE_BOX.isMethodQueuedForCompilation(method)) { |
188 |
System.err.printf("Warning: %s is still in queue after %dms%n", |
|
189 |
method, System.currentTimeMillis() - start); |
|
190 |
return; |
|
191 |
} |
|
192 |
if (!WHITE_BOX.isMethodCompiled(method)) { |
|
193 |
throw new RuntimeException(method + " must be compiled"); |
|
194 |
} |
|
195 |
if (WHITE_BOX.getMethodCompilationLevel(method) == 0) { |
|
196 |
throw new RuntimeException(method + " comp_level must be != 0"); |
|
197 |
} |
|
198 |
} |
|
199 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
200 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
201 |
* Waits for completion of background compilation of {@linkplain #method}. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
202 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
203 |
protected final void waitBackgroundCompilation() { |
16367 | 204 |
if (!BACKGROUND_COMPILATION) { |
205 |
return; |
|
206 |
} |
|
15621 | 207 |
final Object obj = new Object(); |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
208 |
for (int i = 0; i < 10 |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
209 |
&& WHITE_BOX.isMethodQueuedForCompilation(method); ++i) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
210 |
synchronized (obj) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
211 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
212 |
obj.wait(1000); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
213 |
} catch (InterruptedException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
214 |
Thread.currentThread().interrupt(); |
15621 | 215 |
} |
216 |
} |
|
217 |
} |
|
218 |
} |
|
219 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
220 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
221 |
* Prints information about {@linkplain #method}. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
222 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
223 |
protected final void printInfo() { |
15621 | 224 |
System.out.printf("%n%s:%n", method); |
225 |
System.out.printf("\tcompilable:\t%b%n", |
|
226 |
WHITE_BOX.isMethodCompilable(method)); |
|
227 |
System.out.printf("\tcompiled:\t%b%n", |
|
228 |
WHITE_BOX.isMethodCompiled(method)); |
|
229 |
System.out.printf("\tcomp_level:\t%d%n", |
|
230 |
WHITE_BOX.getMethodCompilationLevel(method)); |
|
231 |
System.out.printf("\tin_queue:\t%b%n", |
|
232 |
WHITE_BOX.isMethodQueuedForCompilation(method)); |
|
233 |
System.out.printf("compile_queues_size:\t%d%n%n", |
|
234 |
WHITE_BOX.getCompileQueuesSize()); |
|
235 |
} |
|
236 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
237 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
238 |
* Executes testing. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
239 |
*/ |
15621 | 240 |
protected abstract void test() throws Exception; |
241 |
||
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
242 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
243 |
* Tries to trigger compilation of {@linkplain #method} by call |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
244 |
* {@linkplain #callable} enough times. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
245 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
246 |
* @return accumulated result |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
247 |
* @see #compile(int) |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
248 |
*/ |
15621 | 249 |
protected final int compile() { |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
250 |
return compile(Math.max(COMPILE_THRESHOLD, 150000)); |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
251 |
} |
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
252 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
253 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
254 |
* Tries to trigger compilation of {@linkplain #method} by call |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
255 |
* {@linkplain #callable} specified times. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
256 |
* |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
257 |
* @param count invocation count |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
258 |
* @return accumulated result |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
259 |
*/ |
16689
efce070b8d42
8007288: Additional WB API for compiler's testing
iignatyev
parents:
16367
diff
changeset
|
260 |
protected final int compile(int count) { |
15621 | 261 |
int result = 0; |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
262 |
Integer tmp; |
16367 | 263 |
for (int i = 0; i < count; ++i) { |
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
264 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
265 |
tmp = callable.call(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
266 |
} catch (Exception e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
267 |
tmp = null; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
268 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
269 |
result += tmp == null ? 0 : tmp; |
15621 | 270 |
} |
16367 | 271 |
System.out.println("method was invoked " + count + " times"); |
15621 | 272 |
return result; |
273 |
} |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
274 |
} |
15621 | 275 |
|
17015
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
276 |
/** |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
277 |
* Utility structure containing tested method and object to invoke it. |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
278 |
*/ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
279 |
enum TestCase { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
280 |
/** constructor test case */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
281 |
CONSTRUCTOR_TEST(Helper.CONSTRUCTOR, Helper.CONSTRUCTOR_CALLABLE), |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
282 |
/** method test case */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
283 |
METOD_TEST(Helper.METHOD, Helper.METHOD_CALLABLE), |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
284 |
/** static method test case */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
285 |
STATIC_TEST(Helper.STATIC, Helper.STATIC_CALLABLE); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
286 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
287 |
/** tested method */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
288 |
final Executable executable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
289 |
/** object to invoke {@linkplain #executable} */ |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
290 |
final Callable<Integer> callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
291 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
292 |
private TestCase(Executable executable, Callable<Integer> callable) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
293 |
this.executable = executable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
294 |
this.callable = callable; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
295 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
296 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
297 |
private static class Helper { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
298 |
private static final Callable<Integer> CONSTRUCTOR_CALLABLE |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
299 |
= new Callable<Integer>() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
300 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
301 |
public Integer call() throws Exception { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
302 |
return new Helper(1337).hashCode(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
303 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
304 |
}; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
305 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
306 |
private static final Callable<Integer> METHOD_CALLABLE |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
307 |
= new Callable<Integer>() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
308 |
private final Helper helper = new Helper(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
309 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
310 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
311 |
public Integer call() throws Exception { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
312 |
return helper.method(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
313 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
314 |
}; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
315 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
316 |
private static final Callable<Integer> STATIC_CALLABLE |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
317 |
= new Callable<Integer>() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
318 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
319 |
public Integer call() throws Exception { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
320 |
return staticMethod(); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
321 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
322 |
}; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
323 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
324 |
private static final Constructor CONSTRUCTOR; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
325 |
private static final Method METHOD; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
326 |
private static final Method STATIC; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
327 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
328 |
static { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
329 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
330 |
CONSTRUCTOR = Helper.class.getDeclaredConstructor(int.class); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
331 |
} catch (NoSuchMethodException | SecurityException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
332 |
throw new RuntimeException( |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
333 |
"exception on getting method Helper.<init>(int)", e); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
334 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
335 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
336 |
METHOD = Helper.class.getDeclaredMethod("method"); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
337 |
} catch (NoSuchMethodException | SecurityException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
338 |
throw new RuntimeException( |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
339 |
"exception on getting method Helper.method()", e); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
340 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
341 |
try { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
342 |
STATIC = Helper.class.getDeclaredMethod("staticMethod"); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
343 |
} catch (NoSuchMethodException | SecurityException e) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
344 |
throw new RuntimeException( |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
345 |
"exception on getting method Helper.staticMethod()", e); |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
346 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
347 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
348 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
349 |
private static int staticMethod() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
350 |
return 1138; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
351 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
352 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
353 |
private int method() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
354 |
return 42; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
355 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
356 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
357 |
private final int x; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
358 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
359 |
public Helper() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
360 |
x = 0; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
361 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
362 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
363 |
private Helper(int x) { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
364 |
this.x = x; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
365 |
} |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
366 |
|
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
367 |
@Override |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
368 |
public int hashCode() { |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
369 |
return x; |
92390f57e8b1
8011971: WB API doesn't accept j.l.reflect.Constructor
iignatyev
parents:
16689
diff
changeset
|
370 |
} |
15621 | 371 |
} |
372 |
} |