Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 200058 Details for
Bug 352699
[1.7][compiler] Improve error range for redundant type parameter warning
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
proposed fix with slight change
patch352699.txt (text/plain), 11.23 KB, created by
Ayushman Jain
on 2011-07-21 04:00:22 EDT
(
hide
)
Description:
proposed fix with slight change
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-07-21 04:00:22 EDT
Size:
11.23 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.430.2.35 >diff -u -r1.430.2.35 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 13 Jul 2011 08:27:07 -0000 1.430.2.35 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 21 Jul 2011 07:59:01 -0000 >@@ -7891,24 +7891,20 @@ > public void redundantSpecificationOfTypeArguments(ASTNode location, TypeBinding[] argumentTypes) { > int severity = computeSeverity(IProblem.RedundantSpecificationOfTypeArguments); > if (severity != ProblemSeverities.Ignore) { >- TypeReference[] args = null; >- if (location instanceof ParameterizedSingleTypeReference) { >- ParameterizedSingleTypeReference parameterizedSingleTypeReference = (ParameterizedSingleTypeReference) location; >- args = parameterizedSingleTypeReference.typeArguments; >- } >- if (location instanceof ParameterizedQualifiedTypeReference) { >- ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference = (ParameterizedQualifiedTypeReference) location; >- args = parameterizedQualifiedTypeReference.typeArguments[parameterizedQualifiedTypeReference.typeArguments.length - 1]; >- } >- if (args != null) { >- this.handle( >- IProblem.RedundantSpecificationOfTypeArguments, >- new String[] {typesAsString(argumentTypes, false)}, >- new String[] {typesAsString(argumentTypes, true)}, >- severity, >- args[0].sourceStart, >- args[args.length - 1].sourceEnd); >+ int sourceStart = -1; >+ if (location instanceof QualifiedTypeReference) { >+ QualifiedTypeReference ref = (QualifiedTypeReference)location; >+ sourceStart = (int) (ref.sourcePositions[ref.sourcePositions.length - 1] >> 32); >+ } else { >+ sourceStart = location.sourceStart; > } >+ this.handle( >+ IProblem.RedundantSpecificationOfTypeArguments, >+ new String[] {typesAsString(argumentTypes, false)}, >+ new String[] {typesAsString(argumentTypes, true)}, >+ severity, >+ sourceStart, >+ location.sourceEnd); > } > } > } >\ No newline at end of file >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Attic/GenericsRegressionTest_1_7.java,v >retrieving revision 1.1.2.24 >diff -u -r1.1.2.24 GenericsRegressionTest_1_7.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 14 Jul 2011 06:59:11 -0000 1.1.2.24 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java 21 Jul 2011 07:59:03 -0000 >@@ -1841,32 +1841,32 @@ > "----------\n" + > "1. ERROR in X.java (at line 6)\n" + > " X<String> x2 = new X<String>(\"SUCCESS\");\n" + >- " ^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <String>\n" + > "----------\n" + > "2. ERROR in X.java (at line 7)\n" + > " X<Integer> x3 = new X<Integer>(1);\n" + >- " ^^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + > "3. ERROR in X.java (at line 8)\n" + > " X<AX> x4 = new X<AX>(new AX());\n" + >- " ^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <AX>\n" + > "----------\n" + > "4. ERROR in X.java (at line 9)\n" + > " X<? extends AX> x5 = new X<AX<String>>(new AX<String>());\n" + >- " ^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <AX<String>>\n" + > "----------\n" + > "5. ERROR in X.java (at line 10)\n" + > " X<?> x6 = new X<AX<String>>(new AX<String>());\n" + >- " ^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <AX<String>>\n" + > "----------\n" + > "6. ERROR in X.java (at line 11)\n" + > " X<Class<? extends Object>> x7 = new X<Class<? extends Object>>();\n" + >- " ^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <Class<? extends Object>>\n" + > "----------\n", > null, >@@ -1902,22 +1902,22 @@ > "----------\n" + > "1. ERROR in X.java (at line 8)\n" + > " X<String> x2 = new X<String>(\"SUCCESS\");\n" + >- " ^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <String>\n" + > "----------\n" + > "2. ERROR in X.java (at line 9)\n" + > " X<String> x22 = new X<String>(1,\"SUCCESS\");\n" + >- " ^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <String>\n" + > "----------\n" + > "3. ERROR in X.java (at line 10)\n" + > " X<Integer> x3 = new X<Integer>(1);\n" + >- " ^^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + > "4. ERROR in X.java (at line 11)\n" + > " String s = foo(new X<String>(\"aaa\"));\n" + >- " ^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <String>\n" + > "----------\n", > null, >@@ -1947,12 +1947,12 @@ > "----------\n" + > "1. ERROR in X.java (at line 4)\n" + > " X<Integer> x = new X<Integer>(\"\",\"\");\n" + >- " ^^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + > "2. ERROR in X.java (at line 8)\n" + > " return new X<Integer>(\"\",\"\");\n" + >- " ^^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n", > null, >@@ -1980,7 +1980,7 @@ > "----------\n" + > "1. ERROR in Z.java (at line 3)\n" + > " foo(new Z<ZB>());\n" + >- " ^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <ZB>\n" + > "----------\n", > null, >@@ -2005,7 +2005,7 @@ > "----------\n" + > "1. ERROR in Y.java (at line 3)\n" + > " return new Y<W>();\n" + >- " ^\n" + >+ " ^\n" + > "Redundant specification of type arguments <W>\n" + > "----------\n", > null, >@@ -2026,6 +2026,7 @@ > "\n" + > " void method() {\n" + > " X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" + >+ " X<String>.Inner<Integer> a1= new X<String>().new Inner<>();\n" + // do not warn. Removing String from X<String> not possible > " Inner<Integer> b= new X<A>().new Inner<Integer>();\n" + > " Inner<Integer> c= new Inner<Integer>();\n" + > " X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" + >@@ -2037,32 +2038,32 @@ > "----------\n" + > "1. ERROR in X.java (at line 6)\n" + > " X<String>.Inner<Integer> a= new X<String>().new Inner<Integer>();\n" + >- " ^^^^^^^\n" + >+ " ^^^^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + >- "2. ERROR in X.java (at line 7)\n" + >+ "2. ERROR in X.java (at line 8)\n" + > " Inner<Integer> b= new X<A>().new Inner<Integer>();\n" + >- " ^^^^^^^\n" + >+ " ^^^^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + >- "3. ERROR in X.java (at line 8)\n" + >+ "3. ERROR in X.java (at line 9)\n" + > " Inner<Integer> c= new Inner<Integer>();\n" + >- " ^^^^^^^\n" + >+ " ^^^^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + >- "4. ERROR in X.java (at line 9)\n" + >+ "4. ERROR in X.java (at line 10)\n" + > " X<A>.Inner<Integer> e= new X<A>().new Inner<Integer>();\n" + >- " ^^^^^^^\n" + >+ " ^^^^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + >- "5. ERROR in X.java (at line 10)\n" + >+ "5. ERROR in X.java (at line 11)\n" + > " X<A>.Inner<Integer> f= new Inner<Integer>();\n" + >- " ^^^^^^^\n" + >+ " ^^^^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n" + >- "6. ERROR in X.java (at line 11)\n" + >+ "6. ERROR in X.java (at line 12)\n" + > " X.Inner2<Integer> d3 = new X.Inner2<Integer>();\n" + >- " ^^^^^^^\n" + >+ " ^^^^^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n", > null, >@@ -2096,7 +2097,7 @@ > "----------\n" + > "2. ERROR in X.java (at line 3)\n" + > " X<String>.Item<Thread> i = new X<Exception>().new Item<Thread>();\n" + >- " ^^^^^^\n" + >+ " ^^^^\n" + > "Redundant specification of type arguments <Thread>\n" + > "----------\n" + > "3. ERROR in X.java (at line 6)\n" + >@@ -2106,7 +2107,7 @@ > "----------\n" + > "4. ERROR in X.java (at line 6)\n" + > " X<Exception>.Item<Thread> j = new X<Exception>.Item<Thread>();\n" + >- " ^^^^^^\n" + >+ " ^^^^\n" + > "Redundant specification of type arguments <Thread>\n" + > "----------\n", > null, >@@ -2133,7 +2134,7 @@ > "----------\n" + > "1. ERROR in X.java (at line 5)\n" + > " X1<Integer> x1 = new X.X1<Integer>(1);\n" + >- " ^^^^^^^\n" + >+ " ^^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n", > null, >@@ -2160,7 +2161,7 @@ > "----------\n" + > "1. ERROR in X.java (at line 6)\n" + > " X<Integer>.X1<Number> x1 = new X<Integer>(1).new X1<Number>(1);\n" + >- " ^^^^^^^\n" + >+ " ^\n" + > "Redundant specification of type arguments <Integer>\n" + > "----------\n", > null, >@@ -2188,7 +2189,7 @@ > "----------\n" + > "1. ERROR in X.java (at line 3)\n" + > " Pair<Double, Integer> p = new InvertedPair<Integer, Double>();\n" + >- " ^^^^^^^^^^^^^^^\n" + >+ " ^^^^^^^^^^^^\n" + > "Redundant specification of type arguments <Integer, Double>\n" + > "----------\n", > null, >@@ -2217,7 +2218,7 @@ > "----------\n" + > "1. ERROR in X.java (at line 7)\n" + > " : new ArrayList<Object>();\n" + >- " ^^^^^^\n" + >+ " ^^^^^^^^^\n" + > "Redundant specification of type arguments <Object>\n" + > "----------\n", > null,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 352699
:
200056
| 200058