We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e91e8a commit bdc828aCopy full SHA for bdc828a
src/effectivejava/chapter11/item83/Initialization.java
@@ -25,6 +25,7 @@ private static class FieldHolder {
25
// Double-check idiom for lazy initialization of instance fields - Page 334
26
private volatile FieldType field4;
27
28
+ // NOTE: The code for this method in the first printing had a serious error (see errata for details)!
29
private FieldType getField4() {
30
FieldType result = field4;
31
if (result != null) // First check (no locking)
@@ -38,6 +39,7 @@ private FieldType getField4() {
38
39
}
40
41
42
+
43
// Single-check idiom - can cause repeated initialization! - Page 334
44
private volatile FieldType field5;
45
0 commit comments