Avoid some redundant unboxing and object creation (#21909)

This commit is contained in:
Ke Li 2016-12-02 23:11:41 +08:00 committed by Adrien Grand
parent a30efacca4
commit 7cc9833606
6 changed files with 8 additions and 12 deletions

View File

@ -106,7 +106,7 @@ public class NodeExplanation implements Writeable, ToXContent {
} }
builder.endObject(); // end store builder.endObject(); // end store
builder.field("final_decision", finalDecision.toString()); builder.field("final_decision", finalDecision.toString());
builder.field("final_explanation", finalExplanation.toString()); builder.field("final_explanation", finalExplanation);
builder.field("weight", nodeWeight); builder.field("weight", nodeWeight);
nodeDecision.toXContent(builder, params); nodeDecision.toXContent(builder, params);
} }

View File

@ -61,7 +61,7 @@ final class JNACLibrary {
@Override @Override
protected List<String> getFieldOrder() { protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { "rlim_cur", "rlim_max" }); return Arrays.asList("rlim_cur", "rlim_max");
} }
} }

View File

@ -149,7 +149,7 @@ final class JNAKernel32Library {
@Override @Override
protected List<String> getFieldOrder() { protected List<String> getFieldOrder() {
return Arrays.asList(new String[]{"BaseAddress", "AllocationBase", "AllocationProtect", "RegionSize", "State", "Protect", "Type"}); return Arrays.asList("BaseAddress", "AllocationBase", "AllocationProtect", "RegionSize", "State", "Protect", "Type");
} }
} }
@ -261,10 +261,8 @@ final class JNAKernel32Library {
@Override @Override
protected List<String> getFieldOrder() { protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { return Arrays.asList("PerProcessUserTimeLimit", "PerJobUserTimeLimit", "LimitFlags", "MinimumWorkingSetSize",
"PerProcessUserTimeLimit", "PerJobUserTimeLimit", "LimitFlags", "MinimumWorkingSetSize", "MaximumWorkingSetSize", "ActiveProcessLimit", "Affinity", "PriorityClass", "SchedulingClass");
"MaximumWorkingSetSize", "ActiveProcessLimit", "Affinity", "PriorityClass", "SchedulingClass"
});
} }
} }

View File

@ -33,9 +33,7 @@ public class JavaVersion implements Comparable<JavaVersion> {
} }
private JavaVersion(List<Integer> version) { private JavaVersion(List<Integer> version) {
if (version.size() >= 2 if (version.size() >= 2 && version.get(0) == 1 && version.get(1) == 8) {
&& version.get(0).intValue() == 1
&& version.get(1).intValue() == 8) {
// for Java 8 there is ambiguity since both 1.8 and 8 are supported, // for Java 8 there is ambiguity since both 1.8 and 8 are supported,
// so we rewrite the former to the latter // so we rewrite the former to the latter
version = new ArrayList<>(version.subList(1, version.size())); version = new ArrayList<>(version.subList(1, version.size()));

View File

@ -172,7 +172,7 @@ final class Seccomp {
@Override @Override
protected List<String> getFieldOrder() { protected List<String> getFieldOrder() {
return Arrays.asList(new String[] { "len", "filter" }); return Arrays.asList("len", "filter");
} }
} }

View File

@ -104,7 +104,7 @@ final class StartupException extends RuntimeException {
continue; continue;
} }
consumer.accept("\tat " + line.toString()); consumer.accept("\tat " + line);
linesWritten++; linesWritten++;
} }
} }