Bug 293777

Summary: Misleading problem when @Override is used on method with unresolved parameter type
Product: [Eclipse Project] JDT Reporter: Stefan Kolarov <stefan.kolarov>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, Olivier_Thomann, srikanth_sankaran
Version: 3.6Flags: Olivier_Thomann: review+
Target Milestone: 3.6 M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed fix v0.5 + regression test Olivier_Thomann: iplog+

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