Bug 220967

Summary: [compiler] Extra secondary error in presence of missing type
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.4   
Target Milestone: 3.4 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch none

Description Philipe Mulet CLA 2008-02-29 11:43:56 EST
Version: 3.4.0
Build id: I20080227-1100

Minor consequence of bug 196200, the following code now produces 2 errors instead of 1:

import java.util.List;
interface B {
  List<String> m(CharSequence seq);
}
public class X implements B {
	public ArrayList<String> m(CharSequence arg0) {
		return null;
	}


Only error 1 should be surfaced.

----------
1. ERROR in X.java (at line 6)
	public ArrayList<String> m(CharSequence arg0) {
	       ^^^^^^^^^
ArrayList cannot be resolved to a type
----------
2. ERROR in X.java (at line 6)
	public ArrayList<String> m(CharSequence arg0) {
	       ^^^^^^^^^^^^^^^^^
The return type is incompatible with B.m(CharSequence)
----------
Comment 1 Philipe Mulet CLA 2008-02-29 11:51:31 EST
Variation, also produces 2 errors instead of 1:
import java.util.ArrayList;
public class X {
	public List<String> m(ArrayList<String> l) {
		return l;
	}
}
should only complain about missing 'List'
Comment 2 Philipe Mulet CLA 2008-02-29 12:10:06 EST
Other testcase should only report one issue (missing IOException):
import java.util.List;
interface B {
  void m() throws Exception;
}
public class X implements B {
	public void m() throws IOException {
	}
}

currently it also reports incompatibilty between IOException and Exception.
Comment 3 Philipe Mulet CLA 2008-02-29 12:21:58 EST
Added ProblemTypeAndMethod#test078-079
Comment 4 Philipe Mulet CLA 2008-02-29 12:34:29 EST
Created attachment 91213 [details]
Proposed patch
Comment 5 Philipe Mulet CLA 2008-02-29 16:16:06 EST
Released for 3.4M6
Fixed
Comment 6 Frederic Fusier CLA 2008-03-25 13:04:12 EDT
Verified for 3.4M6 using I20080324-1300.