Bug 575133 - [quick fix][code style] Initialize final field quick fix doesn't honor code style
Summary: [quick fix][code style] Initialize final field quick fix doesn't honor code s...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.19   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-30 06:29 EDT by Julian Honnen CLA
Modified: 2023-07-21 19:32 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Honnen CLA 2021-07-30 06:29:21 EDT
I have the following code style configured:

* prefix for fields: "_"
* qualify all generated field accesses with 'this.' = false

Both "initialize final field" quick fixes generate code that doesn't match this configured style in the following example:

public class InitializeField {
	private final String _field;
	public InitializeField() {
	}
}


"Initialize final field '_field' in constructor" produces
	this._field = "";
rather than
	_field = "";

"Initialize final field '_field' to new constructor parameter" produces

	public InitializeField(String _field) {
		this._field = _field;
	}

rather than

	public InitializeField(String field) {
		_field = field;
	}
Comment 1 Eclipse Genie CLA 2023-07-21 19:32:10 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.