Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should Java member enum types be capitalized? [closed]

Anal question here: we have Java enums which are their own classes, and enums which are members of a class:

public enum reportType { ...

Every time I see this it jars me* because when I see it used in a declaration, it's a type, and types should be capitalized. But when I try to capitalize it, Eclipse warns me that I shouldn't capitalize field names. I figure Eclipse probably knows the official Java conventions better than I do, but it just doesn't seem right. Even flipped through the Java conventions doc, but didn't see this issue referenced.

  • no pun intended
like image 790
orbfish Avatar asked Nov 15 '11 22:11

orbfish


2 Answers

Enums are a type and the enum name should start with a capital. Enum members are constants and their text should be all-uppercase.

like image 120
Hovercraft Full Of Eels Avatar answered Sep 30 '22 05:09

Hovercraft Full Of Eels


Even flipped through the Java conventions doc, but didn't see this issue referenced.

The Java conventions doc hasn't been updated in 20+ years. Basically since Java 1.1.

like image 28
Stephen C Avatar answered Sep 30 '22 04:09

Stephen C