Skip to content

Commit 065ca39

Browse files
committed
CheckStyle: Fix name violations
1 parent fc08e99 commit 065ca39

File tree

125 files changed

+1431
-1397
lines changed

Some content is hidden

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

125 files changed

+1431
-1397
lines changed

src/main/java/com/laytonsmith/PureUtilities/ArgumentParser.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -949,17 +949,17 @@ static List<String> lex(String args) {
949949
//First, we have to tokenize the strings. Since we can have quoted arguments, we can't simply split on spaces.
950950
List<String> arguments = new ArrayList<String>();
951951
StringBuilder buf = new StringBuilder();
952-
boolean state_in_single_quote = false;
953-
boolean state_in_double_quote = false;
952+
boolean stateInSingleQuote = false;
953+
boolean stateInDoubleQuote = false;
954954
for(int i = 0; i < args.length(); i++) {
955955
Character c0 = args.charAt(i);
956956
Character c1 = i + 1 < args.length() ? args.charAt(i + 1) : null;
957957

958958
if(c0 == '\\') {
959-
if(c1 == '\'' && state_in_single_quote
960-
|| c1 == '"' && state_in_double_quote
961-
|| c1 == ' ' && !state_in_double_quote && !state_in_single_quote
962-
|| c1 == '\\' && (state_in_double_quote || state_in_single_quote)) {
959+
if(c1 == '\'' && stateInSingleQuote
960+
|| c1 == '"' && stateInDoubleQuote
961+
|| c1 == ' ' && !stateInDoubleQuote && !stateInSingleQuote
962+
|| c1 == '\\' && (stateInDoubleQuote || stateInSingleQuote)) {
963963
//We are escaping the next character. Add it to the buffer instead, and
964964
//skip ahead two
965965
buf.append(c1);
@@ -970,7 +970,7 @@ static List<String> lex(String args) {
970970
}
971971

972972
if(c0 == ' ') {
973-
if(!state_in_double_quote && !state_in_single_quote) {
973+
if(!stateInDoubleQuote && !stateInSingleQuote) {
974974
//argument split
975975
if(buf.length() != 0) {
976976
arguments.add(buf.toString());
@@ -979,31 +979,31 @@ static List<String> lex(String args) {
979979
continue;
980980
}
981981
}
982-
if(c0 == '\'' && !state_in_double_quote) {
983-
if(state_in_single_quote) {
984-
state_in_single_quote = false;
982+
if(c0 == '\'' && !stateInDoubleQuote) {
983+
if(stateInSingleQuote) {
984+
stateInSingleQuote = false;
985985
arguments.add(buf.toString());
986986
buf = new StringBuilder();
987987
} else {
988988
if(buf.length() != 0) {
989989
arguments.add(buf.toString());
990990
buf = new StringBuilder();
991991
}
992-
state_in_single_quote = true;
992+
stateInSingleQuote = true;
993993
}
994994
continue;
995995
}
996-
if(c0 == '"' && !state_in_single_quote) {
997-
if(state_in_double_quote) {
998-
state_in_double_quote = false;
996+
if(c0 == '"' && !stateInSingleQuote) {
997+
if(stateInDoubleQuote) {
998+
stateInDoubleQuote = false;
999999
arguments.add(buf.toString());
10001000
buf = new StringBuilder();
10011001
} else {
10021002
if(buf.length() != 0) {
10031003
arguments.add(buf.toString());
10041004
buf = new StringBuilder();
10051005
}
1006-
state_in_double_quote = true;
1006+
stateInDoubleQuote = true;
10071007
}
10081008
continue;
10091009
}

src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassDiscoveryURLCache.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,36 @@ public ClassDiscoveryURLCache(URL url, ProgressIterator progress) {
6363
* @throws java.lang.ClassNotFoundException
6464
*/
6565
public ClassDiscoveryURLCache(URL url, InputStream descriptor) throws IOException, ClassNotFoundException {
66-
List<ClassMirror<?>> _list;
66+
List<ClassMirror<?>> list;
6767
ObjectInputStream ois = new ObjectInputStream(descriptor);
6868
try {
69-
_list = (List<ClassMirror<?>>) ois.readObject();
69+
list = (List<ClassMirror<?>>) ois.readObject();
7070
} catch (ClassNotFoundException ex) {
7171
if(url != null) {
7272
//We can recover from this one, but it won't be instant.
73-
_list = new ClassDiscoveryURLCache(url).list;
73+
list = new ClassDiscoveryURLCache(url).list;
7474
} else {
7575
throw ex;
7676
}
7777
}
7878
ois.close();
7979

80-
for(ClassMirror m : _list) {
80+
for(ClassMirror m : list) {
8181
ReflectionUtils.set(ClassMirror.class, m, "originalURL", url);
8282
}
8383

84-
this.list = _list;
84+
this.list = list;
8585
}
8686

8787
public void writeDescriptor(OutputStream out) throws IOException {
8888
ObjectOutputStream oos = new ObjectOutputStream(out);
89-
oos.writeObject(list);
89+
oos.writeObject(this.list);
9090
oos.close();
9191
}
9292

9393
@Override
9494
public String toString() {
95-
return "[" + ClassDiscoveryURLCache.class.getSimpleName() + ": " + list.size() + "]";
95+
return "[" + ClassDiscoveryURLCache.class.getSimpleName() + ": " + this.list.size() + "]";
9696
}
9797

9898
/**

src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/ClassMirrorVisitor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
160160
for(Type type : Type.getArgumentTypes(desc)) {
161161
parameterMirrors.add(new ClassReferenceMirror(type.getDescriptor()));
162162
}
163-
AbstractMethodMirror _methodMirror;
163+
AbstractMethodMirror methodMirror;
164164
if(ConstructorMirror.INIT.equals(name)) {
165-
_methodMirror = new ConstructorMirror(
165+
methodMirror = new ConstructorMirror(
166166
classInfo.classReferenceMirror,
167167
new ModifierMirror(ModifierMirror.Type.METHOD, access),
168168
new ClassReferenceMirror(Type.getReturnType(desc).getDescriptor()),
@@ -172,7 +172,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
172172
(access & ACC_SYNTHETIC) == ACC_SYNTHETIC
173173
);
174174
} else {
175-
_methodMirror = new MethodMirror(
175+
methodMirror = new MethodMirror(
176176
classInfo.classReferenceMirror,
177177
new ModifierMirror(ModifierMirror.Type.METHOD, access),
178178
new ClassReferenceMirror(Type.getReturnType(desc).getDescriptor()),
@@ -182,22 +182,22 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
182182
(access & ACC_SYNTHETIC) == ACC_SYNTHETIC
183183
);
184184
}
185-
final AbstractMethodMirror methodMirror = _methodMirror;
185+
final AbstractMethodMirror finalMethodMirror = methodMirror;
186186
return new MethodVisitor(ASM5, super.visitMethod(access, name, desc, signature, exceptions)) {
187187
@Override
188188
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
189189
final AnnotationMirror annotationMirror = new AnnotationMirror(new ClassReferenceMirror<>(desc), visible);
190190
return new AnnotationMirrorVisitor(super.visitAnnotation(desc, visible), annotationMirror) {
191191
@Override
192192
public void visitEnd() {
193-
methodMirror.addAnnotation(annotationMirror);
193+
finalMethodMirror.addAnnotation(annotationMirror);
194194
}
195195
};
196196
}
197197

198198
@Override
199199
public void visitEnd() {
200-
classInfo.methods.add(methodMirror);
200+
classInfo.methods.add(finalMethodMirror);
201201
super.visitEnd();
202202
}
203203
};

src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/FieldMirror.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ public class FieldMirror extends AbstractElementMirror {
2020
*/
2121
public FieldMirror(Field field) {
2222
super(field);
23-
Object _value = null;
23+
Object value = null;
2424
try {
25-
_value = field.get(null);
25+
value = field.get(null);
2626
} catch (IllegalArgumentException | IllegalAccessException ex) {
2727
//
2828
}
29-
this.value = _value;
29+
this.value = value;
3030
}
3131

3232
/**

src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/ModifierMirror.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class ModifierMirror implements Serializable {
1919
/**
2020
* This is the canonical order of modifiers, used in the toString method.
2121
*/
22-
private static final transient Object[] order = new Object[]{
22+
private static final transient Object[] ORDER = new Object[]{
2323
Modifier.PUBLIC, "public",
2424
Modifier.PRIVATE, "private",
2525
Modifier.PROTECTED, "protected",
@@ -246,9 +246,9 @@ public int getModifiers() {
246246
@Override
247247
public String toString() {
248248
List<String> build = new ArrayList<String>();
249-
for(int i = 0; i < order.length; i++) {
250-
int type = (Integer) order[i];
251-
String name = (String) order[++i];
249+
for(int i = 0; i < ORDER.length; i++) {
250+
int type = (Integer) ORDER[i];
251+
String name = (String) ORDER[++i];
252252
if((modifiers & type) > 0) {
253253
build.add(name);
254254
}

src/main/java/com/laytonsmith/PureUtilities/CommandExecutor.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ public void write(int next) throws IOException {
5151
c.setSystemOut(os);
5252
c.start();
5353
c.waitFor();
54-
Byte[] Bytes = new Byte[output.size()];
5554
byte[] bytes = new byte[output.size()];
56-
Bytes = output.toArray(Bytes);
57-
for(int i = 0; i < Bytes.length; i++) {
58-
bytes[i] = Bytes[i];
55+
for(int i = 0; i < output.size(); i++) {
56+
bytes[i] = output.get(i).byteValue();
5957
}
6058

6159
return new String(bytes, "UTF-8");

src/main/java/com/laytonsmith/PureUtilities/Common/Annotations/AnnotationChecks.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ public static void checkForTypeInTypeofClasses() throws Exception {
3232
for(ClassMirror<?> clazz : classes) {
3333
try {
3434
// Make sure that TYPE has the same type as the typeof annotation
35-
CClassType TYPE = (CClassType) ReflectionUtils.get(clazz.loadClass(), "TYPE");
36-
if(TYPE == null) {
35+
CClassType type = (CClassType) ReflectionUtils.get(clazz.loadClass(), "TYPE");
36+
if(type == null) {
3737
errors.add("TYPE is null? " + clazz.getClassName());
3838
continue;
3939
}
40-
if(!TYPE.val().equals(clazz.getAnnotation(typeof.class).getValue("value"))) {
40+
if(!type.val().equals(clazz.getAnnotation(typeof.class).getValue("value"))) {
4141
errors.add(clazz.getClassName() + "'s TYPE value is different than the typeof annotation on it");
4242
}
4343
} catch (ReflectionUtils.ReflectionException ex) {

src/main/java/com/laytonsmith/PureUtilities/Common/Annotations/CheckOverrides.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@
3939
@SupportedSourceVersion(SourceVersion.RELEASE_7)
4040
public class CheckOverrides extends AbstractProcessor {
4141

42-
private static final boolean enabled = true;
42+
private static final boolean ENABLED = true;
4343

4444
private static Map<Class, Set<Method>> methods = null;
45-
private static final Set<Class> interfacesWithMustUseOverride = new HashSet<>();
45+
private static final Set<Class> INTERFACES_WITH_MUST_USE_OVERRIDE = new HashSet<>();
4646
private static final Pattern METHOD_SIGNATURE = Pattern.compile("[a-zA-Z0-9_]+\\((.*)\\)");
4747
private static final Pattern CLASS_TEMPLATES = Pattern.compile("^.*?<(.*)>?$");
4848

4949
@Override
5050
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
51-
if(!enabled) {
51+
if(!ENABLED) {
5252
processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, "CheckOverrides processor is turned off!");
5353
return false;
5454
}
@@ -67,7 +67,7 @@ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment
6767
processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,
6868
"Only interfaces may be annotated with " + MustUseOverride.class.getName());
6969
}
70-
interfacesWithMustUseOverride.add(c);
70+
INTERFACES_WITH_MUST_USE_OVERRIDE.add(c);
7171
}
7272
}
7373
for(Element element : roundEnv.getElementsAnnotatedWith(Override.class)) {
@@ -262,7 +262,7 @@ private static void getAllSupers(Class c, Set<Class> building, boolean first) {
262262
}
263263
getAllSupers(c.getSuperclass(), building, false);
264264
for(Class cc : c.getInterfaces()) {
265-
if(interfacesWithMustUseOverride.contains(cc)) {
265+
if(INTERFACES_WITH_MUST_USE_OVERRIDE.contains(cc)) {
266266
building.add(cc);
267267
}
268268
}

src/main/java/com/laytonsmith/PureUtilities/Common/FileUtil.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ private FileUtil() {
2626
public static final int OVERWRITE = 0;
2727
public static final int APPEND = 1;
2828

29-
private static final Map<String, Object> fileLocks = new HashMap<>();
30-
private static final Map<String, Integer> fileLockCounter = new HashMap<>();
29+
private static final Map<String, Object> FILE_LOCKS = new HashMap<>();
30+
private static final Map<String, Integer> FILE_LOCK_COUNTER = new HashMap<>();
3131

3232
/**
3333
* A more complicated mechanism is required to ensure global access across the JVM is synchronized, so file system
@@ -39,20 +39,20 @@ private FileUtil() {
3939
*/
4040
private static synchronized Object getLock(File file) throws IOException {
4141
String canonical = file.getAbsoluteFile().getCanonicalPath();
42-
if(!fileLocks.containsKey(canonical)) {
43-
fileLocks.put(canonical, new Object());
44-
fileLockCounter.put(canonical, 0);
42+
if(!FILE_LOCKS.containsKey(canonical)) {
43+
FILE_LOCKS.put(canonical, new Object());
44+
FILE_LOCK_COUNTER.put(canonical, 0);
4545
}
46-
fileLockCounter.put(canonical, fileLockCounter.get(canonical) + 1);
47-
return fileLocks.get(canonical);
46+
FILE_LOCK_COUNTER.put(canonical, FILE_LOCK_COUNTER.get(canonical) + 1);
47+
return FILE_LOCKS.get(canonical);
4848
}
4949

5050
private static synchronized void freeLock(File file) throws IOException {
5151
String canonical = file.getAbsoluteFile().getCanonicalPath();
52-
fileLockCounter.put(canonical, fileLockCounter.get(canonical) - 1);
53-
if(fileLockCounter.get(canonical) == 0) {
54-
fileLockCounter.remove(canonical);
55-
fileLocks.remove(canonical);
52+
FILE_LOCK_COUNTER.put(canonical, FILE_LOCK_COUNTER.get(canonical) - 1);
53+
if(FILE_LOCK_COUNTER.get(canonical) == 0) {
54+
FILE_LOCK_COUNTER.remove(canonical);
55+
FILE_LOCKS.remove(canonical);
5656
}
5757
}
5858

src/main/java/com/laytonsmith/PureUtilities/Common/Range.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ public boolean isDecending() {
8080
*/
8181
public List<Integer> getRange() {
8282
//Calculate the size once
83-
double _size = Math.abs(leftBound - rightBound);
83+
double size = Math.abs(leftBound - rightBound);
8484
if(!leftInclusive) {
85-
_size--;
85+
size--;
8686
}
8787
if(rightInclusive) {
88-
_size++;
88+
size++;
8989
}
90-
final int size = (int) _size;
90+
final int finalSize = (int) size;
9191
return new AbstractList<Integer>() {
9292

9393
@Override
@@ -101,7 +101,7 @@ public Integer get(int index) {
101101

102102
@Override
103103
public int size() {
104-
return size;
104+
return finalSize;
105105
}
106106
};
107107
}

0 commit comments

Comments
 (0)