Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.

This commit is contained in:
Ilkka Seppala
2015-12-25 23:49:28 +02:00
parent 9fbb085985
commit cec9a99410
167 changed files with 1242 additions and 969 deletions

View File

@ -8,7 +8,7 @@ public final class IvoryTower {
/**
* Static to class instance of the class.
*/
private static final IvoryTower instance = new IvoryTower();
private static final IvoryTower INSTANCE = new IvoryTower();
/**
* Private constructor so nobody can instantiate the class.
@ -21,6 +21,6 @@ public final class IvoryTower {
* @return instance of the singleton.
*/
public static IvoryTower getInstance() {
return instance;
return INSTANCE;
}
}

View File

@ -11,14 +11,14 @@ package com.iluwatar.singleton;
*/
public class ThreadSafeDoubleCheckLocking {
private static volatile ThreadSafeDoubleCheckLocking INSTANCE;
private static volatile ThreadSafeDoubleCheckLocking instance;
/**
* private constructor to prevent client from instantiating.
*/
private ThreadSafeDoubleCheckLocking() {
// to prevent instantiating by Reflection call
if (INSTANCE != null) {
if (instance != null) {
throw new IllegalStateException("Already initialized.");
}
}
@ -31,12 +31,12 @@ public class ThreadSafeDoubleCheckLocking {
public static ThreadSafeDoubleCheckLocking getInstance() {
// local variable increases performance by 25 percent
// Joshua Bloch "Effective Java, Second Edition", p. 283-284
ThreadSafeDoubleCheckLocking result = INSTANCE;
ThreadSafeDoubleCheckLocking result = instance;
if (result == null) {
synchronized (ThreadSafeDoubleCheckLocking.class) {
result = INSTANCE;
result = instance;
if (result == null) {
INSTANCE = result = new ThreadSafeDoubleCheckLocking();
instance = result = new ThreadSafeDoubleCheckLocking();
}
}
}

View File

@ -16,7 +16,7 @@ public class ThreadSafeLazyLoadedIvoryTower {
/**
* The instance gets created only when it is called for first time. Lazy-loading
*/
public synchronized static ThreadSafeLazyLoadedIvoryTower getInstance() {
public static synchronized ThreadSafeLazyLoadedIvoryTower getInstance() {
if (instance == null) {
instance = new ThreadSafeLazyLoadedIvoryTower();