Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to turn off 'final' completion in 3.7
How to turn off 'final' completion in 3.7 [message #665029] Tue, 12 April 2011 23:24 Go to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Hi,

Apologies if this has been addressed before (by me?) but Indigo seems to have introduced a feature "improvement" where 'final' keyword is inserted automatically in newly created fields and variables. FWIW, I think the change is forcing a default behavior that might be "safest" but is really annoying to deal with during development, especially when prototyping code. But more importantly I can't figure out how to turn it off! I'm sure it's somewhere obvious, but I've looked in proposals, templates code styles, etc.. but no luck.

thanks,

Miles
Re: How to turn off 'final' completion in 3.7 [message #665032 is a reply to message #665029] Wed, 13 April 2011 00:36 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 4/13/2011 4:54 AM, Miles Parker wrote:
> Hi,
>
> Apologies if this has been addressed before (by me?) but Indigo seems to
> have introduced a feature "improvement" where 'final' keyword is
> inserted automatically in newly created fields and variables. FWIW, I
> think the change is forcing a default behavior that might be "safest"
> but is really annoying to deal with during development, especially when
> prototyping code. But more importantly I can't figure out how to turn it
> off! I'm sure it's somewhere obvious, but I've looked in proposals,
> templates code styles, etc.. but no luck.
>
> thanks,
>
> Miles

I think you have enabled 'Use final where possible' cleanup (the cleanup
is not new in Indigo).

Preferences > Java > Code Style > Clean Up --> Edit --> Code style tab
Re: How to turn off 'final' completion in 3.7 [message #665033 is a reply to message #665032] Wed, 13 April 2011 00:46 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Deepak Azad wrote on Tue, 12 April 2011 20:36


I think you have enabled 'Use final where possible' cleanup (the cleanup
is not new in Indigo).

Preferences > Java > Code Style > Clean Up --> Edit --> Code style tab


Hi Deepak,

Thanks for the idea. I just checked and that is not enabled. I also get the same thing happening with the default Eclipse clean profile. Just as a sanity check, what happens for you in Indigo when you use proposals? For example:

a) Add a parameter to a constructor
b) Choose the "Assign Parameter to new Field" proposal.

I end up with:

private final boolean something;

Whereas previously I'd get:

private boolean something;

thanks,

Miles
Re: How to turn off 'final' completion in 3.7 [message #665035 is a reply to message #665033] Wed, 13 April 2011 01:53 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 4/13/2011 6:16 AM, Miles Parker wrote:
> Deepak Azad wrote on Tue, 12 April 2011 20:36
>> I think you have enabled 'Use final where possible' cleanup (the
>> cleanup is not new in Indigo).
>>
>> Preferences > Java > Code Style > Clean Up --> Edit --> Code style tab
>
>
> Hi Deepak,
>
> Thanks for the idea. I just checked and that is not enabled. I also get
> the same thing happening with the default Eclipse clean profile. Just as
> a sanity check, what happens for you in Indigo when you use proposals?
> For example:
>
> a) Add a parameter to a constructor
> b) Choose the "Assign Parameter to new Field" proposal.
>
> I end up with:
>
> private final boolean something;
>
> Whereas previously I'd get:
>
> private boolean something;
>
> thanks,
>
> Miles
>

Ok, I see it now. "Assign Parameter to new Field" when invoked from a
constructor does insert a final, but not when invoked from a method.
However this is not new in 3.7, it works the same way in 3.6 as well.

Miles, you can open a bug with JDT/UI if you want something done here..
Re: How to turn off 'final' completion in 3.7 [message #665037 is a reply to message #665035] Wed, 13 April 2011 02:37 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1341
Registered: July 2009
Senior Member
Deepak Azad wrote on Tue, 12 April 2011 21:53

Ok, I see it now. "Assign Parameter to new Field" when invoked from a
constructor does insert a final, but not when invoked from a method.
However this is not new in 3.7, it works the same way in 3.6 as well.

Miles, you can open a bug with JDT/UI if you want something done here..


Yes, there seem to be a few of these that seem somewhat arbitrary. Though it wouldn't make much sense to mark a method field variable as final. Wink I wonder if I didn't have something configured differently in all of my 3.6 installs, or perhaps I'm just remembering incorrectly. I'll revisit the bug situation. Before I do that, it's your understanding as well that there isn't any way to turn this behavior off?

I'm asking because I'm still not sure where this is setup; if it is part of user configurables or if it is something hard-wired. In the former case that wouldn't be bug-worthy.
Re: How to turn off 'final' completion in 3.7 [message #665045 is a reply to message #665037] Wed, 13 April 2011 04:34 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 4/13/2011 8:07 AM, Miles Parker wrote:
> Yes, there seem to be a few of these that seem somewhat arbitrary.
> Though it wouldn't make much sense to mark a method field variable as
> final. ;) I wonder if I didn't have something configured differently in
> all of my 3.6 installs, or perhaps I'm just remembering incorrectly.
> I'll revisit the bug situation. Before I do that, it's your
> understanding as well that there isn't any way to turn this behavior off?
>
> I'm asking because I'm still not sure where this is setup; if it is part
> of user configurables or if it is something hard-wired. In the former
> case that wouldn't be bug-worthy.

Nope, there is no way to configure this behavior. (In general you cannot
really configure behavior of a quick fix/assist.)
Re: How to turn off 'final' completion in 3.7 [message #667779 is a reply to message #665045] Mon, 02 May 2011 07:52 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 13.04.2011 06:34, Deepak Azad wrote:
> On 4/13/2011 8:07 AM, Miles Parker wrote:
>> Yes, there seem to be a few of these that seem somewhat arbitrary.
>> Though it wouldn't make much sense to mark a method field variable as
>> final. ;) I wonder if I didn't have something configured differently in
>> all of my 3.6 installs, or perhaps I'm just remembering incorrectly.
>> I'll revisit the bug situation. Before I do that, it's your
>> understanding as well that there isn't any way to turn this behavior
>> off?
>>
>> I'm asking because I'm still not sure where this is setup; if it is part
>> of user configurables or if it is something hard-wired. In the former
>> case that wouldn't be bug-worthy.
>
> Nope, there is no way to configure this behavior. (In general you
> cannot really configure behavior of a quick fix/assist.)
See https://bugs.eclipse.org/130922

Dani
Previous Topic:Exporting JAR with unsaved files in unrelated projects
Next Topic:Cant open Eclipse 3.4 (Blackberry Eclipse) in windows
Goto Forum:
  


Current Time: Tue Mar 19 08:15:37 GMT 2024

Powered by FUDForum. Page generated in 0.02537 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top