Eclipse - quick fix automation

Hello there

Is there any way to automate the application of quick fixes in Eclipse?

The reason I ask: I added the javax.vecmath source code to one of my projects, and it’s simply dripping with things that I’ve set Eclipse to nag me about

  • Unnecessary casts
  • Unused variables
  • Unused methods
  • Malformed / missing javadoc

These are all (apart from the javadoc) things that are fixed automatically by quick-fixes, so I gamely started clicking on each warning icon and applying the appropriate fix. I endured this for about 30 minutes and the number of reported warnings was still at 100, so I gave up, dismayed.
I’ve since changed the compiler settings for that project to be more permissive and reclaimed my pristine errors/warnings list, but I still know that the problems are lurking there, mocking me.

On the subject of vecmath: What’s the deal with the method names?
For Vectors:
a.sub( b ) means a = a - b, as expected
a.sub( b, c ) means a = b - c. Almost identical syntax, significantly different semantics >:(

Seems like the second sub() would usually be a static method and be used like a = VecMath.sub(b,c); but that wouldn’t be as efficient since it would ether create a new object, or to reuse ‘a’, be written VecMath.sub(a,b,c). So the existing method seems like a reasonable thing to do.

Sure, I don’t have a problem with the operation, I just think that it should be called setToSubtraction() or something.
As it is now, anyone quickly reading through code is going to have entirely the wrong impression about what happens, unless they have full knowledge of the VecMath API.
Which is bad.

I don’t see the problem with overloading sub. They do the same thing, and I find the code readable. How badly can you misenterprit the code.

I’d much prefer

VecMath.sub(b,c,a)

, where a is the Vector to place the result.

Its explicit, efficient, and a commonly used practice throughout the java apis.

But they don’t do the same thing. If i see a method called sub() being called on a vector, the most obvious assumption about what is happening is that one of the arguments will be subtracted from it.
In this case, that’s wrong.

Another assumption might be that it will simply modify the state of that vector, and that would be correct. Ultimately I think it comes down to personal preference.

The VecMath.sub(b,c,a) is perhaps less clear about which vector would be modified? At least to me. I would have to check if it is the first or third argument that is the destination. But I do recognize that there is a precedent set in the JRE for using the last argument as a destination.