Lines 7-12
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 328281 - visibility leaks not detected when analyzing unused field in private class |
10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.compiler.regression; |
12 |
package org.eclipse.jdt.core.tests.compiler.regression; |
12 |
|
13 |
|
Lines 5154-5159
Link Here
|
5154 |
"----------\n"); |
5155 |
"----------\n"); |
5155 |
} |
5156 |
} |
5156 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=296660 |
5157 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=296660 |
|
|
5158 |
// check independence of textual order |
5159 |
public void test099a() { |
5160 |
this.runNegativeTest( |
5161 |
new String[] { |
5162 |
"X.java", |
5163 |
"public class X {\n" + |
5164 |
" public class C extends B {\n" + |
5165 |
" public void foo(int a) {\n" + |
5166 |
" System.out.println(\"Hello\");\n" + |
5167 |
" }\n" + |
5168 |
" public void foo(double a) {\n" + |
5169 |
" System.out.println(\"Hello\");\n" + |
5170 |
" }\n" + |
5171 |
" public void foo(boolean a) {\n" + |
5172 |
" System.out.println(\"Hello\");\n" + |
5173 |
" }\n" + |
5174 |
" public void foo(byte a) {\n" + |
5175 |
" System.out.println(\"Hello\");\n" + |
5176 |
" }\n" + |
5177 |
" }\n" + |
5178 |
" private class B extends A {\n" + |
5179 |
" public void foo(int a) {\n" + |
5180 |
" System.out.println(\"Hello\");\n" + |
5181 |
" }\n" + |
5182 |
" public void foo(float a) {\n" + |
5183 |
" System.out.println(\"Hello\");\n" + |
5184 |
" }\n" + |
5185 |
" public void foo(double a) {\n" + |
5186 |
" System.out.println(\"Hello\");\n" + |
5187 |
" }\n" + |
5188 |
" public void foo(char a) {\n" + |
5189 |
" System.out.println(\"Hello\");\n" + |
5190 |
" }\n" + |
5191 |
" }\n" + |
5192 |
" private class A {\n" + |
5193 |
" public void foo(int a) {\n" + |
5194 |
" System.out.println(\"Hello\");\n" + |
5195 |
" }\n" + |
5196 |
" public void foo(float a) {\n" + |
5197 |
" System.out.println(\"Hello\");\n" + |
5198 |
" }\n" + |
5199 |
" public void foo(boolean a) {\n" + |
5200 |
" System.out.println(\"Hello\");\n" + |
5201 |
" }\n" + |
5202 |
" public void foo(Integer a) {\n" + |
5203 |
" System.out.println(\"Hello\");\n" + |
5204 |
" }\n" + |
5205 |
" }\n" + |
5206 |
"}\n" |
5207 |
}, |
5208 |
"----------\n" + |
5209 |
"1. WARNING in X.java (at line 2)\n" + |
5210 |
" public class C extends B {\n" + |
5211 |
" ^\n" + |
5212 |
"Access to enclosing constructor X.B() is emulated by a synthetic accessor method\n" + |
5213 |
"----------\n" + |
5214 |
"2. WARNING in X.java (at line 16)\n" + |
5215 |
" private class B extends A {\n" + |
5216 |
" ^\n" + |
5217 |
"Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + |
5218 |
"----------\n" + |
5219 |
"3. WARNING in X.java (at line 23)\n" + |
5220 |
" public void foo(double a) {\n" + |
5221 |
" ^^^^^^^^^^^^^\n" + |
5222 |
"The method foo(double) from the type X.B is never used locally\n" + |
5223 |
"----------\n" + |
5224 |
"4. WARNING in X.java (at line 31)\n" + |
5225 |
" public void foo(int a) {\n" + |
5226 |
" ^^^^^^^^^^\n" + |
5227 |
"The method foo(int) from the type X.A is never used locally\n" + |
5228 |
"----------\n" + |
5229 |
"5. WARNING in X.java (at line 34)\n" + |
5230 |
" public void foo(float a) {\n" + |
5231 |
" ^^^^^^^^^^^^\n" + |
5232 |
"The method foo(float) from the type X.A is never used locally\n" + |
5233 |
"----------\n" + |
5234 |
"6. WARNING in X.java (at line 37)\n" + |
5235 |
" public void foo(boolean a) {\n" + |
5236 |
" ^^^^^^^^^^^^^^\n" + |
5237 |
"The method foo(boolean) from the type X.A is never used locally\n" + |
5238 |
"----------\n"); |
5239 |
} |
5240 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=296660 |
5241 |
// check usage via super-call |
5242 |
public void test099b() { |
5243 |
this.runNegativeTest( |
5244 |
new String[] { |
5245 |
"X.java", |
5246 |
"public class X {\n" + |
5247 |
" private class A {\n" + |
5248 |
" public void foo(int a) {\n" + |
5249 |
" System.out.println(\"Hello\");\n" + |
5250 |
" }\n" + |
5251 |
" public void foo(float a) {\n" + |
5252 |
" System.out.println(\"Hello\");\n" + |
5253 |
" }\n" + |
5254 |
" public void foo(boolean a) {\n" + |
5255 |
" System.out.println(\"Hello\");\n" + |
5256 |
" }\n" + |
5257 |
" public void foo(Integer a) {\n" + |
5258 |
" System.out.println(\"Hello\");\n" + |
5259 |
" }\n" + |
5260 |
" }\n" + |
5261 |
" private class B extends A {\n" + |
5262 |
" public void foo(int a) {\n" + |
5263 |
" super.foo(a);\n" + |
5264 |
" }\n" + |
5265 |
" public void foo(float a) {\n" + |
5266 |
" super.foo(a);\n" + |
5267 |
" }\n" + |
5268 |
" public void foo(double a) {\n" + |
5269 |
" System.out.println(\"Hello\");\n" + |
5270 |
" }\n" + |
5271 |
" public void foo(char a) {\n" + |
5272 |
" System.out.println(\"Hello\");\n" + |
5273 |
" }\n" + |
5274 |
" }\n" + |
5275 |
" public class C extends B {\n" + |
5276 |
" public void foo(int a) {\n" + |
5277 |
" System.out.println(\"Hello\");\n" + |
5278 |
" }\n" + |
5279 |
" public void foo(double a) {\n" + |
5280 |
" super.foo(a);\n" + |
5281 |
" }\n" + |
5282 |
" public void foo(boolean a) {\n" + |
5283 |
" super.foo(a);\n" + |
5284 |
" }\n" + |
5285 |
" public void foo(byte a) {\n" + |
5286 |
" System.out.println(\"Hello\");\n" + |
5287 |
" }\n" + |
5288 |
" }\n" + |
5289 |
"}\n" |
5290 |
}, |
5291 |
"----------\n" + |
5292 |
"1. WARNING in X.java (at line 16)\n" + |
5293 |
" private class B extends A {\n" + |
5294 |
" ^\n" + |
5295 |
"Access to enclosing constructor X.A() is emulated by a synthetic accessor method\n" + |
5296 |
"----------\n" + |
5297 |
"2. WARNING in X.java (at line 30)\n" + |
5298 |
" public class C extends B {\n" + |
5299 |
" ^\n" + |
5300 |
"Access to enclosing constructor X.B() is emulated by a synthetic accessor method\n" + |
5301 |
"----------\n"); |
5302 |
} |
5303 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=296660 |
5157 |
public void test100() { |
5304 |
public void test100() { |
5158 |
this.runNegativeTest( |
5305 |
this.runNegativeTest( |
5159 |
new String[] { |
5306 |
new String[] { |