Skip to content

Commit

Permalink
8251888: Move HotSpot Style Guide wiki subpages to jdk/jdk/doc
Browse files Browse the repository at this point in the history
Copy unit-test page from wiki, merge jtreg names page into hotspot-style.md

Reviewed-by: kvn, iignatyev
  • Loading branch information
Kim Barrett committed Aug 19, 2020
1 parent b328bc1 commit 9fc76c2
Show file tree
Hide file tree
Showing 4 changed files with 705 additions and 3 deletions.
14 changes: 12 additions & 2 deletions doc/hotspot-style.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ <h1 class="title">HotSpot Coding Style</h1>
</ul></li>
<li><a href="#structure-and-formatting">Structure and Formatting</a><ul>
<li><a href="#factoring-and-class-design">Factoring and Class Design</a></li>
<li><a href="#files">Files</a></li>
<li><a href="#source-files">Source Files</a></li>
<li><a href="#jtreg-tests">JTReg Tests</a></li>
<li><a href="#naming">Naming</a></li>
<li><a href="#commenting">Commenting</a></li>
<li><a href="#macros">Macros</a></li>
Expand Down Expand Up @@ -87,7 +88,7 @@ <h3 id="factoring-and-class-design">Factoring and Class Design</h3>
<li><p>Don't use the Copy and Paste keys to replicate more than a couple lines of code. Name what you must repeat.</p></li>
<li><p>If a class needs a member function to change a user-visible attribute, the change should be done with a &quot;setter&quot; accessor matched to the simple &quot;getter&quot;.</p></li>
</ul>
<h3 id="files">Files</h3>
<h3 id="source-files">Source Files</h3>
<ul>
<li><p>All source files must have a globally unique basename. The build system depends on this uniqueness.</p></li>
<li><p>Do not put non-trivial function implementations in .hpp files. If the implementation depends on other .hpp files, put it in a .cpp or a .inline.hpp file.</p></li>
Expand All @@ -97,6 +98,15 @@ <h3 id="files">Files</h3>
<li><p>Keep the include lines alphabetically sorted.</p></li>
<li><p>Put conditional inclusions (<code>#if ...</code>) at the end of the include list.</p></li>
</ul>
<h3 id="jtreg-tests">JTReg Tests</h3>
<ul>
<li><p>JTReg tests should have meaningful names.</p></li>
<li><p>JTReg tests associated with specific bugs should be tagged with the <code>@bug</code> keyword in the test description.</p></li>
<li><p>JTReg tests should be organized by component or feature under <code>test/</code>, in a directory hierarchy that generally follows that of the <code>src/</code> directory. There may be additional subdirectories to further categorize tests by feature. This structure makes it easy to run a collection of tests associated with a specific feature by specifying the associated directory as the source of the tests to run.</p>
<ul>
<li>Some (older) tests use the associated bug number in the directory name, the test name, or both. That naming style should no longer be used, with existing tests using that style being candidates for migration.</li>
</ul></li>
</ul>
<h3 id="naming">Naming</h3>
<ul>
<li><p>The length of a name may be correlated to the size of its scope. In particular, short names (even single letter names) may be fine in a small scope, but are usually inappropriate for larger scopes.</p></li>
Expand Down
20 changes: 19 additions & 1 deletion doc/hotspot-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ lines of code. Name what you must repeat.
change should be done with a "setter" accessor matched to the simple
"getter".

### Files
### Source Files

* All source files must have a globally unique basename. The build
system depends on this uniqueness.
Expand All @@ -147,6 +147,24 @@ it to resolve include problems.

* Put conditional inclusions (`#if ...`) at the end of the include list.

### JTReg Tests

* JTReg tests should have meaningful names.

* JTReg tests associated with specific bugs should be tagged with the
`@bug` keyword in the test description.

* JTReg tests should be organized by component or feature under
`test/`, in a directory hierarchy that generally follows that of the
`src/` directory. There may be additional subdirectories to further
categorize tests by feature. This structure makes it easy to run a
collection of tests associated with a specific feature by specifying
the associated directory as the source of the tests to run.

* Some (older) tests use the associated bug number in the directory
name, the test name, or both. That naming style should no longer be
used, with existing tests using that style being candidates for migration.

### Naming

* The length of a name may be correlated to the size of its scope. In
Expand Down
Loading

0 comments on commit 9fc76c2

Please sign in to comment.