Bug 293777 - Misleading problem when @Override is used on method with unresolved parameter type
Summary: Misleading problem when @Override is used on method with unresolved parameter...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.6 M4   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-30 08:26 EDT by Stefan Kolarov CLA
Modified: 2010-03-01 14:26 EST (History)
3 users (show)

See Also:
Olivier_Thomann: review+


Attachments
proposed fix v0.5 + regression test (4.76 KB, patch)
2009-11-03 03:58 EST, Ayushman Jain CLA
Olivier_Thomann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Kolarov CLA 2009-10-30 08:26:55 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0
Build Identifier: 20090621-0832

In the text editor, Eclipse reports compile error "The method paintComponent(Graphics) of type OverrideMethodWrongReport must override or implement a supertype method" if java.awt.Graphics is not imported. This can mislead user, who may spend some time double-checking the method spelling. In this case, the missing import for java.awt.Graphics should be reported first.

A code reproducing the problem:
import javax.swing.JComponent;

public class OverrideMethodWrongReport extends JComponent {
	@Override
	protected void paintComponent(Graphics g) { 
		// error message: The method paintComponent(Graphics) of type OverrideMethodWrongReport must override or 
		// implement a supertype method
	}
}

Reproducible: Always

Steps to Reproduce:
1. In Eclipse, Build ID 20090621-0832: create new class OverrideMethodWrongReport and paste the sample code from this bug Details.
2. Enjoy.
3.
Comment 1 Dani Megert CLA 2009-10-30 09:12:04 EDT
Agree. I think we should not even issue an error in case where the signature is not fully resolved.
Comment 2 Ayushman Jain CLA 2009-11-03 03:58:04 EST
Created attachment 151165 [details]
proposed fix v0.5 + regression test

Created a new field TagBits$HasUnresolvedArguments to flag off error in resolution of method arguments. If this flag is set then we dont report override annotation error.
Added regression test AnnotationTest#test278()
Comment 3 Olivier Thomann CLA 2009-11-03 10:33:52 EST
+1.
Refactored the code a bit.
Released for 3.6M4.
Regression test added in:
org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest#test278

Thanks Ayushman.
Comment 4 Srikanth Sankaran CLA 2009-12-08 02:00:06 EST
Verified for 3.6M4 using I20091207-1800