I had a look at the jsr-231 code and everything seems fine to me (for what that’s worth
). The only tiny thing I don’t agree with is the inheritance relationship between Animator and FPSAnimator. The only thing they share is the fact that they both hold a list of GLAutoDrawable. FPSAnimator overrides start and stop without calling the super implementation, it does not use the sync method and does not make use of the ignore and print exceptions flags. To me these are bad code smells. Personally I would make an AbstractAnimator that has the drawables list, ignore and print exception flags and a protected method containing the draw code
protected void displayDrawables() {
Iterator iter = drawableIterator();
while (iter.hasNext()) {
GLAutoDrawable drawable = (GLAutoDrawable) iter.next();
try {
drawable.display();
} catch (RuntimeException e) {
if (ignoreExceptions) {
if (printExceptions) {
e.printStackTrace();
}
} else {
throw(e);
}
}
}
}
Or if you’re a delegation fan do the same thing with an AnimatorSupport class to which Animator and FPSAnimator delegate.
I don’t know what the general policy is on output, but it might also be interesting to use the logging api instead of Exception#printStackTrace().