Hi!

I've been reading the book "Effective Java" by Joshua Bloch where he gives
some tips about how to write "better" Java code. While reading this, I
thought to myself that it would be nice if IDEA could check this stuff for
me... so I'll write up a few of the points I think would be possible to
check automatically:

Warn if hashCode() is not implemented where equals() is.
Find abstract classes that can be turned into interfaces (don't implement
any method or all methods are overridden in all subclasses)
Make sure objects are referred by their interfaces where possible.
No empty catch blocks
Warn for confusing overloadings; e.g. foo(int, String) and foo(String, int)
in same class
Don't call overridable methods from constructors
Don't make methods overridable unless necessary
Make sure clone() and readObject() don't invoke an overridable method
Return zero length arrays, not nulls.
etc...

There are more points in his book, but those are the ones that spring to
mind.

I don't want to go into all the why's for these "rules" but just point out
that the book covers those points very well.

regards,

Gauti





_______________________________________________
Eap-features mailing list
[EMAIL PROTECTED]
http://www.intellij.com/mailman/listinfo/eap-features

Reply via email to