== Why is this an issue? In Java, an enum is a special data type that allows you to define a set of constants. Nested enum types, also known as inner enum types, are enum types that are defined within another class or interface. Nested enum types are implicitly static, so there is no need to declare them `static` explicitly. === Noncompliant code example [source,java,diff-id=1,diff-type=noncompliant] ---- public class Flower { static enum Color { // Noncompliant; static is redundant here RED, YELLOW, BLUE, ORANGE } // ... } ---- === Compliant solution [source,java,diff-id=1,diff-type=compliant] ---- public class Flower { enum Color { // Compliant RED, YELLOW, BLUE, ORANGE } // ... } ---- == Resources * https://docs.oracle.com/javase/specs/jls/se20/html/jls-8.html#jls-8.9[Java Language Specification-8.9] ifdef::env-github,rspecator-view[] ''' == Implementation Specification (visible only on this page) === Message Remove this redundant "static" qualifier; nested enum types are implicitly static. === Highlighting Primary Location: the 'static' keyword Secondary Location: the 'enum' keyword ''' == Comments And Links (visible only on this page) === on 31 Mar 2015, 15:09:56 Nicolas Peru wrote: \[~ann.campbell.2]could be nice to add a link or a quote from the jls : \http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9 ____ Nested enum types are implicitly static. It is permissible to explicitly declare a nested enum type to be static. ____ === on 31 Mar 2015, 17:46:06 Ann Campbell wrote: \[~nicolas.peru] why would we quote the docs as saying it's permissible to do exactly what this rule says not to do? === on 1 Apr 2015, 08:42:30 Nicolas Peru wrote: Then let's just keep the first part of the sentence : ____ Nested enum types are implicitly static. ____ point is to refer to the correct section of the JLS to let user know we did not invent this. === on 1 Apr 2015, 17:06:42 Ann Campbell wrote: Done [~nicolas.peru] endif::env-github,rspecator-view[]