Bug 206017 - [compiler] Type mistmatch on field declaration should be reported against initialization expression
Summary: [compiler] Type mistmatch on field declaration should be reported against ini...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Maxime Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-11 05:39 EDT by Philipe Mulet CLA
Modified: 2007-12-11 06:59 EST (History)
2 users (show)

See Also:
kent_johnson: review+


Attachments
Fix + test cases (11.22 KB, patch)
2007-10-25 07:35 EDT, Maxime Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2007-10-11 05:39:24 EDT
3.4m2

On following test case, errors are not reported in the same way:
(1) type mismatch is reported against variable declaration ('i' part)
(2) type mismatch is reported against initialization expression

public class X {
  int i = "aaa"; //1
  { 
     i = "bbb"; //2
  }
}

It feels (2) is more appropriate. Variable declarations should be fixed to report the error against the expression instead.
Comment 1 Maxime Daniel CLA 2007-10-25 03:52:44 EDT
The problem is only with fields indeed. Aligning the title.
Comment 2 Maxime Daniel CLA 2007-10-25 07:35:58 EDT
Created attachment 81153 [details]
Fix + test cases
Comment 3 Maxime Daniel CLA 2007-10-25 07:36:30 EDT
Kent, would you please review this one?
Comment 4 Maxime Daniel CLA 2007-11-02 08:24:34 EDT
Released for 3.4 M4.
Comment 5 David Audel CLA 2007-12-11 06:59:58 EST
Verified for 3.4M4 using build I20071210-1800.