A class can be created in a static context without being declared static, and this is what is happening here. Let's look at what being declared static, and created in a static context means:
The difference between an anonymous class created in a static context and a non-static context is whether it has an enclosing instance:
If C is an anonymous class, then:
If the class instance creation expression occurs in a static context, then i has no immediately enclosing instance.
Otherwise, the immediately enclosing instance of i is this.
A nested class that is declared static allows static members:
An inner class is a nested class that is not explicitly or implicitly declared static.
A nested class that is not an inner class may declare static members
freely, in accordance with the usual rules of the Java programming
language.
By saying a nested class that is 'implicity declared static', it refers to things like classes within interfaces:
A member class of an interface is implicitly static (§9.5) so is never
considered to be an inner class.
Anonymous classes are not declared static (neither explicitly with a keyword, or implicitly such as being inside an interface), and so do not allow the declaration of static members. They can however be created within a static context, which means that they don't refer to an enclosing instance.
Because the anonymous classes are not declared static, both quotes in the question are consistent.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…