A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/1853 below:

[java] False positive for NonStaticInitializer in anonymous class · Issue #1853 · pmd/pmd · GitHub

Rule: NonStaticInitializer

An instance initializer is the only way to initialize an anonymous class. The alternative is to create a local class with a constructor but quite honestly it's verbose and not that useful.

Test case:

public class Foo {
       public Animation getStatusTransition() {
          return new Transition() {

            {
                setCycleDuration(Duration.millis(1200));
            }

            @Override
            protected void interpolate(double frac) {
               // magic
            }
        };
     }
}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4