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 151165 Details for
Bug 293777
Misleading problem when @Override is used on method with unresolved parameter type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v0.5 + regression test
misleadingOverridePatch.txt (text/plain), 4.76 KB, created by
Ayushman Jain
on 2009-11-03 03:58:04 EST
(
hide
)
Description:
proposed fix v0.5 + regression test
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2009-11-03 03:58:04 EST
Size:
4.76 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java,v >retrieving revision 1.64 >diff -u -r1.64 Argument.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 8 Jan 2009 20:51:05 -0000 1.64 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java 3 Nov 2009 08:54:39 -0000 >@@ -54,6 +54,10 @@ > > if (this.binding == null) { > this.binding = new LocalVariableBinding(this, typeBinding, this.modifiers, true); >+ } else if (!this.binding.type.isValidBinding()) { >+ if (scope.referenceMethod().binding != null) { >+ scope.referenceMethod().binding.tagBits |= TagBits.HasUnresolvedArguments; >+ } > } > scope.addLocalVariable(this.binding); > resolveAnnotations(scope, this.annotations, this.binding); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java,v >retrieving revision 1.75 >diff -u -r1.75 MethodDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 22 Sep 2009 14:56:46 -0000 1.75 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java 3 Nov 2009 08:54:40 -0000 >@@ -149,7 +149,8 @@ > if (complianceLevel < ClassFileConstants.JDK1_5) break checkOverride; > int bindingModifiers = this.binding.modifiers; > boolean hasOverrideAnnotation = (this.binding.tagBits & TagBits.AnnotationOverride) != 0; >- if (hasOverrideAnnotation) { >+ boolean hasUnresolvedArguments = (this.binding.tagBits & TagBits.HasUnresolvedArguments) != 0; >+ if (hasOverrideAnnotation && !hasUnresolvedArguments) { > // no static method is considered overriding > if ((bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) > break checkOverride; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java,v >retrieving revision 1.39 >diff -u -r1.39 TagBits.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 18 Sep 2009 14:08:13 -0000 1.39 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 3 Nov 2009 08:54:40 -0000 >@@ -33,6 +33,9 @@ > // for method > long HasUncheckedTypeArgumentForBoundCheck = ASTNode.Bit9; > >+ // set when method has argument(s) that couldn't be resolved >+ long HasUnresolvedArguments = ASTNode.Bit10; >+ > // for the type cycle hierarchy check used by ClassScope > long BeginHierarchyCheck = ASTNode.Bit9; // type > long EndHierarchyCheck = ASTNode.Bit10; // type >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java,v >retrieving revision 1.207 >diff -u -r1.207 AnnotationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 5 Oct 2009 17:46:26 -0000 1.207 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 3 Nov 2009 08:54:47 -0000 >@@ -9249,4 +9249,34 @@ > "", > JavacTestOptions.SKIP); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=293777 >+// To verify that a misleading warning against @Override annotation is not >+// issued in case the method signature has not been resolved properly. >+public void test278() { >+ String testString [] = new String[] { >+ "A.java", >+ "import javax.swing.JComponent;\n" + >+ "public class A extends JComponent {\n" + >+ " @Override\n" + >+ " protected void paintComponent(Graphics g) {" + >+ " }\n" + >+ "}\n" >+ }; >+ String expectedOutput = >+ "----------\n" + >+ "1. WARNING in A.java (at line 2)\n" + >+ " public class A extends JComponent {\n" + >+ " ^\n" + >+ "The serializable class A does not declare a static final serialVersionUID field of type long\n" + >+ "----------\n" + >+ "2. ERROR in A.java (at line 4)\n" + >+ " protected void paintComponent(Graphics g) { }\n" + >+ " ^^^^^^^^\n" + >+ "Graphics cannot be resolved to a type\n" + >+ "----------\n"; >+ this.runNegativeTest( >+ testString, >+ expectedOutput, >+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); >+} > }
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
Flags:
Olivier_Thomann
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 293777
: 151165