Bug 170023 - [quick fix] Add a quick fix for un-initialized final field
Summary: [quick fix] Add a quick fix for un-initialized final field
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 enhancement with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-09 18:10 EST by Zorzella Mising name CLA
Modified: 2012-05-29 04:59 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zorzella Mising name CLA 2007-01-09 18:10:49 EST
If you have a class:

A {
final String b;
}

The compiler will red-underline the class, saying: "The blank final field f may not have been initialized". 

But Eclipse offers no quick fix for that.

There are 3 quick fixes that could be offered:

a) Create constructor initializing final field from param
b) Create constructor initializing final field in body
c) Initialize field

Conversely, if there are constructors, each constructor that does not set "b" will be re-underlined.

In the same vein, these are the possible quick fixes for the constructors:

a) Initialize final field from new constructor param
b) Initialize final field in constructor body
c) Initialize field (only applicable if no constructor has initialized it)
Comment 1 Benno Baumgartner CLA 2008-04-30 04:01:18 EDT
For request about constructor see bug 128023