Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 352699 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-17 / +10 lines)
Lines 7891-7914 Link Here
7891
public void redundantSpecificationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) {
7891
public void redundantSpecificationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) {
7892
	int severity = computeSeverity(IProblem.RedundantSpecificationOfTypeArguments);
7892
	int severity = computeSeverity(IProblem.RedundantSpecificationOfTypeArguments);
7893
	if (severity != ProblemSeverities.Ignore) {
7893
	if (severity != ProblemSeverities.Ignore) {
7894
		TypeReference[] args = null;
7894
		int sourceStart = -1;
7895
		if (location instanceof ParameterizedSingleTypeReference) {
7895
		if (location instanceof QualifiedTypeReference) {
7896
			ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) location;
7896
			sourceStart = (int) (((QualifiedTypeReference)location).sourcePositions[((QualifiedTypeReference)location).sourcePositions.length - 1] >> 32);
7897
			args = parameterizedSingleTypeReference.typeArguments;
7898
		}
7899
		if (location instanceof ParameterizedQualifiedTypeReference) {
7900
			ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = (ParameterizedQualifiedTypeReference) location;
7901
			args = parameterizedQualifiedTypeReference.typeArguments[parameterizedQualifiedTypeReference.typeArguments.length - 1];
7902
		}
7903
		if (args != null) {
7904
			this.handle(
7905
				IProblem.RedundantSpecificationOfTypeArguments,
7906
				new String[] {typesAsString(argumentTypes, false)},
7907
				new String[] {typesAsString(argumentTypes, true)},
7908
				severity,
7909
				args[0].sourceStart,
7910
				args[args.length - 1].sourceEnd);
7911
		}
7897
		}
7898
		this.handle(
7899
			IProblem.RedundantSpecificationOfTypeArguments,
7900
			new String[] {typesAsString(argumentTypes, false)},
7901
			new String[] {typesAsString(argumentTypes, true)},
7902
			severity,
7903
			sourceStart == -1? location.sourceStart : sourceStart,
7904
			location.sourceEnd);
7912
    }
7905
    }
7913
}
7906
}
7914
}
7907
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java (-31 / +32 lines)
Lines 1841-1872 Link Here
1841
		"----------\n" + 
1841
		"----------\n" + 
1842
		"1. ERROR in X.java (at line 6)\n" + 
1842
		"1. ERROR in X.java (at line 6)\n" + 
1843
		"	X<String> x2 = new X<String>(\"SUCCESS\");\n" + 
1843
		"	X<String> x2 = new X<String>(\"SUCCESS\");\n" + 
1844
		"	                     ^^^^^^\n" + 
1844
		"	                   ^\n" + 
1845
		"Redundant specification of type arguments <String>\n" + 
1845
		"Redundant specification of type arguments <String>\n" + 
1846
		"----------\n" + 
1846
		"----------\n" + 
1847
		"2. ERROR in X.java (at line 7)\n" + 
1847
		"2. ERROR in X.java (at line 7)\n" + 
1848
		"	X<Integer> x3 = new X<Integer>(1);\n" + 
1848
		"	X<Integer> x3 = new X<Integer>(1);\n" + 
1849
		"	                      ^^^^^^^\n" + 
1849
		"	                    ^\n" + 
1850
		"Redundant specification of type arguments <Integer>\n" + 
1850
		"Redundant specification of type arguments <Integer>\n" + 
1851
		"----------\n" + 
1851
		"----------\n" + 
1852
		"3. ERROR in X.java (at line 8)\n" + 
1852
		"3. ERROR in X.java (at line 8)\n" + 
1853
		"	X<AX> x4 = new X<AX>(new AX());\n" + 
1853
		"	X<AX> x4 = new X<AX>(new AX());\n" + 
1854
		"	                 ^^\n" + 
1854
		"	               ^\n" + 
1855
		"Redundant specification of type arguments <AX>\n" + 
1855
		"Redundant specification of type arguments <AX>\n" + 
1856
		"----------\n" + 
1856
		"----------\n" + 
1857
		"4. ERROR in X.java (at line 9)\n" + 
1857
		"4. ERROR in X.java (at line 9)\n" + 
1858
		"	X<? extends AX> x5 = new X<AX<String>>(new AX<String>());\n" + 
1858
		"	X<? extends AX> x5 = new X<AX<String>>(new AX<String>());\n" + 
1859
		"	                           ^^\n" + 
1859
		"	                         ^\n" + 
1860
		"Redundant specification of type arguments <AX<String>>\n" + 
1860
		"Redundant specification of type arguments <AX<String>>\n" + 
1861
		"----------\n" + 
1861
		"----------\n" + 
1862
		"5. ERROR in X.java (at line 10)\n" + 
1862
		"5. ERROR in X.java (at line 10)\n" + 
1863
		"	X<?> x6 = new X<AX<String>>(new AX<String>());\n" + 
1863
		"	X<?> x6 = new X<AX<String>>(new AX<String>());\n" + 
1864
		"	                ^^\n" + 
1864
		"	              ^\n" + 
1865
		"Redundant specification of type arguments <AX<String>>\n" + 
1865
		"Redundant specification of type arguments <AX<String>>\n" + 
1866
		"----------\n" + 
1866
		"----------\n" + 
1867
		"6. ERROR in X.java (at line 11)\n" + 
1867
		"6. ERROR in X.java (at line 11)\n" + 
1868
		"	X<Class<? extends Object>> x7 = new X<Class<? extends Object>>();\n" + 
1868
		"	X<Class<? extends Object>> x7 = new X<Class<? extends Object>>();\n" + 
1869
		"	                                      ^^^^^\n" + 
1869
		"	                                    ^\n" + 
1870
		"Redundant specification of type arguments <Class<? extends Object>>\n" + 
1870
		"Redundant specification of type arguments <Class<? extends Object>>\n" + 
1871
		"----------\n",
1871
		"----------\n",
1872
		null,
1872
		null,
Lines 1902-1923 Link Here
1902
		"----------\n" + 
1902
		"----------\n" + 
1903
		"1. ERROR in X.java (at line 8)\n" + 
1903
		"1. ERROR in X.java (at line 8)\n" + 
1904
		"	X<String> x2 = new X<String>(\"SUCCESS\");\n" + 
1904
		"	X<String> x2 = new X<String>(\"SUCCESS\");\n" + 
1905
		"	                     ^^^^^^\n" + 
1905
		"	                   ^\n" + 
1906
		"Redundant specification of type arguments <String>\n" + 
1906
		"Redundant specification of type arguments <String>\n" + 
1907
		"----------\n" + 
1907
		"----------\n" + 
1908
		"2. ERROR in X.java (at line 9)\n" + 
1908
		"2. ERROR in X.java (at line 9)\n" + 
1909
		"	X<String> x22 = new X<String>(1,\"SUCCESS\");\n" + 
1909
		"	X<String> x22 = new X<String>(1,\"SUCCESS\");\n" + 
1910
		"	                      ^^^^^^\n" + 
1910
		"	                    ^\n" + 
1911
		"Redundant specification of type arguments <String>\n" + 
1911
		"Redundant specification of type arguments <String>\n" + 
1912
		"----------\n" + 
1912
		"----------\n" + 
1913
		"3. ERROR in X.java (at line 10)\n" + 
1913
		"3. ERROR in X.java (at line 10)\n" + 
1914
		"	X<Integer> x3 = new X<Integer>(1);\n" + 
1914
		"	X<Integer> x3 = new X<Integer>(1);\n" + 
1915
		"	                      ^^^^^^^\n" + 
1915
		"	                    ^\n" + 
1916
		"Redundant specification of type arguments <Integer>\n" + 
1916
		"Redundant specification of type arguments <Integer>\n" + 
1917
		"----------\n" + 
1917
		"----------\n" + 
1918
		"4. ERROR in X.java (at line 11)\n" + 
1918
		"4. ERROR in X.java (at line 11)\n" + 
1919
		"	String s = foo(new X<String>(\"aaa\"));\n" + 
1919
		"	String s = foo(new X<String>(\"aaa\"));\n" + 
1920
		"	                     ^^^^^^\n" + 
1920
		"	                   ^\n" + 
1921
		"Redundant specification of type arguments <String>\n" + 
1921
		"Redundant specification of type arguments <String>\n" + 
1922
		"----------\n",
1922
		"----------\n",
1923
		null,
1923
		null,
Lines 1947-1958 Link Here
1947
		"----------\n" + 
1947
		"----------\n" + 
1948
		"1. ERROR in X.java (at line 4)\n" + 
1948
		"1. ERROR in X.java (at line 4)\n" + 
1949
		"	X<Integer> x = new X<Integer>(\"\",\"\");\n" + 
1949
		"	X<Integer> x = new X<Integer>(\"\",\"\");\n" + 
1950
		"	                     ^^^^^^^\n" + 
1950
		"	                   ^\n" + 
1951
		"Redundant specification of type arguments <Integer>\n" + 
1951
		"Redundant specification of type arguments <Integer>\n" + 
1952
		"----------\n" + 
1952
		"----------\n" + 
1953
		"2. ERROR in X.java (at line 8)\n" + 
1953
		"2. ERROR in X.java (at line 8)\n" + 
1954
		"	return new X<Integer>(\"\",\"\");\n" + 
1954
		"	return new X<Integer>(\"\",\"\");\n" + 
1955
		"	             ^^^^^^^\n" + 
1955
		"	           ^\n" + 
1956
		"Redundant specification of type arguments <Integer>\n" + 
1956
		"Redundant specification of type arguments <Integer>\n" + 
1957
		"----------\n",
1957
		"----------\n",
1958
		null,
1958
		null,
Lines 1980-1986 Link Here
1980
		"----------\n" + 
1980
		"----------\n" + 
1981
		"1. ERROR in Z.java (at line 3)\n" + 
1981
		"1. ERROR in Z.java (at line 3)\n" + 
1982
		"	foo(new Z<ZB>());\n" + 
1982
		"	foo(new Z<ZB>());\n" + 
1983
		"	          ^^\n" + 
1983
		"	        ^\n" + 
1984
		"Redundant specification of type arguments <ZB>\n" + 
1984
		"Redundant specification of type arguments <ZB>\n" + 
1985
		"----------\n",
1985
		"----------\n",
1986
		null,
1986
		null,
Lines 2005-2011 Link Here
2005
		"----------\n" + 
2005
		"----------\n" + 
2006
		"1. ERROR in Y.java (at line 3)\n" + 
2006
		"1. ERROR in Y.java (at line 3)\n" + 
2007
		"	return new Y<W>();\n" + 
2007
		"	return new Y<W>();\n" + 
2008
		"	             ^\n" + 
2008
		"	           ^\n" + 
2009
		"Redundant specification of type arguments <W>\n" + 
2009
		"Redundant specification of type arguments <W>\n" + 
2010
		"----------\n",
2010
		"----------\n",
2011
		null,
2011
		null,
Lines 2026-2031 Link Here
2026
			"\n" +
2026
			"\n" +
2027
			"  void method() {\n" +
2027
			"  void method() {\n" +
2028
			"    X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" +
2028
			"    X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" +
2029
			"    X<String>.Inner<Integer> a1= new X<String>().new Inner<>();\n" +	// do not warn. Removing String from X<String> not possible
2029
			"    Inner<Integer> b= new X<A>().new Inner<Integer>();\n" +
2030
			"    Inner<Integer> b= new X<A>().new Inner<Integer>();\n" +
2030
			"    Inner<Integer> c= new Inner<Integer>();\n" +
2031
			"    Inner<Integer> c= new Inner<Integer>();\n" +
2031
			"    X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" +
2032
			"    X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" +
Lines 2037-2068 Link Here
2037
		"----------\n" + 
2038
		"----------\n" + 
2038
		"1. ERROR in X.java (at line 6)\n" + 
2039
		"1. ERROR in X.java (at line 6)\n" + 
2039
		"	X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" + 
2040
		"	X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" + 
2040
		"	                                                      ^^^^^^^\n" + 
2041
		"	                                                ^^^^^\n" + 
2041
		"Redundant specification of type arguments <Integer>\n" + 
2042
		"Redundant specification of type arguments <Integer>\n" + 
2042
		"----------\n" + 
2043
		"----------\n" + 
2043
		"2. ERROR in X.java (at line 7)\n" + 
2044
		"2. ERROR in X.java (at line 8)\n" + 
2044
		"	Inner<Integer> b= new X<A>().new Inner<Integer>();\n" + 
2045
		"	Inner<Integer> b= new X<A>().new Inner<Integer>();\n" + 
2045
		"	                                       ^^^^^^^\n" + 
2046
		"	                                 ^^^^^\n" + 
2046
		"Redundant specification of type arguments <Integer>\n" + 
2047
		"Redundant specification of type arguments <Integer>\n" + 
2047
		"----------\n" + 
2048
		"----------\n" + 
2048
		"3. ERROR in X.java (at line 8)\n" + 
2049
		"3. ERROR in X.java (at line 9)\n" + 
2049
		"	Inner<Integer> c= new Inner<Integer>();\n" + 
2050
		"	Inner<Integer> c= new Inner<Integer>();\n" + 
2050
		"	                            ^^^^^^^\n" + 
2051
		"	                      ^^^^^\n" + 
2051
		"Redundant specification of type arguments <Integer>\n" + 
2052
		"Redundant specification of type arguments <Integer>\n" + 
2052
		"----------\n" + 
2053
		"----------\n" + 
2053
		"4. ERROR in X.java (at line 9)\n" + 
2054
		"4. ERROR in X.java (at line 10)\n" + 
2054
		"	X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" + 
2055
		"	X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" + 
2055
		"	                                            ^^^^^^^\n" + 
2056
		"	                                      ^^^^^\n" + 
2056
		"Redundant specification of type arguments <Integer>\n" + 
2057
		"Redundant specification of type arguments <Integer>\n" + 
2057
		"----------\n" + 
2058
		"----------\n" + 
2058
		"5. ERROR in X.java (at line 10)\n" + 
2059
		"5. ERROR in X.java (at line 11)\n" + 
2059
		"	X<A>.Inner<Integer> f= new Inner<Integer>();\n" + 
2060
		"	X<A>.Inner<Integer> f= new Inner<Integer>();\n" + 
2060
		"	                                 ^^^^^^^\n" + 
2061
		"	                           ^^^^^\n" + 
2061
		"Redundant specification of type arguments <Integer>\n" + 
2062
		"Redundant specification of type arguments <Integer>\n" + 
2062
		"----------\n" + 
2063
		"----------\n" + 
2063
		"6. ERROR in X.java (at line 11)\n" + 
2064
		"6. ERROR in X.java (at line 12)\n" + 
2064
		"	X.Inner2<Integer> d3 = new X.Inner2<Integer>();\n" + 
2065
		"	X.Inner2<Integer> d3 = new X.Inner2<Integer>();\n" + 
2065
		"	                                    ^^^^^^^\n" + 
2066
		"	                             ^^^^^^\n" + 
2066
		"Redundant specification of type arguments <Integer>\n" + 
2067
		"Redundant specification of type arguments <Integer>\n" + 
2067
		"----------\n",
2068
		"----------\n",
2068
		null,
2069
		null,
Lines 2096-2102 Link Here
2096
		"----------\n" + 
2097
		"----------\n" + 
2097
		"2. ERROR in X.java (at line 3)\n" + 
2098
		"2. ERROR in X.java (at line 3)\n" + 
2098
		"	X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + 
2099
		"	X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + 
2099
		"	                                                       ^^^^^^\n" + 
2100
		"	                                                  ^^^^\n" + 
2100
		"Redundant specification of type arguments <Thread>\n" + 
2101
		"Redundant specification of type arguments <Thread>\n" + 
2101
		"----------\n" + 
2102
		"----------\n" + 
2102
		"3. ERROR in X.java (at line 6)\n" + 
2103
		"3. ERROR in X.java (at line 6)\n" + 
Lines 2106-2112 Link Here
2106
		"----------\n" + 
2107
		"----------\n" + 
2107
		"4. ERROR in X.java (at line 6)\n" + 
2108
		"4. ERROR in X.java (at line 6)\n" + 
2108
		"	X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + 
2109
		"	X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + 
2109
		"	                                                    ^^^^^^\n" + 
2110
		"	                                               ^^^^\n" + 
2110
		"Redundant specification of type arguments <Thread>\n" + 
2111
		"Redundant specification of type arguments <Thread>\n" + 
2111
		"----------\n",
2112
		"----------\n",
2112
		null,
2113
		null,
Lines 2133-2139 Link Here
2133
		"----------\n" + 
2134
		"----------\n" + 
2134
		"1. ERROR in X.java (at line 5)\n" + 
2135
		"1. ERROR in X.java (at line 5)\n" + 
2135
		"	X1<Integer> x1 = new X.X1<Integer>(1);\n" + 
2136
		"	X1<Integer> x1 = new X.X1<Integer>(1);\n" + 
2136
		"	                          ^^^^^^^\n" + 
2137
		"	                       ^^\n" + 
2137
		"Redundant specification of type arguments <Integer>\n" + 
2138
		"Redundant specification of type arguments <Integer>\n" + 
2138
		"----------\n",
2139
		"----------\n",
2139
		null,
2140
		null,
Lines 2160-2166 Link Here
2160
		"----------\n" + 
2161
		"----------\n" + 
2161
		"1. ERROR in X.java (at line 6)\n" + 
2162
		"1. ERROR in X.java (at line 6)\n" + 
2162
		"	X<Integer>.X1<Number> x1 = new X<Integer>(1).new X1<Number>(1);\n" + 
2163
		"	X<Integer>.X1<Number> x1 = new X<Integer>(1).new X1<Number>(1);\n" + 
2163
		"	                                 ^^^^^^^\n" + 
2164
		"	                               ^\n" + 
2164
		"Redundant specification of type arguments <Integer>\n" + 
2165
		"Redundant specification of type arguments <Integer>\n" + 
2165
		"----------\n",
2166
		"----------\n",
2166
		null,
2167
		null,
Lines 2188-2194 Link Here
2188
		"----------\n" + 
2189
		"----------\n" + 
2189
		"1. ERROR in X.java (at line 3)\n" + 
2190
		"1. ERROR in X.java (at line 3)\n" + 
2190
		"	Pair<Double, Integer> p = new InvertedPair<Integer, Double>();\n" + 
2191
		"	Pair<Double, Integer> p = new InvertedPair<Integer, Double>();\n" + 
2191
		"	                                           ^^^^^^^^^^^^^^^\n" + 
2192
		"	                              ^^^^^^^^^^^^\n" + 
2192
		"Redundant specification of type arguments <Integer, Double>\n" + 
2193
		"Redundant specification of type arguments <Integer, Double>\n" + 
2193
		"----------\n",
2194
		"----------\n",
2194
		null,
2195
		null,
Lines 2217-2223 Link Here
2217
		"----------\n" + 
2218
		"----------\n" + 
2218
		"1. ERROR in X.java (at line 7)\n" + 
2219
		"1. ERROR in X.java (at line 7)\n" + 
2219
		"	: new ArrayList<Object>();\n" + 
2220
		"	: new ArrayList<Object>();\n" + 
2220
		"	                ^^^^^^\n" + 
2221
		"	      ^^^^^^^^^\n" + 
2221
		"Redundant specification of type arguments <Object>\n" + 
2222
		"Redundant specification of type arguments <Object>\n" + 
2222
		"----------\n",
2223
		"----------\n",
2223
		null,
2224
		null,

Return to bug 352699