This has been said before: Protected variables are evil (blog post gone). But apparently as I’ve been doing some debugging into the Eclipse code I’m reminded it needs saying again. Let’s suppose we write a base class public class SimpleBase { protected Object value = new Integer(10); public printValue() { system.out.println(value.toString()); […]
Eclipse
Don’t call overridable methods in constructors
MS has a rule about this in FxCop. PMD has a rule: ConstructorCallsOverridableMethod. In both cases the point is to discourage the following weird behaviour. From Eclipse: public abstract class CellEditor { protected CellEditor(Composite parent, int style) { this.style = style; System.out.println(“CellEditor constructor”); create(parent); } […]