Java has a concept of anonymous classes which can look something like this:
1: @Test 2: public void watch(Observable o) { 3: @NonNull 4: Observer obs = new Observer() { 5: public void update(Observable o, Object arg) { 6: history.addElement(arg); 7: } 8: }; 9: o.addObserver(obs); 10: }
The brace following the new
operator opens the anonymous class.
Lines 5 and 8 are assigned the inexpr-class
syntax, besides the
inclass
symbol used in normal classes. Thus, the class will be
indented just like a normal class, with the added indentation given to
inexpr-class
. An inexpr-class
syntactic element doesn’t
have an anchor position.
Line 2 is assigned the annotation-top-cont
syntax, due to it being a
continuation of a topmost introduction with an annotation symbol preceding
the current line. Similarly, line 4 is assigned the annotation-var-cont
syntax due to it being a continuation of a variable declaration where preceding
the declaration is an annotation.