views:

190

answers:

4

I love Eclipse's quickfixes. I use the "assign parameter to new field" often, but I would very much like to tweak it to not include the final keyword. (GWT RPC doesn't serialize final fields, and I am doing lots of GWT RPC right now.)

I have not been able to find a setting that controls this quickfix. Is there a setting I am missing, or do I need to delve into the plugin development docs and make my own, "non final field" quickfix?

I am using Eclipse 3.4

UPDATE - marked the answer about the marker resolution extension point as accepted, as it looks like there is not a baked in config option.

A: 

A not so easy way is to extend the org.eclipse.ui.ide.markerResolution extension point.

<extension point="org.eclipse.ui.ide.markerResolution">
      <markerResolutionGenerator
         markerType="org.eclipse.core.resources.problemmarker"
         class="org.eclipse.escript.quickfix.QuickFixer"/>
</extension>

More information is available in the Eclipse Wiki

Rusty
A: 

You might also want to look into "Poor Man's Quick Fix" (http://www.jave.de/eclipse/poormansquickfix/index.html) plug-in. I used it a while back and it might allow the tweaking you want. I can't guarantee that it still works... sorry.

cjstehno
interesting plugin. sadly, i don't think it will help with my specific problem, because it appears that you can only define new quickfixes for actual compile errors, but i'm not using "assign parameter to new field" to fix an error, just to be lazy. oops. did i say lazy? i meant "efficient". anyways, this might serve as an example to work from when i end up implementing my own quickfix.
Peter Recore
A: 

OK, this is hokey, but:

Quickfix only makes it final if you're working from a constructor's parameter; from a plain function's parameter, it makes it nonfinal. So you could either make the constructor a nonconstructor (change name & give it a return type), or pass all the parameters to a new function and run the quickfix on the function. Then change back to a constructor, or inline the function.

Like I said, hokey, but at least it's easy.

Carl Manaster
A: 

Having switched recently to Eclipse 3.4, I run into the 'final' member problem.

There is a new behavior in Eclipse 3.4, that changes a private member to final (even if you typed it without that keyword) if it is not modifiable (for example, no setter declared ...)

You can probably turn it off...

KLE