Bug 170023

Summary: [quick fix] Add a quick fix for un-initialized final field
Product: [Eclipse Project] JDT Reporter: Zorzella Mising name <zorzella>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: benno.baumgartner, mlists, ruediger.herrmann
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

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