Skip to content

Commit fda0e2d

Browse files
committed
Checkstyle and Findbugs changes
Also changed comment callouts from // (1) to // [1]
1 parent 205b794 commit fda0e2d

File tree

146 files changed

+590
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+590
-533
lines changed

Copyright.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright.txt
2-
This computer source code is Copyright ©2016 MindView LLC
2+
This computer source code is Copyright 2016 MindView LLC.
33
All Rights Reserved.
44

55
Permission to use, copy, modify, and distribute this
@@ -16,7 +16,7 @@ personal and commercial software programs.
1616
2. Permission is granted to use the Source Code without
1717
modification in classroom situations, including in
1818
presentation materials, provided that the book "On
19-
Java" is cited as the origin.
19+
Java 8" is cited as the origin.
2020

2121
3. Permission to incorporate the Source Code into printed
2222
media may be obtained by contacting:
@@ -64,9 +64,9 @@ ENHANCEMENTS, OR MODIFICATIONS.
6464

6565
Please note that MindView LLC maintains a Web site which
6666
is the sole distribution point for electronic copies of the
67-
Source Code, https://github.com/BruceEckel/OnJava-Examples,
67+
Source Code, https://github.com/BruceEckel/OnJava8-examples,
6868
where it is freely available under the terms stated above.
6969

7070
If you think you've found an error in the Source Code,
7171
please submit a correction at:
72-
https://github.com/BruceEckel/OnJava-Examples/issues
72+
https://github.com/BruceEckel/OnJava8-examples/issues

ShowFindbugs.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#! py -3
2+
# Requires Python 3.5
3+
# Displays all the Findbugs main.html reports from "On Java 8" on Windows
4+
# Must run "gradlew findbugsMain" first
5+
from pathlib import Path
6+
import os
7+
8+
cmds = ["start " + str(report) for report in Path(".").rglob("main.html")]
9+
(Path(".") / "ShowFindbugs.bat").write_text("\n".join(cmds).strip() + "\n")
10+
os.system("ShowFindbugs.bat")

annotations/AtUnitComposition.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111

1212
public class AtUnitComposition {
1313
AtUnitExample1 testObject = new AtUnitExample1();
14-
@Test boolean _methodOne() {
14+
@Test boolean tMethodOne() {
1515
return
1616
testObject.methodOne().equals("This is methodOne");
1717
}
18-
@Test boolean _methodTwo() {
18+
@Test boolean tMethodTwo() {
1919
return testObject.methodTwo() == 2;
2020
}
2121
}
2222
/* Output:
2323
annotations.AtUnitComposition
24-
. _methodOne
25-
. _methodTwo This is methodTwo
24+
. tMethodOne
25+
. tMethodTwo This is methodTwo
2626
2727
OK (2 tests)
2828
*/

annotations/AtUnitExternalTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
import onjava.*;
1111

1212
public class AtUnitExternalTest extends AtUnitExample1 {
13-
@Test boolean _methodOne() {
13+
@Test boolean tMethodOne() {
1414
return methodOne().equals("This is methodOne");
1515
}
16-
@Test boolean _methodTwo() { return methodTwo() == 2; }
16+
@Test boolean tMethodTwo() { return methodTwo() == 2; }
1717
}
1818
/* Output:
1919
annotations.AtUnitExternalTest
20-
. _methodTwo This is methodTwo
20+
. tMethodTwo This is methodTwo
2121
22-
. _methodOne
22+
. tMethodOne
2323
OK (2 tests)
2424
*/

annotations/HashSetTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ public class HashSetTest {
1414
@Test void initialization() {
1515
assert testObject.isEmpty();
1616
}
17-
@Test void _contains() {
17+
@Test void tContains() {
1818
testObject.add("one");
1919
assert testObject.contains("one");
2020
}
21-
@Test void _remove() {
21+
@Test void tRemove() {
2222
testObject.add("one");
2323
testObject.remove("one");
2424
assert testObject.isEmpty();
2525
}
2626
}
2727
/* Output:
2828
annotations.HashSetTest
29-
. _remove
30-
. _contains
29+
. tRemove
30+
. tContains
3131
. initialization
3232
OK (3 tests)
3333
*/

annotations/SimulatingNull.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
@Target(ElementType.METHOD)
88
@Retention(RetentionPolicy.RUNTIME)
99
public @interface SimulatingNull {
10-
public int id() default -1;
11-
public String description() default "";
10+
int id() default -1;
11+
String description() default "";
1212
}

annotations/StackLStringTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
import onjava.*;
1111

1212
public class StackLStringTest extends StackL<String> {
13-
@Test void _push() {
13+
@Test void tPush() {
1414
push("one");
1515
assert top().equals("one");
1616
push("two");
1717
assert top().equals("two");
1818
}
19-
@Test void _pop() {
19+
@Test void tPop() {
2020
push("one");
2121
push("two");
2222
assert pop().equals("two");
2323
assert pop().equals("one");
2424
}
25-
@Test void _top() {
25+
@Test void tTop() {
2626
push("A");
2727
push("B");
2828
assert top().equals("B");
@@ -31,8 +31,8 @@ public class StackLStringTest extends StackL<String> {
3131
}
3232
/* Output:
3333
annotations.StackLStringTest
34-
. _pop
35-
. _top
36-
. _push
34+
. tPop
35+
. tTop
36+
. tPush
3737
OK (3 tests)
3838
*/

annotations/UseCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
@Target(ElementType.METHOD)
88
@Retention(RetentionPolicy.RUNTIME)
99
public @interface UseCase {
10-
public int id();
11-
public String description() default "no description";
10+
int id();
11+
String description() default "no description";
1212
}

annotations/database/DBTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
@Target(ElementType.TYPE) // Applies to classes only
99
@Retention(RetentionPolicy.RUNTIME)
1010
public @interface DBTable {
11-
public String name() default "";
11+
String name() default "";
1212
}

annotations/database/Uniqueness.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
public @interface Uniqueness {
99
Constraints constraints()
10-
default @Constraints(unique = true);
10+
default @Constraints(unique = true);
1111
}

0 commit comments

Comments
 (0)