Should work with JDK8 now

This commit is contained in:
Bruce Eckel 2020-10-06 16:06:14 -06:00
parent 7fb818dc24
commit c7a29b9b47
6 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,5 @@
// Copyright.txt // Copyright.txt
This computer source code is Copyright ©2017 MindView LLC. This computer source code is Copyright ©2020 MindView LLC.
All Rights Reserved. All Rights Reserved.
Permission to use, copy, modify, and distribute this Permission to use, copy, modify, and distribute this

View File

@ -18,8 +18,7 @@ public class NotAtomic {
public NotAtomic(); public NotAtomic();
Code: Code:
0: aload_0 0: aload_0
1: invokespecial #1 // Method 1: invokespecial #1 // Method java/lang/Object."<init>":()V
java/lang/Object."<init>":()V
4: return 4: return
void f1(); void f1();

View File

@ -8,8 +8,8 @@ interface Resource {
void setValue(int x); void setValue(int x);
} }
// Since this isn't inherited from a Cloneable // This isn't inherited from a Cloneable
// base class and cloneability isn't added, // base class and cloneability isn't added so
// making it final prevents cloneability from // making it final prevents cloneability from
// being added through inheritance. This also // being added through inheritance. This also
// implements thread-safe lazy initialization: // implements thread-safe lazy initialization:

View File

@ -2,7 +2,7 @@
# (c)2017 MindView LLC: see Copyright.txt # (c)2017 MindView LLC: see Copyright.txt
# We make no guarantees that this code is fit for any purpose. # We make no guarantees that this code is fit for any purpose.
# Visit http://OnJava8.com for more book information. # Visit http://OnJava8.com for more book information.
# Speaking pets without base classes #- Speaking pets without base classes
class Cat: class Cat:
def speak(self): def speak(self):

View File

@ -2,7 +2,7 @@
# (c)2017 MindView LLC: see Copyright.txt # (c)2017 MindView LLC: see Copyright.txt
# We make no guarantees that this code is fit for any purpose. # We make no guarantees that this code is fit for any purpose.
# Visit http://OnJava8.com for more book information. # Visit http://OnJava8.com for more book information.
# Speaking pets in Python #- Speaking pets in Python
class Pet: class Pet:
def speak(self): pass def speak(self): pass

View File

@ -22,7 +22,7 @@ public class StringInverterTests {
} }
@Test @Test
void basicInversion2() { void basicInversion2() {
expectThrows(Error.class, () -> { assertThrows(Error.class, () -> {
assertEquals(inverter.invert("X"), "X"); assertEquals(inverter.invert("X"), "X");
}); });
} }
@ -52,7 +52,7 @@ public class StringInverterTests {
void lengthNoGreaterThan30() { void lengthNoGreaterThan30() {
String str = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; String str = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
assertTrue(str.length() > 30); assertTrue(str.length() > 30);
expectThrows(RuntimeException.class, () -> { assertThrows(RuntimeException.class, () -> {
inverter.invert(str); inverter.invert(str);
}); });
} }