As you might see, the number of such warnings has come down from thousands
to hundreds. Some I think we can just continue to fix ad-hoc (like really
long lines), or disable (like not liking variables starting with a capital
letter).

It's an interesting time to discuss the warnings that remain.

1. One common one is "overrideable method called in constructor". This is a
reasonable point.

class A {
  A() {
    stuff();
  }
  void stuff() {
    // important initialization
  }
}

class B extends A {
  void stuff() {
    // mess around and don't initialize
  }
}

B breaks A by subclassing. Making the method or class final solves it, which
is my preferred solution where I do not see any reasonable case for
subclassing. Or, the constructor can be rearranged to call this logic
directly instead of via an overrideable method.


2. Another is complaining about methods that throw 7 or more exceptions.
There are a number like this and it strikes me that it can't really be the
best thing. They could be wrapped in a generic exception, or, in cases where
the caller can't reasonably do anything, try to log and handle the condition
internally.


3. Last one I see a lot is the "really long method" warning. I agree with it
but not sure how much it's worth chopping up methods. Good to think of when
refactoring though.

Reply via email to