Added
Link Here
|
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2010 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
7 |
* |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.jdt.core.tests.compiler.regression; |
12 |
|
13 |
import java.util.Map; |
14 |
|
15 |
import junit.framework.Test; |
16 |
|
17 |
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; |
18 |
|
19 |
public class InnerClass15Test extends AbstractRegressionTest { |
20 |
public InnerClass15Test(String name) { |
21 |
super(name); |
22 |
} |
23 |
static { |
24 |
// TESTS_NUMBERS = new int[] { 2 }; |
25 |
} |
26 |
public static Test suite() { |
27 |
return buildMinimalComplianceTestSuite(testClass(), F_1_5); |
28 |
} |
29 |
protected Map getCompilerOptions() { |
30 |
Map options = super.getCompilerOptions(); |
31 |
options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE); |
32 |
return options; |
33 |
} |
34 |
public void test001() { |
35 |
this.runNegativeTest(new String[] { |
36 |
"X.java", |
37 |
"class X {\n" + |
38 |
" <X> void foo() {\n" + |
39 |
" class X {}\n" + |
40 |
" }\n" + |
41 |
"}", |
42 |
}, |
43 |
"----------\n" + |
44 |
"1. ERROR in X.java (at line 3)\n" + |
45 |
" class X {}\n" + |
46 |
" ^\n" + |
47 |
"The nested type X cannot hide an enclosing type\n" + |
48 |
"----------\n"); |
49 |
} |
50 |
public void test002() { |
51 |
this.runNegativeTest(new String[] { |
52 |
"X.java", |
53 |
"class X<X> {\n" + |
54 |
" void foo() {\n" + |
55 |
" class X {}\n" + |
56 |
" }\n" + |
57 |
"}", |
58 |
}, |
59 |
"----------\n" + |
60 |
"1. ERROR in X.java (at line 3)\n" + |
61 |
" class X {}\n" + |
62 |
" ^\n" + |
63 |
"The nested type X cannot hide an enclosing type\n" + |
64 |
"----------\n"); |
65 |
} |
66 |
public static Class testClass() { |
67 |
return InnerClass15Test.class; |
68 |
} |
69 |
} |