Skip to content

Commit 594d91b

Browse files
cushonshicks
authored andcommitted
Update Java style guide
1 parent 9fe17f9 commit 594d91b

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

javaguide.html

+21-11
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,8 @@ <h4 id="s4.8.4-switch">4.8.4 Switch statements</h4>
662662
<p class="terminology"><strong>Terminology Note:</strong> Inside the braces of a
663663
<em>switch block</em> are one or more <em>statement groups</em>. Each statement group consists of
664664
one or more <em>switch labels</em> (either <code class="prettyprint lang-java">case FOO:</code> or
665-
<code class="prettyprint lang-java">default:</code>), followed by one or more statements.</p>
665+
<code class="prettyprint lang-java">default:</code>), followed by one or more statements (or, for
666+
the <em>last</em> statement group, <em>zero</em> or more statements).</p>
666667

667668
<h5 id="s4.8.4.1-switch-indentation">4.8.4.1 Indentation</h5>
668669

@@ -705,6 +706,13 @@ <h5 id="s4.8.4.3-switch-default">4.8.4.3 The <code>default</code> case is presen
705706
<p>Each switch statement includes a <code class="prettyprint lang-java">default</code> statement
706707
group, even if it contains no code.</p>
707708

709+
<p><strong>Exception:</strong> A switch statement for an <code>enum</code> type <em>may</em> omit
710+
the <code class="prettyprint lang-java">default</code> statement group, <em>if</em> it includes
711+
explicit cases covering <em>all</em> possible values of that type. This enables IDEs or other static
712+
analysis tools to issue a warning if any cases were missed.
713+
714+
</p>
715+
708716
<a name="annotations"></a>
709717
<h4 id="s4.8.5-annotations">4.8.5 Annotations</h4>
710718

@@ -1053,9 +1061,9 @@ <h3 id="s6.4-finalizers">6.4 Finalizers: not used</h3>
10531061
<p class="tip"><strong>Tip:</strong> Don't do it. If you absolutely must, first read and understand
10541062

10551063

1056-
<a href="http://books.google.com/books?isbn=8131726592"><em>Effective Java</em></a>
1064+
<a href="http://books.google.com/books?isbn=8131726592"><em>Effective Java</em> Item 7,</a>
10571065

1058-
Item 7, "Avoid Finalizers," very carefully, and <em>then</em> don't do it.</p>
1066+
"Avoid Finalizers," very carefully, and <em>then</em> don't do it.</p>
10591067

10601068

10611069
<a name="javadoc"></a>
@@ -1081,22 +1089,24 @@ <h4 id="s7.1.1-javadoc-multi-line">7.1.1 General form</h4>
10811089
<pre class="prettyprint lang-java">/** An especially short bit of Javadoc. */
10821090
</pre>
10831091

1084-
<p>The basic form is always acceptable. The single-line form may be substituted when there are no
1085-
at-clauses present, and the entirety of the Javadoc block (including comment markers) can fit on a
1086-
single line.</p>
1092+
<p>The basic form is always acceptable. The single-line form may be substituted when the entirety
1093+
of the Javadoc block (including comment markers) can fit on a single line. Note that this only
1094+
applies when there are no block tags such as <code>@return</code>.
10871095

1088-
<h4 id="s7.1.2-javadoc-paragraphs">7.1.2 Paragraphs</h4>
1096+
</p><h4 id="s7.1.2-javadoc-paragraphs">7.1.2 Paragraphs</h4>
10891097

10901098
<p>One blank line&#8212;that is, a line containing only the aligned leading asterisk
1091-
(<code>*</code>)&#8212;appears between paragraphs, and before the group of "at-clauses" if
1099+
(<code>*</code>)&#8212;appears between paragraphs, and before the group of block tags if
10921100
present. Each paragraph but the first has <code>&lt;p&gt;</code> immediately before the first word,
10931101
with no space after.</p>
10941102

1095-
<h4 id="s7.1.3-javadoc-at-clauses">7.1.3 At-clauses</h4>
1103+
<a name="s7.1.3-javadoc-at-clauses"></a>
1104+
1105+
<h4 id="s7.1.3-javadoc-block-tags">7.1.3 Block tags</h4>
10961106

1097-
<p>Any of the standard "at-clauses" that are used appear in the order <code>@param</code>,
1107+
<p>Any of the standard "block tags" that are used appear in the order <code>@param</code>,
10981108
<code>@return</code>, <code>@throws</code>, <code>@deprecated</code>, and these four types never
1099-
appear with an empty description. When an at-clause doesn't fit on a single line, continuation lines
1109+
appear with an empty description. When a block tag doesn't fit on a single line, continuation lines
11001110
are indented four (or more) spaces from the position of the <code>@</code>.
11011111
</p>
11021112

0 commit comments

Comments
 (0)