View | Details | Raw Unified | Return to bug 324848 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java (-1 / +1 lines)
Lines 879-885 Link Here
879
 * to abort.
879
 * to abort.
880
 */
880
 */
881
public ProblemReporter problemReporter() {
881
public ProblemReporter problemReporter() {
882
	return outerMostMethodScope().problemReporter();
882
	return methodScope().problemReporter();
883
}
883
}
884
884
885
/*
885
/*
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java (-8 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 403-415 Link Here
403
 * to abort.
403
 * to abort.
404
 */
404
 */
405
public ProblemReporter problemReporter() {
405
public ProblemReporter problemReporter() {
406
	MethodScope outerMethodScope;
406
	ProblemReporter problemReporter = referenceCompilationUnit().problemReporter;
407
	if ((outerMethodScope = outerMostMethodScope()) == this) {
407
	problemReporter.referenceContext = this.referenceContext;
408
		ProblemReporter problemReporter = referenceCompilationUnit().problemReporter;
408
	return problemReporter;
409
		problemReporter.referenceContext = this.referenceContext;
410
		return problemReporter;
411
	}
412
	return outerMethodScope.problemReporter();
413
}
409
}
414
410
415
public final int recordInitializationStates(FlowInfo flowInfo) {
411
public final int recordInitializationStates(FlowInfo flowInfo) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java (-17 / +5 lines)
Lines 38-43 Link Here
38
		options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
38
		options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
39
		options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED);
39
		options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED);
40
	}
40
	}
41
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
42
	options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE);
43
	options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.IGNORE);
44
	options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
41
	return options;
45
	return options;
42
}
46
}
43
public static Test suite() {
47
public static Test suite() {
Lines 1676-1687 Link Here
1676
			"}"
1680
			"}"
1677
		},
1681
		},
1678
		"----------\n" +
1682
		"----------\n" +
1679
		"1. WARNING in p\\A.java (at line 6)\n" +
1683
		"1. ERROR in p\\A.java (at line 8)\n" +
1680
		"	private int i;\n" +
1681
		"	            ^\n" +
1682
		"The field A.i is never read locally\n" +
1683
		"----------\n" +
1684
		"2. ERROR in p\\A.java (at line 8)\n" +
1685
		"	int x = i;\n" +
1684
		"	int x = i;\n" +
1686
		"	        ^\n" +
1685
		"	        ^\n" +
1687
		"Cannot make a static reference to the non-static field i\n" +
1686
		"Cannot make a static reference to the non-static field i\n" +
Lines 1999-2010 Link Here
1999
		"	Z someField;	\n" +
1998
		"	Z someField;	\n" +
2000
		"	^\n" +
1999
		"	^\n" +
2001
		"The type Z is defined in an inherited type and an enclosing scope\n" +
2000
		"The type Z is defined in an inherited type and an enclosing scope\n" +
2002
		"----------\n" +
2003
		"----------\n" +
2004
		"1. WARNING in q\\Y.java (at line 3)\n" +
2005
		"	private static class X {}	\n" +
2006
		"	                     ^\n" +
2007
		"The type Y.X is never used locally\n" +
2008
		"----------\n");
2001
		"----------\n");
2009
}
2002
}
2010
2003
Lines 2874-2884 Link Here
2874
		"	this.super();\n" +
2867
		"	this.super();\n" +
2875
		"	^^^^\n" +
2868
		"	^^^^\n" +
2876
		"Illegal enclosing instance specification for type Object\n" +
2869
		"Illegal enclosing instance specification for type Object\n" +
2877
		"----------\n" +
2878
		"3. WARNING in p\\X.java (at line 25)\n" +
2879
		"	private void a() { System.out.println(\"A\");} \n" +
2880
		"	             ^^^\n" +
2881
		"The method a() from the type X is never used locally\n" +
2882
		"----------\n");
2870
		"----------\n");
2883
}
2871
}
2884
/*
2872
/*
(-)src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java (-72 / +11 lines)
Lines 40-45 Link Here
40
		options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
40
		options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR);
41
		options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED);
41
		options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED);
42
	}
42
	}
43
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
44
	options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE);
45
	options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.IGNORE);
46
	options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
43
	return options;
47
	return options;
44
}
48
}
45
public static Test suite() {
49
public static Test suite() {
Lines 1752-1763 Link Here
1752
			"}"
1756
			"}"
1753
		},
1757
		},
1754
		"----------\n" +
1758
		"----------\n" +
1755
		"1. WARNING in p\\A.java (at line 6)\n" +
1759
		"1. ERROR in p\\A.java (at line 8)\n" +
1756
		"	private int i;\n" +
1757
		"	            ^\n" +
1758
		"The field A.i is never read locally\n" +
1759
		"----------\n" +
1760
		"2. ERROR in p\\A.java (at line 8)\n" +
1761
		"	int x = i;\n" +
1760
		"	int x = i;\n" +
1762
		"	        ^\n" +
1761
		"	        ^\n" +
1763
		"Cannot make a static reference to the non-static field i\n" +
1762
		"Cannot make a static reference to the non-static field i\n" +
Lines 1984-2009 Link Here
1984
			"}",
1983
			"}",
1985
		},
1984
		},
1986
		// compiler results
1985
		// compiler results
1987
		"----------\n" +  /* expected compiler log */
1988
		"1. WARNING in p\\FieldQualification.java (at line 5)\n" +
1989
		"	class Local {\n" +
1990
		"	      ^^^^^\n" +
1991
		"The type Local is never used locally\n" +
1992
		"----------\n" +
1986
		"----------\n" +
1993
		"2. WARNING in p\\FieldQualification.java (at line 6)\n" +
1987
		"1. WARNING in p\\FieldQualification.java (at line 6)\n" +
1994
		"	String field = \"Enclosing field for anonymous type\";\n" +
1988
		"	String field = \"Enclosing field for anonymous type\";\n" +
1995
		"	       ^^^^^\n" +
1989
		"	       ^^^^^\n" +
1996
		"The field Local.field is hiding a field from type FieldQualification\n" +
1990
		"The field Local.field is hiding a field from type FieldQualification\n" +
1997
		"----------\n" +
1998
		"3. WARNING in p\\FieldQualification.java (at line 6)\n" +
1999
		"	String field = \"Enclosing field for anonymous type\";\n" +
2000
		"	       ^^^^^\n" +
2001
		"The field Local.field is never read locally\n" +
2002
		"----------\n" +
2003
		"4. WARNING in p\\FieldQualification.java (at line 7)\n" +
2004
		"	void foo() {\n" +
2005
		"	     ^^^^^\n" +
2006
		"The method foo() from the type Local is never used locally\n" +
2007
		"----------\n",
1991
		"----------\n",
2008
		// runtime results
1992
		// runtime results
2009
		null /* do not check output string */,
1993
		null /* do not check output string */,
Lines 2066-2082 Link Here
2066
			"}	\n"
2050
			"}	\n"
2067
		},
2051
		},
2068
		// compiler results
2052
		// compiler results
2069
		"----------\n" +  /* expected compiler log */
2053
		"",
2070
		"1. WARNING in q\\Y.java (at line 3)\n" +
2071
		"	private static class X {}	\n" +
2072
		"	                     ^\n" +
2073
		"The type Y.X is never used locally\n" +
2074
		"----------\n",
2075
		// runtime results
2054
		// runtime results
2076
		null /* do not check output string */,
2055
		null /* do not check output string */,
2077
		null /* do not check error string */,
2056
		null /* do not check error string */,
2078
		// javac options
2057
		// javac options
2079
		JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings /* javac test options */);
2058
		JavacTestOptions.DEFAULT /* javac test options */);
2080
}
2059
}
2081
/*
2060
/*
2082
 * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11435
2061
 * http://bugs.eclipse.org/bugs/show_bug.cgi?id=11435
Lines 2948-2974 Link Here
2948
		"	^^^^\n" +
2927
		"	^^^^\n" +
2949
		"Illegal enclosing instance specification for type Object\n" +
2928
		"Illegal enclosing instance specification for type Object\n" +
2950
		"----------\n" +
2929
		"----------\n" +
2951
		"3. WARNING in p\\X.java (at line 25)\n" +
2930
		"3. WARNING in p\\X.java (at line 39)\n" +
2952
		"	private void a() { System.out.println(\"A\");} \n" +
2953
		"	             ^^^\n" +
2954
		"The method a() from the type X is never used locally\n" +
2955
		"----------\n" +
2956
		"4. WARNING in p\\X.java (at line 31)\n" +
2957
		"	Class c = b.getClass();\n" +
2958
		"	^^^^^\n" +
2959
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
2960
		"----------\n" +
2961
		"5. WARNING in p\\X.java (at line 32)\n" +
2962
		"	Class _getClasses [] = X.class.getClasses(); \n" +
2963
		"	^^^^^\n" +
2964
		"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
2965
		"----------\n" +
2966
		"6. WARNING in p\\X.java (at line 36)\n" +
2967
		"	Constructor _getConstructors[] = c.getConstructors(); \n" +
2968
		"	^^^^^^^^^^^\n" +
2969
		"Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" +
2970
		"----------\n" +
2971
		"7. WARNING in p\\X.java (at line 39)\n" +
2972
		"	Method _getMethod = c.getMethod(\"d\",null);\n" +
2931
		"	Method _getMethod = c.getMethod(\"d\",null);\n" +
2973
		"	                    ^^^^^^^^^^^^^^^^^^^^^\n" +
2932
		"	                    ^^^^^^^^^^^^^^^^^^^^^\n" +
2974
		"The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation\n" +
2933
		"The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation\n" +
Lines 2986-3017 Link Here
2986
			"	^^^^\n" +
2945
			"	^^^^\n" +
2987
			"Illegal enclosing instance specification for type Object\n" +
2946
			"Illegal enclosing instance specification for type Object\n" +
2988
			"----------\n" +
2947
			"----------\n" +
2989
			"3. WARNING in p\\X.java (at line 25)\n" +
2948
			"3. WARNING in p\\X.java (at line 39)\n" +
2990
			"	private void a() { System.out.println(\"A\");} \n" +
2991
			"	             ^^^\n" +
2992
			"The method a() from the type X is never used locally\n" +
2993
			"----------\n" +
2994
			"4. WARNING in p\\X.java (at line 31)\n" +
2995
			"	Class c = b.getClass();\n" +
2996
			"	^^^^^\n" +
2997
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
2998
			"----------\n" +
2999
			"5. WARNING in p\\X.java (at line 32)\n" +
3000
			"	Class _getClasses [] = X.class.getClasses(); \n" +
3001
			"	^^^^^\n" +
3002
			"Class is a raw type. References to generic type Class<T> should be parameterized\n" +
3003
			"----------\n" +
3004
			"6. WARNING in p\\X.java (at line 36)\n" +
3005
			"	Constructor _getConstructors[] = c.getConstructors(); \n" +
3006
			"	^^^^^^^^^^^\n" +
3007
			"Constructor is a raw type. References to generic type Constructor<T> should be parameterized\n" +
3008
			"----------\n" +
3009
			"7. WARNING in p\\X.java (at line 39)\n" +
3010
			"	Method _getMethod = c.getMethod(\"d\",null);\n" +
2949
			"	Method _getMethod = c.getMethod(\"d\",null);\n" +
3011
			"	                    ^^^^^^^^^^^^^^^^^^^^^\n" +
2950
			"	                    ^^^^^^^^^^^^^^^^^^^^^\n" +
3012
			"The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation\n" +
2951
			"The argument of type null should explicitly be cast to Class[] for the invocation of the varargs method getMethod(String, Class...) from type Class. It could alternatively be cast to Class for a varargs invocation\n" +
3013
			"----------\n" +
2952
			"----------\n" +
3014
			"8. WARNING in p\\X.java (at line 39)\n" +
2953
			"4. WARNING in p\\X.java (at line 39)\n" +
3015
			"	Method _getMethod = c.getMethod(\"d\",null);\n" +
2954
			"	Method _getMethod = c.getMethod(\"d\",null);\n" +
3016
			"	                    ^^^^^^^^^^^^^^^^^^^^^\n" +
2955
			"	                    ^^^^^^^^^^^^^^^^^^^^^\n" +
3017
			"Type safety: The method getMethod(String, Class...) belongs to the raw type Class. References to generic type Class<T> should be parameterized\n" +
2956
			"Type safety: The method getMethod(String, Class...) belongs to the raw type Class. References to generic type Class<T> should be parameterized\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java (-12 / +5 lines)
Lines 53-58 Link Here
53
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTags, CompilerOptions.ERROR);
53
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTags, CompilerOptions.ERROR);
54
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility, CompilerOptions.PRIVATE);
54
		options.put(CompilerOptions.OPTION_ReportMissingJavadocTagsVisibility, CompilerOptions.PRIVATE);
55
		options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.DISABLED);
55
		options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.DISABLED);
56
		options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE);
57
		options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.IGNORE);
58
		options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
56
		if (this.reportMissingJavadocComments != null)
59
		if (this.reportMissingJavadocComments != null)
57
			options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, this.reportMissingJavadocComments);
60
			options.put(CompilerOptions.OPTION_ReportMissingJavadocComments, this.reportMissingJavadocComments);
58
		return options;
61
		return options;
Lines 3755-3766 Link Here
3755
			"}\n",
3758
			"}\n",
3756
        },
3759
        },
3757
		"----------\n" +
3760
		"----------\n" +
3758
		"1. WARNING in X.java (at line 3)\n" +
3761
		"1. ERROR in X.java (at line 3)\n" +
3759
		"	static int bar;\n" +
3760
		"	           ^^^\n" +
3761
		"The field new BugDemo(){}.bar is never read locally\n" +
3762
		"----------\n" +
3763
		"2. ERROR in X.java (at line 3)\n" +
3764
		"	static int bar;\n" +
3762
		"	static int bar;\n" +
3765
		"	           ^^^\n" +
3763
		"	           ^^^\n" +
3766
		"The field bar cannot be declared static; static fields can only be declared in static or top level types\n" +
3764
		"The field bar cannot be declared static; static fields can only be declared in static or top level types\n" +
Lines 6193-6204 Link Here
6193
			"}\n"
6191
			"}\n"
6194
		},
6192
		},
6195
		null, customOptions,
6193
		null, customOptions,
6196
		"----------\n" + 
6194
		"",
6197
		"1. WARNING in X.java (at line 8)\n" + 
6198
		"	private enum Complaint {       WARNING, ERROR, FATAL_ERROR, PANIC;\n" + 
6199
		"	             ^^^^^^^^^\n" + 
6200
		"The type X.Complaint is never used locally\n" + 
6201
		"----------\n",
6202
		"HELLORED", null, 
6195
		"HELLORED", null, 
6203
		JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings);
6196
		JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings);
6204
}
6197
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-157 / +64 lines)
Lines 30-36 Link Here
30
	// Static initializer to specify tests subset using TESTS_* static variables
30
	// Static initializer to specify tests subset using TESTS_* static variables
31
	// All specified tests which does not belong to the class are skipped...
31
	// All specified tests which does not belong to the class are skipped...
32
	static {
32
	static {
33
//		TESTS_NAMES = new String[] { "test1464" };
33
//		TESTS_NAMES = new String[] { "test1203c", "test1203d" };
34
//		TESTS_NUMBERS = new int[] { 1465 };
34
//		TESTS_NUMBERS = new int[] { 1465 };
35
//		TESTS_RANGE = new int[] { 1097, -1 };
35
//		TESTS_RANGE = new int[] { 1097, -1 };
36
	}
36
	}
Lines 43-51 Link Here
43
	}
43
	}
44
44
45
	protected Map getCompilerOptions() {
45
	protected Map getCompilerOptions() {
46
		Map compilerOptions = super.getCompilerOptions();
46
		Map options = super.getCompilerOptions();
47
		compilerOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.DISABLED);
47
		options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.DISABLED);
48
		return compilerOptions;
48
		options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE);
49
		options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.IGNORE);
50
		options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
51
		return options;
49
	}
52
	}
50
53
51
	public void test0001() {
54
	public void test0001() {
Lines 14393-14409 Link Here
14393
				"}\n"
14396
				"}\n"
14394
			},
14397
			},
14395
			"----------\n" + 
14398
			"----------\n" + 
14396
			"1. WARNING in test\\Foo.java (at line 4)\n" + 
14397
			"	private R dosomething(){ return s; } \n" + 
14398
			"	          ^^^^^^^^^^^^^\n" + 
14399
			"The method dosomething() from the type Foo<R> is never used locally\n" + 
14400
			"----------\n" + 
14401
			"2. WARNING in test\\Foo.java (at line 5)\n" + 
14402
			"	private class Bar {} \n" + 
14403
			"	              ^^^\n" + 
14404
			"The type Foo<R>.Bar is never used locally\n" + 
14405
			"----------\n" + 
14406
			"----------\n" + 
14407
			"1. ERROR in test02\\FooBar.java (at line 6)\n" + 
14399
			"1. ERROR in test02\\FooBar.java (at line 6)\n" + 
14408
			"	f.s = \"foo\"; \n" + 
14400
			"	f.s = \"foo\"; \n" + 
14409
			"	  ^\n" + 
14401
			"	  ^\n" + 
Lines 19118-19129 Link Here
19118
    		"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" +
19110
    		"	private static class Bucket extends LinkedList<MPair<K,V>> {}\n" +
19119
    		"	                                                       ^\n" +
19111
    		"	                                                       ^\n" +
19120
    		"Cannot make a static reference to the non-static type V\n" +
19112
    		"Cannot make a static reference to the non-static type V\n" +
19121
    		"----------\n" +
19113
	    	"----------\n");
19122
    		"3. WARNING in X.java (at line 7)\n" +
19123
    		"	private Bucket[] buckets = new X.Bucket[100];\n" +
19124
    		"	                 ^^^^^^^\n" +
19125
    		"The field X<K,V>.buckets is never read locally\n" +
19126
    		"----------\n");
19127
	}
19114
	}
19128
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973
19115
	//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84973
19129
	public void test0613() {
19116
	public void test0613() {
Lines 25832-25858 Link Here
25832
			"}\n",
25819
			"}\n",
25833
		},
25820
		},
25834
		"----------\n" +
25821
		"----------\n" +
25835
		"1. WARNING in X.java (at line 2)\n" +
25822
		"1. WARNING in X.java (at line 7)\n" +
25836
		"	private T t;\n" +
25837
		"	          ^\n" +
25838
		"The field X<T>.t is never read locally\n" +
25839
		"----------\n" +
25840
		"2. WARNING in X.java (at line 3)\n" +
25841
		"	private X<?>.Inner inner;\n" +
25842
		"	                   ^^^^^\n" +
25843
		"The field X<T>.inner is never read locally\n" +
25844
		"----------\n" +
25845
		"3. WARNING in X.java (at line 4)\n" +
25846
		"	private X<?>.Inner[] inners;\n" +
25847
		"	                     ^^^^^^\n" +
25848
		"The field X<T>.inners is never read locally\n" +
25849
		"----------\n" +
25850
		"4. WARNING in X.java (at line 7)\n" +
25851
		"	this.inner = new X.Inner();\n" +
25823
		"	this.inner = new X.Inner();\n" +
25852
		"	                 ^^^^^^^\n" +
25824
		"	                 ^^^^^^^\n" +
25853
		"X.Inner is a raw type. References to generic type X<T>.Inner should be parameterized\n" +
25825
		"X.Inner is a raw type. References to generic type X<T>.Inner should be parameterized\n" +
25854
		"----------\n" +
25826
		"----------\n" +
25855
		"5. ERROR in X.java (at line 9)\n" +
25827
		"2. ERROR in X.java (at line 9)\n" +
25856
		"	Zork z;\n" +
25828
		"	Zork z;\n" +
25857
		"	^^^^\n" +
25829
		"	^^^^\n" +
25858
		"Zork cannot be resolved to a type\n" +
25830
		"Zork cannot be resolved to a type\n" +
Lines 26020-26066 Link Here
26020
				"}\n",
25992
				"}\n",
26021
			},
25993
			},
26022
			"----------\n" + 
25994
			"----------\n" + 
26023
			"1. WARNING in X.java (at line 4)\n" + 
25995
			"1. WARNING in X.java (at line 9)\n" + 
26024
			"	private T t;\n" + 
26025
			"	          ^\n" + 
26026
			"The field X<T>.t is never read locally\n" + 
26027
			"----------\n" + 
26028
			"2. WARNING in X.java (at line 9)\n" + 
26029
			"	if (this.inner instanceof X<?>.Inner) {}\n" + 
25996
			"	if (this.inner instanceof X<?>.Inner) {}\n" + 
26030
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
25997
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26031
			"The expression of type X<?>.Inner is already an instance of type X<?>.Inner\n" + 
25998
			"The expression of type X<?>.Inner is already an instance of type X<?>.Inner\n" + 
26032
			"----------\n" + 
25999
			"----------\n" + 
26033
			"3. WARNING in X.java (at line 10)\n" + 
26000
			"2. WARNING in X.java (at line 10)\n" + 
26034
			"	if (this.inners instanceof X<?>.Inner[]) {}\n" + 
26001
			"	if (this.inners instanceof X<?>.Inner[]) {}\n" + 
26035
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26002
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26036
			"The expression of type X<?>.Inner[] is already an instance of type X<?>.Inner[]\n" + 
26003
			"The expression of type X<?>.Inner[] is already an instance of type X<?>.Inner[]\n" + 
26037
			"----------\n" + 
26004
			"----------\n" + 
26038
			"4. WARNING in X.java (at line 14)\n" + 
26005
			"3. WARNING in X.java (at line 14)\n" + 
26039
			"	void foo(List l) {\n" + 
26006
			"	void foo(List l) {\n" + 
26040
			"	         ^^^^\n" + 
26007
			"	         ^^^^\n" + 
26041
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
26008
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
26042
			"----------\n" + 
26009
			"----------\n" + 
26043
			"5. WARNING in X.java (at line 15)\n" + 
26010
			"4. WARNING in X.java (at line 15)\n" + 
26044
			"	if (l instanceof List<?>) {}\n" + 
26011
			"	if (l instanceof List<?>) {}\n" + 
26045
			"	    ^^^^^^^^^^^^^^^^^\n" + 
26012
			"	    ^^^^^^^^^^^^^^^^^\n" + 
26046
			"The expression of type List is already an instance of type List<?>\n" + 
26013
			"The expression of type List is already an instance of type List<?>\n" + 
26047
			"----------\n" + 
26014
			"----------\n" + 
26048
			"6. ERROR in X.java (at line 16)\n" + 
26015
			"5. ERROR in X.java (at line 16)\n" + 
26049
			"	if (l instanceof List<? extends String>) {}\n" + 
26016
			"	if (l instanceof List<? extends String>) {}\n" + 
26050
			"	    ^^^^^^^^^^^^^^^^^\n" + 
26017
			"	    ^^^^^^^^^^^^^^^^^\n" + 
26051
			"Cannot perform instanceof check against parameterized type List<? extends String>. Use the form List<?> instead since further generic type information will be erased at runtime\n" + 
26018
			"Cannot perform instanceof check against parameterized type List<? extends String>. Use the form List<?> instead since further generic type information will be erased at runtime\n" + 
26052
			"----------\n" + 
26019
			"----------\n" + 
26053
			"7. WARNING in X.java (at line 18)\n" + 
26020
			"6. WARNING in X.java (at line 18)\n" + 
26054
			"	void foo(List[] ls) {\n" + 
26021
			"	void foo(List[] ls) {\n" + 
26055
			"	         ^^^^\n" + 
26022
			"	         ^^^^\n" + 
26056
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
26023
			"List is a raw type. References to generic type List<E> should be parameterized\n" + 
26057
			"----------\n" + 
26024
			"----------\n" + 
26058
			"8. WARNING in X.java (at line 19)\n" + 
26025
			"7. WARNING in X.java (at line 19)\n" + 
26059
			"	if (ls instanceof List<?>[]) {}\n" + 
26026
			"	if (ls instanceof List<?>[]) {}\n" + 
26060
			"	    ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26027
			"	    ^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26061
			"The expression of type List[] is already an instance of type List<?>\n" + 
26028
			"The expression of type List[] is already an instance of type List<?>\n" + 
26062
			"----------\n" + 
26029
			"----------\n" + 
26063
			"9. ERROR in X.java (at line 20)\n" + 
26030
			"8. ERROR in X.java (at line 20)\n" + 
26064
			"	if (ls instanceof List<? extends String>[]) {}\n" + 
26031
			"	if (ls instanceof List<? extends String>[]) {}\n" + 
26065
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26032
			"	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
26066
			"Cannot perform instanceof check against parameterized type List<? extends String>[]. Use the form List<?>[] instead since further generic type information will be erased at runtime\n" + 
26033
			"Cannot perform instanceof check against parameterized type List<? extends String>[]. Use the form List<?>[] instead since further generic type information will be erased at runtime\n" + 
Lines 32552-32578 Link Here
32552
				"}\n", // =================
32519
				"}\n", // =================
32553
			},
32520
			},
32554
			"----------\n" +
32521
			"----------\n" +
32555
			"1. WARNING in X.java (at line 5)\n" +
32522
			"1. ERROR in X.java (at line 20)\n" +
32556
			"	private T aObject = null;\n" +
32557
			"	          ^^^^^^^\n" +
32558
			"The field X<T>.aObject is never read locally\n" +
32559
			"----------\n" +
32560
			"2. ERROR in X.java (at line 20)\n" +
32561
			"	final List<X<?>> l2 = castList(l1, List.class);\n" +
32523
			"	final List<X<?>> l2 = castList(l1, List.class);\n" +
32562
			"	                      ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32524
			"	                      ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
32563
			"Type mismatch: cannot convert from List<List> to List<X<?>>\n" +
32525
			"Type mismatch: cannot convert from List<List> to List<X<?>>\n" +
32564
			"----------\n" +
32526
			"----------\n" +
32565
			"3. WARNING in X.java (at line 22)\n" +
32527
			"2. WARNING in X.java (at line 22)\n" +
32566
			"	List<X> l3 = l2;\n" +
32528
			"	List<X> l3 = l2;\n" +
32567
			"	     ^\n" +
32529
			"	     ^\n" +
32568
			"X is a raw type. References to generic type X<T> should be parameterized\n" +
32530
			"X is a raw type. References to generic type X<T> should be parameterized\n" +
32569
			"----------\n" +
32531
			"----------\n" +
32570
			"4. ERROR in X.java (at line 22)\n" +
32532
			"3. ERROR in X.java (at line 22)\n" +
32571
			"	List<X> l3 = l2;\n" +
32533
			"	List<X> l3 = l2;\n" +
32572
			"	             ^^\n" +
32534
			"	             ^^\n" +
32573
			"Type mismatch: cannot convert from List<X<?>> to List<X>\n" +
32535
			"Type mismatch: cannot convert from List<X<?>> to List<X>\n" +
32574
			"----------\n" +
32536
			"----------\n" +
32575
			"5. ERROR in X.java (at line 24)\n" +
32537
			"4. ERROR in X.java (at line 24)\n" +
32576
			"	l3 = l4;\n" +
32538
			"	l3 = l4;\n" +
32577
			"	     ^^\n" +
32539
			"	     ^^\n" +
32578
			"Type mismatch: cannot convert from List<X<String>> to List<X>\n" +
32540
			"Type mismatch: cannot convert from List<X<String>> to List<X>\n" +
Lines 36767-36796 Link Here
36767
			"	      ^\n" +
36729
			"	      ^\n" +
36768
			"The nested type T is hiding the type parameter T of type Y<T>\n" +
36730
			"The nested type T is hiding the type parameter T of type Y<T>\n" +
36769
			"----------\n" +
36731
			"----------\n" +
36770
			"4. WARNING in X.java (at line 11)\n" +
36732
			"4. WARNING in X.java (at line 12)\n" +
36771
			"	class T {}; // hiding warning\n" +
36772
			"	      ^\n" +
36773
			"The type T is never used locally\n" +
36774
			"----------\n" +
36775
			"5. WARNING in X.java (at line 12)\n" +
36776
			"	class Local {};\n" +
36733
			"	class Local {};\n" +
36777
			"	      ^^^^^\n" +
36734
			"	      ^^^^^\n" +
36778
			"The type Local is hiding the type Y<T>.Local\n" +
36735
			"The type Local is hiding the type Y<T>.Local\n" +
36779
			"----------\n" +
36780
			"6. WARNING in X.java (at line 12)\n" +
36781
			"	class Local {};\n" +
36782
			"	      ^^^^^\n" +
36783
			"The type Local is never used locally\n" +
36784
			"----------\n" +
36785
			"7. WARNING in X.java (at line 15)\n" +
36786
			"	class T {}; // no hiding warning\n" +
36787
			"	      ^\n" +
36788
			"The type T is never used locally\n" +
36789
			"----------\n" +
36790
			"8. WARNING in X.java (at line 16)\n" +
36791
			"	class Local {}; // no hiding warning\n" +
36792
			"	      ^^^^^\n" +
36793
			"The type Local is never used locally\n" +
36794
			"----------\n");
36736
			"----------\n");
36795
}
36737
}
36796
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165679 - variation
36738
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165679 - variation
Lines 38111-38137 Link Here
38111
			"}", // =================
38053
			"}", // =================
38112
		},
38054
		},
38113
		"----------\n" +
38055
		"----------\n" +
38114
		"1. WARNING in X.java (at line 7)\n" +
38056
		"1. WARNING in X.java (at line 13)\n" +
38115
		"	private final T theGenericThing;\n" +
38116
		"	                ^^^^^^^^^^^^^^^\n" +
38117
		"The field X<T>.theGenericThing is never read locally\n" +
38118
		"----------\n" +
38119
		"2. WARNING in X.java (at line 13)\n" +
38120
		"	public static class InnerClassThatShowsBug extends X {\n" +
38057
		"	public static class InnerClassThatShowsBug extends X {\n" +
38121
		"	                                                   ^\n" +
38058
		"	                                                   ^\n" +
38122
		"X is a raw type. References to generic type X<T> should be parameterized\n" +
38059
		"X is a raw type. References to generic type X<T> should be parameterized\n" +
38123
		"----------\n" +
38060
		"----------\n" +
38124
		"3. WARNING in X.java (at line 15)\n" +
38061
		"2. WARNING in X.java (at line 15)\n" +
38125
		"	super(null);\n" +
38062
		"	super(null);\n" +
38126
		"	^^^^^^^^^^^^\n" +
38063
		"	^^^^^^^^^^^^\n" +
38127
		"Type safety: The constructor X(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" +
38064
		"Type safety: The constructor X(Object) belongs to the raw type X. References to generic type X<T> should be parameterized\n" +
38128
		"----------\n" +
38065
		"----------\n" +
38129
		"4. WARNING in X.java (at line 15)\n" +
38066
		"3. WARNING in X.java (at line 15)\n" +
38130
		"	super(null);\n" +
38067
		"	super(null);\n" +
38131
		"	^^^^^^^^^^^^\n" +
38068
		"	^^^^^^^^^^^^\n" +
38132
		"Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method\n" +
38069
		"Access to enclosing constructor X<T>(T) is emulated by a synthetic accessor method\n" +
38133
		"----------\n" +
38070
		"----------\n" +
38134
		"5. ERROR in X.java (at line 19)\n" +
38071
		"4. ERROR in X.java (at line 19)\n" +
38135
		"	for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" +
38072
		"	for (Map.Entry<String, String> entry : myMap().entrySet()) {\n" +
38136
		"	                                       ^^^^^^^^^^^^^^^^^^\n" +
38073
		"	                                       ^^^^^^^^^^^^^^^^^^\n" +
38137
		"Type mismatch: cannot convert from element type Object to Map.Entry<String,String>\n" +
38074
		"Type mismatch: cannot convert from element type Object to Map.Entry<String,String>\n" +
Lines 39571-39612 Link Here
39571
			"}\n", // =================
39508
			"}\n", // =================
39572
		},
39509
		},
39573
		"----------\n" +
39510
		"----------\n" +
39574
		"1. WARNING in X.java (at line 3)\n" +
39511
		"1. WARNING in X.java (at line 5)\n" +
39575
		"	private final Object mDependent = new Object() {\n" +
39576
		"	                     ^^^^^^^^^^\n" +
39577
		"The field X<T>.mDependent is never read locally\n" +
39578
		"----------\n" +
39579
		"2. WARNING in X.java (at line 5)\n" +
39580
		"	Object o1 = mObj;\n" +
39512
		"	Object o1 = mObj;\n" +
39581
		"	            ^^^^\n" +
39513
		"	            ^^^^\n" +
39582
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39514
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39583
		"----------\n" +
39515
		"----------\n" +
39584
		"3. ERROR in X.java (at line 5)\n" +
39516
		"2. ERROR in X.java (at line 5)\n" +
39585
		"	Object o1 = mObj;\n" +
39517
		"	Object o1 = mObj;\n" +
39586
		"	            ^^^^\n" +
39518
		"	            ^^^^\n" +
39587
		"The blank final field mObj may not have been initialized\n" +
39519
		"The blank final field mObj may not have been initialized\n" +
39588
		"----------\n" +
39520
		"----------\n" +
39589
		"4. WARNING in X.java (at line 7)\n" +
39521
		"3. WARNING in X.java (at line 7)\n" +
39590
		"	Object o2 = mObj;\n" +
39591
		"	       ^^\n" +
39592
		"The field new Object(){}.o2 is never read locally\n" +
39593
		"----------\n" +
39594
		"5. WARNING in X.java (at line 7)\n" +
39595
		"	Object o2 = mObj;\n" +
39522
		"	Object o2 = mObj;\n" +
39596
		"	            ^^^^\n" +
39523
		"	            ^^^^\n" +
39597
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39524
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39598
		"----------\n" +
39525
		"----------\n" +
39599
		"6. ERROR in X.java (at line 7)\n" +
39526
		"4. ERROR in X.java (at line 7)\n" +
39600
		"	Object o2 = mObj;\n" +
39527
		"	Object o2 = mObj;\n" +
39601
		"	            ^^^^\n" +
39528
		"	            ^^^^\n" +
39602
		"The blank final field mObj may not have been initialized\n" +
39529
		"The blank final field mObj may not have been initialized\n" +
39603
		"----------\n" +
39530
		"----------\n" +
39604
		"7. WARNING in X.java (at line 8)\n" +
39531
		"5. WARNING in X.java (at line 9)\n" +
39605
		"	void foo() {\n" +
39606
		"	     ^^^^^\n" +
39607
		"The method foo() from the type new Object(){} is never used locally\n" +
39608
		"----------\n" +
39609
		"8. WARNING in X.java (at line 9)\n" +
39610
		"	Object o3 = mObj;\n" +
39532
		"	Object o3 = mObj;\n" +
39611
		"	            ^^^^\n" +
39533
		"	            ^^^^\n" +
39612
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39534
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
Lines 39636-39697 Link Here
39636
			"}\n"
39558
			"}\n"
39637
		},
39559
		},
39638
		"----------\n" +
39560
		"----------\n" +
39639
		"1. WARNING in X.java (at line 3)\n" +
39561
		"1. WARNING in X.java (at line 5)\n" +
39640
		"	private final Object mDependent = new Object() {\n" +
39641
		"	                     ^^^^^^^^^^\n" +
39642
		"The field X<T>.mDependent is never read locally\n" +
39643
		"----------\n" +
39644
		"2. WARNING in X.java (at line 5)\n" +
39645
		"	Object o1 = mObj;\n" +
39562
		"	Object o1 = mObj;\n" +
39646
		"	            ^^^^\n" +
39563
		"	            ^^^^\n" +
39647
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39564
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39648
		"----------\n" +
39565
		"----------\n" +
39649
		"3. ERROR in X.java (at line 5)\n" +
39566
		"2. ERROR in X.java (at line 5)\n" +
39650
		"	Object o1 = mObj;\n" +
39567
		"	Object o1 = mObj;\n" +
39651
		"	            ^^^^\n" +
39568
		"	            ^^^^\n" +
39652
		"The blank final field mObj may not have been initialized\n" +
39569
		"The blank final field mObj may not have been initialized\n" +
39653
		"----------\n" +
39570
		"----------\n" +
39654
		"4. WARNING in X.java (at line 6)\n" +
39571
		"3. WARNING in X.java (at line 6)\n" +
39655
		"	mObj = \"1\";\n" +
39572
		"	mObj = \"1\";\n" +
39656
		"	^^^^\n" +
39573
		"	^^^^\n" +
39657
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39574
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39658
		"----------\n" +
39575
		"----------\n" +
39659
		"5. ERROR in X.java (at line 6)\n" +
39576
		"4. ERROR in X.java (at line 6)\n" +
39660
		"	mObj = \"1\";\n" +
39577
		"	mObj = \"1\";\n" +
39661
		"	^^^^\n" +
39578
		"	^^^^\n" +
39662
		"The final field X<T>.mObj cannot be assigned\n" +
39579
		"The final field X<T>.mObj cannot be assigned\n" +
39663
		"----------\n" +
39580
		"----------\n" +
39664
		"6. WARNING in X.java (at line 8)\n" +
39581
		"5. WARNING in X.java (at line 8)\n" +
39665
		"	Object o2 = mObj = \"2\";\n" +
39666
		"	       ^^\n" +
39667
		"The field new Object(){}.o2 is never read locally\n" +
39668
		"----------\n" +
39669
		"7. WARNING in X.java (at line 8)\n" +
39670
		"	Object o2 = mObj = \"2\";\n" +
39582
		"	Object o2 = mObj = \"2\";\n" +
39671
		"	            ^^^^\n" +
39583
		"	            ^^^^\n" +
39672
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39584
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39673
		"----------\n" +
39585
		"----------\n" +
39674
		"8. ERROR in X.java (at line 8)\n" +
39586
		"6. ERROR in X.java (at line 8)\n" +
39675
		"	Object o2 = mObj = \"2\";\n" +
39587
		"	Object o2 = mObj = \"2\";\n" +
39676
		"	            ^^^^\n" +
39588
		"	            ^^^^\n" +
39677
		"The final field X<T>.mObj cannot be assigned\n" +
39589
		"The final field X<T>.mObj cannot be assigned\n" +
39678
		"----------\n" +
39590
		"----------\n" +
39679
		"9. WARNING in X.java (at line 9)\n" +
39591
		"7. WARNING in X.java (at line 10)\n" +
39680
		"	void foo() {\n" +
39681
		"	     ^^^^^\n" +
39682
		"The method foo() from the type new Object(){} is never used locally\n" +
39683
		"----------\n" +
39684
		"10. WARNING in X.java (at line 10)\n" +
39685
		"	Object o3 = mObj;\n" +
39592
		"	Object o3 = mObj;\n" +
39686
		"	            ^^^^\n" +
39593
		"	            ^^^^\n" +
39687
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39594
		"Read access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39688
		"----------\n" +
39595
		"----------\n" +
39689
		"11. WARNING in X.java (at line 11)\n" +
39596
		"8. WARNING in X.java (at line 11)\n" +
39690
		"	mObj = \"3\";\n" +
39597
		"	mObj = \"3\";\n" +
39691
		"	^^^^\n" +
39598
		"	^^^^\n" +
39692
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39599
		"Write access to enclosing field X<T>.mObj is emulated by a synthetic accessor method\n" +
39693
		"----------\n" +
39600
		"----------\n" +
39694
		"12. ERROR in X.java (at line 11)\n" +
39601
		"9. ERROR in X.java (at line 11)\n" +
39695
		"	mObj = \"3\";\n" +
39602
		"	mObj = \"3\";\n" +
39696
		"	^^^^\n" +
39603
		"	^^^^\n" +
39697
		"The final field X<T>.mObj cannot be assigned\n" +
39604
		"The final field X<T>.mObj cannot be assigned\n" +
Lines 41031-41037 Link Here
41031
	String[] sources =
40938
	String[] sources =
41032
		new String[] {
40939
		new String[] {
41033
			"X.java",
40940
			"X.java",
41034
			"class X extends Y {\n" +
40941
			"public class X extends Y {\n" +
41035
			"	public static void main(String[] args) {\n" +
40942
			"	public static void main(String[] args) {\n" +
41036
			"		String s = \"\";\n" +
40943
			"		String s = \"\";\n" +
41037
			"		new X().<String> a(s);\n" + // fails before 7
40944
			"		new X().<String> a(s);\n" + // fails before 7
Lines 41113-41119 Link Here
41113
	String[] sources =
41020
	String[] sources =
41114
		new String[] {
41021
		new String[] {
41115
			"X.java",
41022
			"X.java",
41116
			"class X implements I {\n" +
41023
			"public class X implements I {\n" +
41117
			"	public static void main(String[] args) {\n" +
41024
			"	public static void main(String[] args) {\n" +
41118
			"		String s = \"\";\n" +
41025
			"		String s = \"\";\n" +
41119
			"		new X().<String> a(s);\n" + // fails before 7
41026
			"		new X().<String> a(s);\n" + // fails before 7
Lines 41580-41591 Link Here
41580
		"The type A.P is not visible\n" +
41487
		"The type A.P is not visible\n" +
41581
		"----------\n" +
41488
		"----------\n" +
41582
		"----------\n" +
41489
		"----------\n" +
41583
		"1. WARNING in p\\A.java (at line 9)\n" +
41490
		"1. WARNING in p\\A.java (at line 18)\n" +
41584
		"	public int pval;\n" +
41585
		"	           ^^^^\n" +
41586
		"The field A.P.pval is never read locally\n" +
41587
		"----------\n" +
41588
		"2. WARNING in p\\A.java (at line 18)\n" +
41589
		"	this.box.set(new P());\n" +
41491
		"	this.box.set(new P());\n" +
41590
		"	             ^^^^^^^\n" +
41492
		"	             ^^^^^^^\n" +
41591
		"Access to enclosing constructor A.P() is emulated by a synthetic accessor method\n" +
41493
		"Access to enclosing constructor A.P() is emulated by a synthetic accessor method\n" +
Lines 42618-42628 Link Here
42618
		"	public class X<T extends Secondary.Private> {\n" +
42520
		"	public class X<T extends Secondary.Private> {\n" +
42619
		"	                         ^^^^^^^^^^^^^^^^^\n" +
42521
		"	                         ^^^^^^^^^^^^^^^^^\n" +
42620
		"The type Secondary.Private is not visible\n" +
42522
		"The type Secondary.Private is not visible\n" +
42621
		"----------\n" +
42622
		"2. WARNING in X.java (at line 4)\n" + 
42623
		"	static private class Private {}\n" + 
42624
		"	                     ^^^^^^^\n" + 
42625
		"The type Secondary.Private is never used locally\n" + 
42626
		"----------\n");
42523
		"----------\n");
42627
}
42524
}
42628
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation
42525
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=216100 - variation
Lines 46336-46342 Link Here
46336
			"done");
46233
			"done");
46337
}
46234
}
46338
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422
46235
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422
46339
public void _test1357() {
46236
public void test1357() {
46340
	this.runNegativeTest(
46237
	this.runNegativeTest(
46341
			new String[] {
46238
			new String[] {
46342
				"X.java", // =================
46239
				"X.java", // =================
Lines 46358-46367 Link Here
46358
				"	private static interface SecondaryPrivate {}\n" + 
46255
				"	private static interface SecondaryPrivate {}\n" + 
46359
				"}\n", // =================
46256
				"}\n", // =================
46360
			},
46257
			},
46361
			"done");
46258
			"----------\n" + 
46259
			"1. ERROR in X.java (at line 8)\n" + 
46260
			"	public abstract class X implements Map<X.Private,Secondary.SecondaryPrivate> {\n" + 
46261
			"	                                       ^^^^^^^^^\n" + 
46262
			"The type X.Private is not visible\n" + 
46263
			"----------\n" + 
46264
			"2. ERROR in X.java (at line 8)\n" + 
46265
			"	public abstract class X implements Map<X.Private,Secondary.SecondaryPrivate> {\n" + 
46266
			"	                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
46267
			"The type Secondary.SecondaryPrivate is not visible\n" + 
46268
			"----------\n");
46362
}
46269
}
46363
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation
46270
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation
46364
public void _test1358() {
46271
public void test1358() {
46365
	this.runNegativeTest(
46272
	this.runNegativeTest(
46366
			new String[] {
46273
			new String[] {
46367
				"X.java", // =================
46274
				"X.java", // =================
Lines 46376-46382 Link Here
46376
				"	Inter.Private field;\n" + 
46283
				"	Inter.Private field;\n" + 
46377
				"}\n", // =================
46284
				"}\n", // =================
46378
			},
46285
			},
46379
			"done");
46286
			"----------\n" + 
46287
			"1. ERROR in X.java (at line 2)\n" + 
46288
			"	public abstract class X implements List<X.Inter.Private> {\n" + 
46289
			"	                                        ^^^^^^^^^^^^^^^\n" + 
46290
			"The type X.Inter.Private is not visible\n" + 
46291
			"----------\n");
46380
}
46292
}
46381
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation
46293
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=185422 - variation
46382
public void test1359() {
46294
public void test1359() {
Lines 50500-50511 Link Here
50500
			"interface IReferencedInterface extends IRecursiveInterface<IReferencedInterface> {}\n"
50412
			"interface IReferencedInterface extends IRecursiveInterface<IReferencedInterface> {}\n"
50501
		},
50413
		},
50502
		"----------\n" + 
50414
		"----------\n" + 
50503
		"1. WARNING in AnotherClass.java (at line 3)\n" + 
50415
		"1. ERROR in AnotherClass.java (at line 5)\n" + 
50504
		"	private AnotherClass<IReferencedInterface> m_var;\n" + 
50505
		"	                                           ^^^^^\n" + 
50506
		"The field ImplementingClass.m_var is never read locally\n" + 
50507
		"----------\n" + 
50508
		"2. ERROR in AnotherClass.java (at line 5)\n" + 
50509
		"	m_var = a;\n" + 
50416
		"	m_var = a;\n" + 
50510
		"	        ^\n" + 
50417
		"	        ^\n" + 
50511
		"Type mismatch: cannot convert from AnotherClass<capture#1-of ? extends IReferencedInterface> to AnotherClass<IReferencedInterface>\n" + 
50418
		"Type mismatch: cannot convert from AnotherClass<capture#1-of ? extends IReferencedInterface> to AnotherClass<IReferencedInterface>\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (-272 / +46 lines)
Lines 11-16 Link Here
11
package org.eclipse.jdt.core.tests.compiler.regression;
11
package org.eclipse.jdt.core.tests.compiler.regression;
12
12
13
import java.io.File;
13
import java.io.File;
14
import java.util.Map;
14
15
15
import junit.framework.Test;
16
import junit.framework.Test;
16
17
Lines 31-36 Link Here
31
public InnerEmulationTest(String name) {
32
public InnerEmulationTest(String name) {
32
	super(name);
33
	super(name);
33
}
34
}
35
protected Map getCompilerOptions() {
36
	Map options = super.getCompilerOptions();
37
	options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
38
	options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.IGNORE);
39
	options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.IGNORE);
40
	options.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE);
41
	return options;
42
}
34
public static Test suite() {
43
public static Test suite() {
35
	return buildAllCompliancesTestSuite(testClass());
44
	return buildAllCompliancesTestSuite(testClass());
36
}
45
}
Lines 1460-1478 Link Here
1460
		"1. WARNING in p1\\A2.java (at line 18)\n" +
1469
		"1. WARNING in p1\\A2.java (at line 18)\n" +
1461
		"	private class C extends B {	\n" +
1470
		"	private class C extends B {	\n" +
1462
		"	              ^\n" +
1471
		"	              ^\n" +
1463
		"The type A2.C is never used locally\n" +
1464
		"----------\n" +
1465
		"2. WARNING in p1\\A2.java (at line 18)\n" +
1466
		"	private class C extends B {	\n" +
1467
		"	              ^\n" +
1468
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" +
1472
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" +
1469
		"----------\n" +
1473
		"----------\n" +
1470
		"3. WARNING in p1\\A2.java (at line 19)\n" +
1474
		"2. ERROR in p1\\A2.java (at line 20)\n" +
1471
		"	public void foo() {	\n" +
1472
		"	            ^^^^^\n" +
1473
		"The method foo() from the type A2.C is never used locally\n" +
1474
		"----------\n" +
1475
		"4. ERROR in p1\\A2.java (at line 20)\n" +
1476
		"	(new D.E(null, null, null, new F(get()) {}) {}).execute();	\n" +
1475
		"	(new D.E(null, null, null, new F(get()) {}) {}).execute();	\n" +
1477
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
1476
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
1478
		"No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" +
1477
		"No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" +
Lines 1553-1571 Link Here
1553
		"1. WARNING in p1\\A2.java (at line 18)\n" +
1552
		"1. WARNING in p1\\A2.java (at line 18)\n" +
1554
		"	private class C extends B {	\n" +
1553
		"	private class C extends B {	\n" +
1555
		"	              ^\n" +
1554
		"	              ^\n" +
1556
		"The type A2.C is never used locally\n" +
1557
		"----------\n" +
1558
		"2. WARNING in p1\\A2.java (at line 18)\n" +
1559
		"	private class C extends B {	\n" +
1560
		"	              ^\n" +
1561
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" +
1555
		"Access to enclosing constructor A2.B() is emulated by a synthetic accessor method\n" +
1562
		"----------\n" +
1556
		"----------\n" +
1563
		"3. WARNING in p1\\A2.java (at line 19)\n" +
1557
		"2. ERROR in p1\\A2.java (at line 20)\n" +
1564
		"	public void foo() {	\n" +
1565
		"	            ^^^^^\n" +
1566
		"The method foo() from the type A2.C is never used locally\n" +
1567
		"----------\n" +
1568
		"4. ERROR in p1\\A2.java (at line 20)\n" +
1569
		"	(new D.E(null, null, null, new F(get()) {})).execute();	\n" +
1558
		"	(new D.E(null, null, null, new F(get()) {})).execute();	\n" +
1570
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
1559
		"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
1571
		"No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" +
1560
		"No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" +
Lines 2990-3007 Link Here
2990
				"} 	\n"
2979
				"} 	\n"
2991
			},
2980
			},
2992
			"----------\n" +
2981
			"----------\n" +
2993
			"1. WARNING in X.java (at line 7)\n" +
2982
			"1. ERROR in X.java (at line 9)\n" +
2994
			"	class B extends X {	\n" +
2995
			"	      ^\n" +
2996
			"The type B is never used locally\n" +
2997
			"----------\n" +
2998
			"2. ERROR in X.java (at line 9)\n" +
2999
			"	super(new A(){	\n" +
2983
			"	super(new A(){	\n" +
3000
			"				});	\n" +
2984
			"				});	\n" +
3001
			"	      ^^^^^^^^^^^^^^^\n" +
2985
			"	      ^^^^^^^^^^^^^^^\n" +
3002
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
2986
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3003
			"----------\n" +
2987
			"----------\n" +
3004
			"3. WARNING in X.java (at line 9)\n" +
2988
			"2. WARNING in X.java (at line 9)\n" +
3005
			"	super(new A(){	\n" +
2989
			"	super(new A(){	\n" +
3006
			"	          ^^^\n" +
2990
			"	          ^^^\n" +
3007
			"Access to enclosing constructor A() is emulated by a synthetic accessor method\n" +
2991
			"Access to enclosing constructor A() is emulated by a synthetic accessor method\n" +
Lines 3028-3039 Link Here
3028
				"} 	\n"
3012
				"} 	\n"
3029
			},
3013
			},
3030
			"----------\n" +
3014
			"----------\n" +
3031
			"1. WARNING in X.java (at line 7)\n" +
3015
			"1. ERROR in X.java (at line 9)\n" +
3032
			"	class B extends X {	\n" +
3033
			"	      ^\n" +
3034
			"The type B is never used locally\n" +
3035
			"----------\n" +
3036
			"2. ERROR in X.java (at line 9)\n" +
3037
			"	super(new A(){	\n" +
3016
			"	super(new A(){	\n" +
3038
			"				});	\n" +
3017
			"				});	\n" +
3039
			"	      ^^^^^^^^^^^^^^^\n" +
3018
			"	      ^^^^^^^^^^^^^^^\n" +
Lines 3120-3148 Link Here
3120
				"} 	\n"
3099
				"} 	\n"
3121
			},
3100
			},
3122
			"----------\n" +
3101
			"----------\n" +
3123
			"1. WARNING in X.java (at line 7)\n" +
3102
			"1. ERROR in X.java (at line 9)\n" +
3124
			"	class B extends X {	\n" +
3125
			"	      ^\n" +
3126
			"The type B is never used locally\n" +
3127
			"----------\n" +
3128
			"2. ERROR in X.java (at line 9)\n" +
3129
			"	super(new A(){	\n" +
3103
			"	super(new A(){	\n" +
3130
			"					void foo() { System.out.println(X.this);	} \n" +
3104
			"					void foo() { System.out.println(X.this);	} \n" +
3131
			"				});	\n" +
3105
			"				});	\n" +
3132
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
3106
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
3133
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3107
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3134
			"----------\n" +
3108
			"----------\n" +
3135
			"3. WARNING in X.java (at line 9)\n" +
3109
			"2. WARNING in X.java (at line 9)\n" +
3136
			"	super(new A(){	\n" +
3110
			"	super(new A(){	\n" +
3137
			"	          ^^^\n" +
3111
			"	          ^^^\n" +
3138
			"Access to enclosing constructor A() is emulated by a synthetic accessor method\n" +
3112
			"Access to enclosing constructor A() is emulated by a synthetic accessor method\n" +
3139
			"----------\n" +
3113
			"----------\n" +
3140
			"4. WARNING in X.java (at line 10)\n" +
3114
			"3. ERROR in X.java (at line 10)\n" +
3141
			"	void foo() { System.out.println(X.this);	} \n" +
3142
			"	     ^^^^^\n" +
3143
			"The method foo() from the type new A(){} is never used locally\n" +
3144
			"----------\n" +
3145
			"5. ERROR in X.java (at line 10)\n" +
3146
			"	void foo() { System.out.println(X.this);	} \n" +
3115
			"	void foo() { System.out.println(X.this);	} \n" +
3147
			"	                                ^^^^^^\n" +
3116
			"	                                ^^^^^^\n" +
3148
			"No enclosing instance of the type X is accessible in scope\n" +
3117
			"No enclosing instance of the type X is accessible in scope\n" +
Lines 3170-3193 Link Here
3170
				"} 	\n"
3139
				"} 	\n"
3171
			},
3140
			},
3172
			"----------\n" +
3141
			"----------\n" +
3173
			"1. WARNING in X.java (at line 7)\n" +
3142
			"1. ERROR in X.java (at line 9)\n" +
3174
			"	class B extends X {	\n" +
3175
			"	      ^\n" +
3176
			"The type B is never used locally\n" +
3177
			"----------\n" +
3178
			"2. ERROR in X.java (at line 9)\n" +
3179
			"	super(new A(){	\n" +
3143
			"	super(new A(){	\n" +
3180
			"					void foo() { System.out.println(X.this);	} \n" +
3144
			"					void foo() { System.out.println(X.this);	} \n" +
3181
			"				});	\n" +
3145
			"				});	\n" +
3182
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
3146
			"	      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
3183
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3147
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3184
			"----------\n" +
3148
			"----------\n" +
3185
			"3. WARNING in X.java (at line 10)\n" +
3149
			"2. ERROR in X.java (at line 10)\n" +
3186
			"	void foo() { System.out.println(X.this);	} \n" +
3187
			"	     ^^^^^\n" +
3188
			"The method foo() from the type new A(){} is never used locally\n" +
3189
			"----------\n" +
3190
			"4. ERROR in X.java (at line 10)\n" +
3191
			"	void foo() { System.out.println(X.this);	} \n" +
3150
			"	void foo() { System.out.println(X.this);	} \n" +
3192
			"	                                ^^^^^^\n" +
3151
			"	                                ^^^^^^\n" +
3193
			"No enclosing instance of the type X is accessible in scope\n" +
3152
			"No enclosing instance of the type X is accessible in scope\n" +
Lines 3385-3396 Link Here
3385
				"}	\n"
3344
				"}	\n"
3386
			},
3345
			},
3387
		"----------\n" +
3346
		"----------\n" +
3388
		"1. WARNING in X.java (at line 10)\n" +
3347
		"1. ERROR in X.java (at line 10)\n" +
3389
		"	X x = X.this; 	\n" +
3390
		"	  ^\n" +
3391
		"The field new B(){}.x is never read locally\n" +
3392
		"----------\n" +
3393
		"2. ERROR in X.java (at line 10)\n" +
3394
		"	X x = X.this; 	\n" +
3348
		"	X x = X.this; 	\n" +
3395
		"	      ^^^^^^\n" +
3349
		"	      ^^^^^^\n" +
3396
		"No enclosing instance of the type X is accessible in scope\n" +
3350
		"No enclosing instance of the type X is accessible in scope\n" +
Lines 3938-3949 Link Here
3938
			"} ",
3892
			"} ",
3939
		},
3893
		},
3940
		"----------\n" +
3894
		"----------\n" +
3941
		"1. WARNING in X.java (at line 9)\n" +
3895
		"1. ERROR in X.java (at line 11)\n" +
3942
		"	private static class B extends X.Y implements X.Z { \n" +
3943
		"	                     ^\n" +
3944
		"The type A.B is never used locally\n" +
3945
		"----------\n" +
3946
		"2. ERROR in X.java (at line 11)\n" +
3947
		"	super(B.this); \n" +
3896
		"	super(B.this); \n" +
3948
		"	      ^^^^^^\n" +
3897
		"	      ^^^^^^\n" +
3949
		"Cannot refer to \'this\' nor \'super\' while explicitly invoking a constructor\n" +
3898
		"Cannot refer to \'this\' nor \'super\' while explicitly invoking a constructor\n" +
Lines 3967-3978 Link Here
3967
				"}",
3916
				"}",
3968
			},
3917
			},
3969
			"----------\n" +
3918
			"----------\n" +
3970
			"1. WARNING in X.java (at line 5)\n" +
3919
			"1. ERROR in X.java (at line 5)\n" +
3971
			"	class Local2 extends Local1 {\n" +
3972
			"	      ^^^^^^\n" +
3973
			"The type Local2 is never used locally\n" +
3974
			"----------\n" +
3975
			"2. ERROR in X.java (at line 5)\n" +
3976
			"	class Local2 extends Local1 {\n" +
3920
			"	class Local2 extends Local1 {\n" +
3977
			"	      ^^^^^^\n" +
3921
			"	      ^^^^^^\n" +
3978
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3922
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
Lines 4020-4041 Link Here
4020
				"}"
3964
				"}"
4021
			},
3965
			},
4022
			"----------\n" +
3966
			"----------\n" +
4023
			"1. WARNING in X.java (at line 4)\n" +
3967
			"1. ERROR in X.java (at line 13)\n" +
4024
			"	public void foo() {\n" +
4025
			"	            ^^^^^\n" +
4026
			"The method foo() from the type C is never used locally\n" +
4027
			"----------\n" +
4028
			"2. WARNING in X.java (at line 9)\n" +
4029
			"	public void foo() {\n" +
4030
			"	            ^^^^^\n" +
4031
			"The method foo() from the type new X(){} is never used locally\n" +
4032
			"----------\n" +
4033
			"3. WARNING in X.java (at line 13)\n" +
4034
			"	class D extends C {\n" +
4035
			"	      ^\n" +
4036
			"The type D is never used locally\n" +
4037
			"----------\n" +
4038
			"4. ERROR in X.java (at line 13)\n" +
4039
			"	class D extends C {\n" +
3968
			"	class D extends C {\n" +
4040
			"	      ^\n" +
3969
			"	      ^\n" +
4041
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
3970
			"No enclosing instance of type X is available due to some intermediate constructor invocation\n" +
Lines 4319-4329 Link Here
4319
		"	bar();\n" +
4248
		"	bar();\n" +
4320
		"	^^^\n" +
4249
		"	^^^\n" +
4321
		"Cannot refer to an instance method while explicitly invoking a constructor\n" +
4250
		"Cannot refer to an instance method while explicitly invoking a constructor\n" +
4322
		"----------\n" +
4323
		"2. WARNING in X.java (at line 22)\n" +
4324
		"	void baz() {\n" +
4325
		"	     ^^^^^\n" +
4326
		"The method baz() from the type new Object(){} is never used locally\n" +
4327
		"----------\n");
4251
		"----------\n");
4328
}
4252
}
4329
public void test119() {
4253
public void test119() {
Lines 4380-4400 Link Here
4380
			"	foo(\"0\");\n" +
4304
			"	foo(\"0\");\n" +
4381
			"	^^^^^^^^\n" +
4305
			"	^^^^^^^^\n" +
4382
			"No enclosing instance of the type X is accessible in scope\n" +
4306
			"No enclosing instance of the type X is accessible in scope\n" +
4383
			"----------\n" +
4384
			"2. WARNING in X.java (at line 13)\n" +
4385
			"	void baz() {\n" +
4386
			"	     ^^^^^\n" +
4387
			"The method baz() from the type new Object(){} is never used locally\n" +
4388
			"----------\n" +
4389
			"3. WARNING in X.java (at line 18)\n" +
4390
			"	void baz() {\n" +
4391
			"	     ^^^^^\n" +
4392
			"The method baz() from the type Local is never used locally\n" +
4393
			"----------\n" +
4394
			"4. WARNING in X.java (at line 35)\n" +
4395
			"	void baz() {\n" +
4396
			"	     ^^^^^\n" +
4397
			"The method baz() from the type new Object(){} is never used locally\n" +
4398
			"----------\n");
4307
			"----------\n");
4399
		return;
4308
		return;
4400
	}
4309
	}
Lines 4493-4537 Link Here
4493
				"}\n",
4402
				"}\n",
4494
			},
4403
			},
4495
		"----------\n" +
4404
		"----------\n" +
4496
		"1. WARNING in X.java (at line 7)\n" +
4405
		"1. ERROR in X.java (at line 10)\n" +
4497
		"	void baz() {\n" +
4498
		"	     ^^^^^\n" +
4499
		"The method baz() from the type new Object(){} is never used locally\n" +
4500
		"----------\n" +
4501
		"2. WARNING in X.java (at line 9)\n" +
4502
		"	void baz() {\n" +
4503
		"	     ^^^^^\n" +
4504
		"The method baz() from the type new Object(){} is never used locally\n" +
4505
		"----------\n" +
4506
		"3. ERROR in X.java (at line 10)\n" +
4507
		"	foo(); //0\n" +
4406
		"	foo(); //0\n" +
4508
		"	^^^^^\n" +
4407
		"	^^^^^\n" +
4509
		"No enclosing instance of the type X is accessible in scope\n" +
4408
		"No enclosing instance of the type X is accessible in scope\n" +
4510
		"----------\n" +
4409
		"----------\n" +
4511
		"4. WARNING in X.java (at line 14)\n" +
4410
		"2. ERROR in X.java (at line 15)\n" +
4512
		"	void baz() {\n" +
4513
		"	     ^^^^^\n" +
4514
		"The method baz() from the type Local is never used locally\n" +
4515
		"----------\n" +
4516
		"5. ERROR in X.java (at line 15)\n" +
4517
		"	foo(); //1\n" +
4411
		"	foo(); //1\n" +
4518
		"	^^^^^\n" +
4412
		"	^^^^^\n" +
4519
		"No enclosing instance of the type X is accessible in scope\n" +
4413
		"No enclosing instance of the type X is accessible in scope\n" +
4520
		"----------\n" +
4414
		"----------\n" +
4521
		"6. ERROR in X.java (at line 19)\n" +
4415
		"3. ERROR in X.java (at line 19)\n" +
4522
		"	foo();//2\n" +
4416
		"	foo();//2\n" +
4523
		"	^^^^^\n" +
4417
		"	^^^^^\n" +
4524
		"No enclosing instance of the type X is accessible in scope\n" +
4418
		"No enclosing instance of the type X is accessible in scope\n" +
4525
		"----------\n" +
4526
		"7. WARNING in X.java (at line 23)\n" +
4527
		"	void baz() {\n" +
4528
		"	     ^^^^^\n" +
4529
		"The method baz() from the type new Object(){} is never used locally\n" +
4530
		"----------\n" +
4531
		"8. WARNING in X.java (at line 32)\n" +
4532
		"	void baz() {\n" +
4533
		"	     ^^^^^\n" +
4534
		"The method baz() from the type new Object(){} is never used locally\n" +
4535
		"----------\n");
4419
		"----------\n");
4536
		return;
4420
		return;
4537
	}
4421
	}
Lines 4574-4603 Link Here
4574
			"}\n",
4458
			"}\n",
4575
		},
4459
		},
4576
		"----------\n" +
4460
		"----------\n" +
4577
		"1. WARNING in X.java (at line 7)\n" +
4461
		"1. ERROR in X.java (at line 10)\n" +
4578
		"	void baz() {\n" +
4579
		"	     ^^^^^\n" +
4580
		"The method baz() from the type new Object(){} is never used locally\n" +
4581
		"----------\n" +
4582
		"2. WARNING in X.java (at line 9)\n" +
4583
		"	void baz() {\n" +
4584
		"	     ^^^^^\n" +
4585
		"The method baz() from the type Local is never used locally\n" +
4586
		"----------\n" +
4587
		"3. ERROR in X.java (at line 10)\n" +
4588
		"	foo(); //1\n" +
4462
		"	foo(); //1\n" +
4589
		"	^^^^^\n" +
4463
		"	^^^^^\n" +
4590
		"No enclosing instance of the type X is accessible in scope\n" +
4464
		"No enclosing instance of the type X is accessible in scope\n" +
4591
		"----------\n" +
4592
		"4. WARNING in X.java (at line 18)\n" +
4593
		"	void baz() {\n" +
4594
		"	     ^^^^^\n" +
4595
		"The method baz() from the type new Object(){} is never used locally\n" +
4596
		"----------\n" +
4597
		"5. WARNING in X.java (at line 27)\n" +
4598
		"	void baz() {\n" +
4599
		"	     ^^^^^\n" +
4600
		"The method baz() from the type new Object(){} is never used locally\n" +
4601
		"----------\n");
4465
		"----------\n");
4602
}
4466
}
4603
public void test121() {
4467
public void test121() {
Lines 5338-5367 Link Here
5338
			"}", // =================
5202
			"}", // =================
5339
		},
5203
		},
5340
		"----------\n" +
5204
		"----------\n" +
5341
		"1. WARNING in X.java (at line 3)\n" +
5205
		"1. WARNING in X.java (at line 6)\n" +
5342
		"	class Local {}\n" +
5343
		"	      ^^^^^\n" +
5344
		"The type Local is never used locally\n" +
5345
		"----------\n" +
5346
		"2. WARNING in X.java (at line 4)\n" +
5347
		"	class Foo {\n" +
5348
		"	      ^^^\n" +
5349
		"The type Foo is never used locally\n" +
5350
		"----------\n" +
5351
		"3. WARNING in X.java (at line 5)\n" +
5352
		"	void foo() {\n" +
5353
		"	     ^^^^^\n" +
5354
		"The method foo() from the type Foo is never used locally\n" +
5355
		"----------\n" +
5356
		"4. WARNING in X.java (at line 6)\n" +
5357
		"	class Local {}\n" +
5206
		"	class Local {}\n" +
5358
		"	      ^^^^^\n" +
5207
		"	      ^^^^^\n" +
5359
		"The type Local is hiding the type Local\n" +
5208
		"The type Local is hiding the type Local\n" +
5360
		"----------\n" +
5361
		"5. WARNING in X.java (at line 6)\n" +
5362
		"	class Local {}\n" +
5363
		"	      ^^^^^\n" +
5364
		"The type Local is never used locally\n" +
5365
		"----------\n",
5209
		"----------\n",
5366
		"",
5210
		"",
5367
		"",
5211
		"",
Lines 5568-5579 Link Here
5568
			"}", // =================,
5412
			"}", // =================,
5569
		},
5413
		},
5570
		"----------\n" +
5414
		"----------\n" +
5571
		"1. WARNING in p\\X.java (at line 5)\n" +
5415
		"1. ERROR in p\\X.java (at line 11)\n" +
5572
		"	String variable = \"my testing\";\n" +
5573
		"	       ^^^^^^^^\n" +
5574
		"The field X.Outer.Inner.variable is never read locally\n" + 
5575
		"----------\n" +
5576
		"2. ERROR in p\\X.java (at line 11)\n" +
5577
		"	Zork z;\n" +
5416
		"	Zork z;\n" +
5578
		"	^^^^\n" +
5417
		"	^^^^\n" +
5579
		"Zork cannot be resolved to a type\n" +
5418
		"Zork cannot be resolved to a type\n" +
Lines 5627-5638 Link Here
5627
			"}", // =================,
5466
			"}", // =================,
5628
		},
5467
		},
5629
		"----------\n" +
5468
		"----------\n" +
5630
		"1. WARNING in p\\X.java (at line 4)\n" + 
5469
		"1. ERROR in p\\X.java (at line 12)\n" +
5631
		"	String variable = \"my testing\";\n" +
5632
		"	       ^^^^^^^^\n" + 
5633
		"The field X.Outer.Inner.variable is never read locally\n" + 
5634
		"----------\n" +
5635
		"2. ERROR in p\\X.java (at line 12)\n" +
5636
		"	Zork z;\n" +
5470
		"	Zork z;\n" +
5637
		"	^^^^\n" +
5471
		"	^^^^\n" +
5638
		"Zork cannot be resolved to a type\n" +
5472
		"Zork cannot be resolved to a type\n" +
Lines 6077-6118 Link Here
6077
					"}", // =================
5911
					"}", // =================
6078
				},
5912
				},
6079
				"----------\n" +
5913
				"----------\n" +
6080
				"1. WARNING in X.java (at line 6)\n" +
5914
				"1. ERROR in X.java (at line 15)\n" +
6081
				"	private static class B2F extends X { }\n" +
6082
				"	                     ^^^\n" +
6083
				"The type X.B2F is never used locally\n" +
6084
				"----------\n" +
6085
				"2. WARNING in X.java (at line 7)\n" +
6086
				"	private static class F2B extends X { }\n" +
6087
				"	                     ^^^\n" +
6088
				"The type X.F2B is never used locally\n" +
6089
				"----------\n" +
6090
				"3. WARNING in X.java (at line 13)\n" +
6091
				"	private static class B2F extends Key {\n" +
6092
				"	                     ^^^\n" +
6093
				"The type X.Key.B2F is never used locally\n" +
6094
				"----------\n" +
6095
				"4. WARNING in X.java (at line 14)\n" +
6096
				"	private static B2F create() { return new B2F(); }\n" +
6097
				"	                   ^^^^^^^^\n" +
6098
				"The method create() from the type X.Key.B2F is never used locally\n" +
6099
				"----------\n" +
6100
				"5. ERROR in X.java (at line 15)\n" +
6101
				"	public Key flip() { return F2B.create(); }\n" +
5915
				"	public Key flip() { return F2B.create(); }\n" +
6102
				"	                           ^^^\n" +
5916
				"	                           ^^^\n" +
6103
				"The type F2B is defined in an inherited type and an enclosing scope\n" +
5917
				"The type F2B is defined in an inherited type and an enclosing scope\n" +
6104
				"----------\n" +
5918
				"----------\n" +
6105
				"6. WARNING in X.java (at line 18)\n" +
5919
				"2. ERROR in X.java (at line 20)\n" +
6106
				"	private static class F2B extends Key {\n" +
6107
				"	                     ^^^\n" +
6108
				"The type X.Key.F2B is never used locally\n" +
6109
				"----------\n" +
6110
				"7. WARNING in X.java (at line 19)\n" +
6111
				"	private static F2B create() { return new F2B(); }\n" +
6112
				"	                   ^^^^^^^^\n" +
6113
				"The method create() from the type X.Key.F2B is never used locally\n" +
6114
				"----------\n" +
6115
				"8. ERROR in X.java (at line 20)\n" +
6116
				"	public Key flip() { return B2F.create(); }\n" +
5920
				"	public Key flip() { return B2F.create(); }\n" +
6117
				"	                           ^^^\n" +
5921
				"	                           ^^^\n" +
6118
				"The type B2F is defined in an inherited type and an enclosing scope\n" +
5922
				"The type B2F is defined in an inherited type and an enclosing scope\n" +
Lines 6211-6232 Link Here
6211
					"}", // =================
6015
					"}", // =================
6212
				},
6016
				},
6213
				"----------\n" +
6017
				"----------\n" +
6214
				"1. WARNING in X.java (at line 14)\n" +
6018
				"1. ERROR in X.java (at line 15)\n" +
6215
				"	private static B2F create() { return new B2F(); }\n" +
6216
				"	                   ^^^^^^^^\n" +
6217
				"The method create() from the type X.Key.B2F is never used locally\n" +
6218
				"----------\n" +
6219
				"2. ERROR in X.java (at line 15)\n" +
6220
				"	public Key flip() { return F2B.create(); }\n" +
6019
				"	public Key flip() { return F2B.create(); }\n" +
6221
				"	                           ^^^\n" +
6020
				"	                           ^^^\n" +
6222
				"The type F2B is defined in an inherited type and an enclosing scope\n" +
6021
				"The type F2B is defined in an inherited type and an enclosing scope\n" +
6223
				"----------\n" +
6022
				"----------\n" +
6224
				"3. WARNING in X.java (at line 19)\n" +
6023
				"2. ERROR in X.java (at line 20)\n" +
6225
				"	private static F2B create() { return new F2B(); }\n" +
6226
				"	                   ^^^^^^^^\n" +
6227
				"The method create() from the type X.Key.F2B is never used locally\n" +
6228
				"----------\n" +
6229
				"4. ERROR in X.java (at line 20)\n" +
6230
				"	public Key flip() { return B2F.create(); }\n" +
6024
				"	public Key flip() { return B2F.create(); }\n" +
6231
				"	                           ^^^\n" +
6025
				"	                           ^^^\n" +
6232
				"The type B2F is defined in an inherited type and an enclosing scope\n" +
6026
				"The type B2F is defined in an inherited type and an enclosing scope\n" +
Lines 6324-6355 Link Here
6324
					"}", // =================
6118
					"}", // =================
6325
				},
6119
				},
6326
				"----------\n" +
6120
				"----------\n" +
6327
				"1. WARNING in X.java (at line 11)\n" +
6121
				"1. ERROR in X.java (at line 16)\n" +
6328
				"	private class Test5 {\n" +
6329
				"	              ^^^^^\n" +
6330
				"The type X.Test5 is never used locally\n" +
6331
				"----------\n" +
6332
				"2. WARNING in X.java (at line 12)\n" +
6333
				"	private class Test4 extends Test2 {\n" +
6334
				"	              ^^^^^\n" +
6335
				"The type X.Test5.Test4 is never used locally\n" +
6336
				"----------\n" +
6337
				"3. ERROR in X.java (at line 16)\n" +
6338
				"	System.out.println(X.this.var1.trim());\n" +
6122
				"	System.out.println(X.this.var1.trim());\n" +
6339
				"	                   ^^^^^^\n" +
6123
				"	                   ^^^^^^\n" +
6340
				"No enclosing instance of the type X is accessible in scope\n" +
6124
				"No enclosing instance of the type X is accessible in scope\n" +
6341
				"----------\n" +
6125
				"----------\n" +
6342
				"4. WARNING in X.java (at line 16)\n" +
6126
				"2. WARNING in X.java (at line 16)\n" +
6343
				"	System.out.println(X.this.var1.trim());\n" +
6127
				"	System.out.println(X.this.var1.trim());\n" +
6344
				"	                          ^^^^\n" +
6128
				"	                          ^^^^\n" +
6345
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6129
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6346
				"----------\n" +
6130
				"----------\n" +
6347
				"5. WARNING in X.java (at line 17)\n" +
6131
				"3. WARNING in X.java (at line 17)\n" +
6348
				"	System.out.println(var1.trim());\n" +
6132
				"	System.out.println(var1.trim());\n" +
6349
				"	                   ^^^^\n" +
6133
				"	                   ^^^^\n" +
6350
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6134
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6351
				"----------\n" +
6135
				"----------\n" +
6352
				"6. ERROR in X.java (at line 17)\n" +
6136
				"4. ERROR in X.java (at line 17)\n" +
6353
				"	System.out.println(var1.trim());\n" +
6137
				"	System.out.println(var1.trim());\n" +
6354
				"	                   ^^^^\n" +
6138
				"	                   ^^^^\n" +
6355
				"No enclosing instance of the type X is accessible in scope\n" +
6139
				"No enclosing instance of the type X is accessible in scope\n" +
Lines 6417-6443 Link Here
6417
					"}", // =================
6201
					"}", // =================
6418
				},
6202
				},
6419
				"----------\n" +
6203
				"----------\n" +
6420
				"1. WARNING in X.java (at line 12)\n" +
6204
				"1. ERROR in X.java (at line 16)\n" +
6421
				"	private class Test4 extends Test2 {\n" +
6422
				"	              ^^^^^\n" +
6423
				"The type X.Test4 is never used locally\n" +
6424
				"----------\n" +
6425
				"2. ERROR in X.java (at line 16)\n" +
6426
				"	System.out.println(X.this.var1.trim());\n" +
6205
				"	System.out.println(X.this.var1.trim());\n" +
6427
				"	                   ^^^^^^\n" +
6206
				"	                   ^^^^^^\n" +
6428
				"No enclosing instance of the type X is accessible in scope\n" +
6207
				"No enclosing instance of the type X is accessible in scope\n" +
6429
				"----------\n" +
6208
				"----------\n" +
6430
				"3. WARNING in X.java (at line 16)\n" +
6209
				"2. WARNING in X.java (at line 16)\n" +
6431
				"	System.out.println(X.this.var1.trim());\n" +
6210
				"	System.out.println(X.this.var1.trim());\n" +
6432
				"	                          ^^^^\n" +
6211
				"	                          ^^^^\n" +
6433
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6212
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6434
				"----------\n" +
6213
				"----------\n" +
6435
				"4. WARNING in X.java (at line 17)\n" +
6214
				"3. WARNING in X.java (at line 17)\n" +
6436
				"	System.out.println(var1.trim());\n" +
6215
				"	System.out.println(var1.trim());\n" +
6437
				"	                   ^^^^\n" +
6216
				"	                   ^^^^\n" +
6438
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6217
				"Read access to enclosing field X.var1 is emulated by a synthetic accessor method\n" +
6439
				"----------\n" +
6218
				"----------\n" +
6440
				"5. ERROR in X.java (at line 17)\n" +
6219
				"4. ERROR in X.java (at line 17)\n" +
6441
				"	System.out.println(var1.trim());\n" +
6220
				"	System.out.println(var1.trim());\n" +
6442
				"	                   ^^^^\n" +
6221
				"	                   ^^^^\n" +
6443
				"No enclosing instance of the type X is accessible in scope\n" +
6222
				"No enclosing instance of the type X is accessible in scope\n" +
Lines 7036-7062 Link Here
7036
			"}\n",
6815
			"}\n",
7037
		},
6816
		},
7038
		"----------\n" + 
6817
		"----------\n" + 
7039
		"1. WARNING in X.java (at line 4)\n" + 
6818
		"1. WARNING in X.java (at line 8)\n" + 
7040
		"	private void c() {}\n" + 
7041
		"	             ^^^\n" + 
7042
		"The method c() from the type X is never used locally\n" + 
7043
		"----------\n" + 
7044
		"2. WARNING in X.java (at line 8)\n" + 
7045
		"	a(null);\n" + 
6819
		"	a(null);\n" + 
7046
		"	^^^^^^^\n" + 
6820
		"	^^^^^^^\n" + 
7047
		"Access to enclosing method a(String) from the type X is emulated by a synthetic accessor method\n" + 
6821
		"Access to enclosing method a(String) from the type X is emulated by a synthetic accessor method\n" + 
7048
		"----------\n" + 
6822
		"----------\n" + 
7049
		"3. WARNING in X.java (at line 9)\n" + 
6823
		"2. WARNING in X.java (at line 9)\n" + 
7050
		"	c(null);\n" + 
6824
		"	c(null);\n" + 
7051
		"	^^^^^^^\n" + 
6825
		"	^^^^^^^\n" + 
7052
		"Access to enclosing method c(String) from the type X is emulated by a synthetic accessor method\n" + 
6826
		"Access to enclosing method c(String) from the type X is emulated by a synthetic accessor method\n" + 
7053
		"----------\n" + 
6827
		"----------\n" + 
7054
		"4. WARNING in X.java (at line 14)\n" + 
6828
		"3. WARNING in X.java (at line 14)\n" + 
7055
		"	a(null);\n" + 
6829
		"	a(null);\n" + 
7056
		"	^^^^^^^\n" + 
6830
		"	^^^^^^^\n" + 
7057
		"Access to enclosing method a(String) from the type X is emulated by a synthetic accessor method\n" + 
6831
		"Access to enclosing method a(String) from the type X is emulated by a synthetic accessor method\n" + 
7058
		"----------\n" + 
6832
		"----------\n" + 
7059
		"5. WARNING in X.java (at line 15)\n" + 
6833
		"4. WARNING in X.java (at line 15)\n" + 
7060
		"	c(null);\n" + 
6834
		"	c(null);\n" + 
7061
		"	^^^^^^^\n" + 
6835
		"	^^^^^^^\n" + 
7062
		"Access to enclosing method c(String) from the type X is emulated by a synthetic accessor method\n" + 
6836
		"Access to enclosing method c(String) from the type X is emulated by a synthetic accessor method\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java (-1 / +27 lines)
Lines 34-40 Link Here
34
	static {
34
	static {
35
//		TESTS_PREFIX = "testBug95521";
35
//		TESTS_PREFIX = "testBug95521";
36
//		TESTS_NAMES = new String[] { "testBug83127a" };
36
//		TESTS_NAMES = new String[] { "testBug83127a" };
37
//		TESTS_NUMBERS = new int[] { 46 };
37
//		TESTS_NUMBERS = new int[] { 47 };
38
//		TESTS_RANGE = new int[] { 23 -1,};
38
//		TESTS_RANGE = new int[] { 23 -1,};
39
	}
39
	}
40
	public static Test suite() {
40
	public static Test suite() {
Lines 6522-6525 Link Here
6522
			true,
6522
			true,
6523
			customOptions);
6523
			customOptions);
6524
	}
6524
	}
6525
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=324848
6526
	public void test047() {
6527
		this.runNegativeTest(
6528
			new String[] {
6529
				"X.java",
6530
				"public class X {\n" + 
6531
				"	public static void test() {\n" + 
6532
				"		final boolean x = true;\n" + 
6533
				"		new Runnable() {\n" + 
6534
				"			@Override\n" + 
6535
				"			public void run() {\n" + 
6536
				"				synchronized (X.this) {\n" + 
6537
				"					System.out.println(x);\n" + 
6538
				"				}\n" + 
6539
				"			}\n" + 
6540
				"		};\n" + 
6541
				"	}\n" + 
6542
				"}"
6543
			},
6544
			"----------\n" + 
6545
			"1. ERROR in X.java (at line 7)\n" + 
6546
			"	synchronized (X.this) {\n" + 
6547
			"	              ^^^^^^\n" + 
6548
			"No enclosing instance of the type X is accessible in scope\n" + 
6549
			"----------\n");
6550
	}
6525
}
6551
}

Return to bug 324848