File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -145,33 +145,35 @@ public enum AlternativeBool {
145145 public abstract String getGermanName ();
146146}
147147```
148- ** Advantages**
148+
149+ * Advantages*
149150* this approach does not need an annotation processor
150151* you also get a compile-time error should you forget to implement a method for a new enum
151152
152- ** Disadvantages* *
153+ * Disadvantages*
153154* it is quite verbose
154155* you can only use this for enums that you control
155156
156157#### IDE checks
157158Some IDEs allow you to activate a check that will warn you when you forget an enum constant in a switch statement:
158159* [ Eclipse: Ensuring completeness of switch statements] ( http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-ensuring_switch_completeness.htm )
159160
160- ** Advantages* *
161+ * Advantages*
161162* this approach does not need an annotation processor
162163* direct and immediate feedback
163164
164- ** Disadvantages* *
165+ * Disadvantages*
165166* you could forget to active the switch
166167* someone members of your team may use other IDEs which don't support this feature
167168
168169#### Other tools
169170For example [ FindBugs] ( http://findbugs.sourceforge.net/ ) has a check * Switch statement found where default case is missing*
170171[ SF_SWITCH_NO_DEFAULT] ( http://findbugs.sourceforge.net/bugDescriptions.html#SF_SWITCH_NO_DEFAULT )
171- ** Advantages**
172+
173+ * Advantages*
172174* other tools may offer way more functionality
173175
174- ** Disadvantages* *
176+ * Disadvantages*
175177* those are other tools that you must learn to use and maintain
176178
177179
You can’t perform that action at this time.
0 commit comments