Enable PMD rule PrimitiveWrapperInstantiation and fix violations
This commit is contained in:
parent
7a6d3bd9d9
commit
28f205c1ad
12 changed files with 20 additions and 21 deletions
|
@ -289,7 +289,7 @@ public final class MicroCache2 extends MicroCache {
|
||||||
public int encodeMicroCache(byte[] buffer) {
|
public int encodeMicroCache(byte[] buffer) {
|
||||||
HashMap<Long, Integer> idMap = new HashMap<>();
|
HashMap<Long, Integer> idMap = new HashMap<>();
|
||||||
for (int n = 0; n < size; n++) { // loop over nodes
|
for (int n = 0; n < size; n++) { // loop over nodes
|
||||||
idMap.put(Long.valueOf(expandId(faid[n])), Integer.valueOf(n));
|
idMap.put(expandId(faid[n]), n);
|
||||||
}
|
}
|
||||||
|
|
||||||
IntegerFifo3Pass linkCounts = new IntegerFifo3Pass(256);
|
IntegerFifo3Pass linkCounts = new IntegerFifo3Pass(256);
|
||||||
|
@ -404,7 +404,7 @@ public final class MicroCache2 extends MicroCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
long link64 = ((long) ilonlink) << 32 | ilatlink;
|
long link64 = ((long) ilonlink) << 32 | ilatlink;
|
||||||
Integer idx = idMap.get(Long.valueOf(link64));
|
Integer idx = idMap.get(link64);
|
||||||
boolean isInternal = idx != null;
|
boolean isInternal = idx != null;
|
||||||
|
|
||||||
if (isReverse && isInternal) {
|
if (isReverse && isInternal) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class SuspectInfo {
|
||||||
public int triggers;
|
public int triggers;
|
||||||
|
|
||||||
public static void addSuspect(Map<Long, SuspectInfo> map, long id, int prio, int trigger) {
|
public static void addSuspect(Map<Long, SuspectInfo> map, long id, int prio, int trigger) {
|
||||||
Long iD = Long.valueOf(id);
|
Long iD = id;
|
||||||
SuspectInfo info = map.get(iD);
|
SuspectInfo info = map.get(iD);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
info = new SuspectInfo();
|
info = new SuspectInfo();
|
||||||
|
|
|
@ -528,7 +528,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
// unknown name, create
|
// unknown name, create
|
||||||
num = Integer.valueOf(lookupValues.size());
|
num = lookupValues.size();
|
||||||
lookupNumbers.put(name, num);
|
lookupNumbers.put(name, num);
|
||||||
lookupNames.add(name);
|
lookupNames.add(name);
|
||||||
lookupValues.add(new BExpressionLookupValue[]{new BExpressionLookupValue("")
|
lookupValues.add(new BExpressionLookupValue[]{new BExpressionLookupValue("")
|
||||||
|
@ -855,7 +855,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
|
||||||
Integer num = variableNumbers.get(name);
|
Integer num = variableNumbers.get(name);
|
||||||
if (num == null) {
|
if (num == null) {
|
||||||
if (create) {
|
if (create) {
|
||||||
num = Integer.valueOf(variableNumbers.size());
|
num = variableNumbers.size();
|
||||||
variableNumbers.put(name, num);
|
variableNumbers.put(name, num);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class RelationMerger extends MapCreatorBase {
|
||||||
if (routeset.contains(data.wid)) {
|
if (routeset.contains(data.wid)) {
|
||||||
int sepIdx = key.lastIndexOf('_');
|
int sepIdx = key.lastIndexOf('_');
|
||||||
String tagname = key.substring(0, sepIdx);
|
String tagname = key.substring(0, sepIdx);
|
||||||
int val = Integer.valueOf(key.substring(sepIdx + 1));
|
int val = Integer.parseInt(key.substring(sepIdx + 1));
|
||||||
expctxReport.addSmallestLookupValue(tagname, val);
|
expctxReport.addSmallestLookupValue(tagname, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -480,7 +480,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
|
||||||
if (mc.expandId(shrinkid) != longId) {
|
if (mc.expandId(shrinkid) != longId) {
|
||||||
throw new IllegalArgumentException("inconstistent shrinking: " + longId);
|
throw new IllegalArgumentException("inconstistent shrinking: " + longId);
|
||||||
}
|
}
|
||||||
sortedList.put(Integer.valueOf(shrinkid), n);
|
sortedList.put(shrinkid, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (OsmNodeP n : sortedList.values()) {
|
for (OsmNodeP n : sortedList.values()) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ public class BRouterWorker {
|
||||||
String straight = params.getString("straight");
|
String straight = params.getString("straight");
|
||||||
String[] sa = straight.split(",");
|
String[] sa = straight.split(",");
|
||||||
for (int i = 0; i < sa.length; i++) {
|
for (int i = 0; i < sa.length; i++) {
|
||||||
int v = Integer.valueOf(sa[i]);
|
int v = Integer.parseInt(sa[i]);
|
||||||
if (waypoints.size() > v) waypoints.get(v).direct = true;
|
if (waypoints.size() > v) waypoints.get(v).direct = true;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class IpAccessMonitor {
|
||||||
long t = System.currentTimeMillis();
|
long t = System.currentTimeMillis();
|
||||||
synchronized (sync) {
|
synchronized (sync) {
|
||||||
Long lastTime = ipAccess.get(ip);
|
Long lastTime = ipAccess.get(ip);
|
||||||
ipAccess.put(ip, Long.valueOf(t));
|
ipAccess.put(ip, t);
|
||||||
return lastTime == null || t - lastTime.longValue() > MAX_IDLE;
|
return lastTime == null || t - lastTime.longValue() > MAX_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
||||||
if ("timode".equals(e.getKey())) {
|
if ("timode".equals(e.getKey())) {
|
||||||
rc.turnInstructionMode = Integer.parseInt(e.getValue());
|
rc.turnInstructionMode = Integer.parseInt(e.getValue());
|
||||||
} else if ("heading".equals(e.getKey())) {
|
} else if ("heading".equals(e.getKey())) {
|
||||||
rc.startDirection = Integer.valueOf(Integer.parseInt(e.getValue()));
|
rc.startDirection = Integer.parseInt(e.getValue());
|
||||||
rc.forceUseStartDirection = true;
|
rc.forceUseStartDirection = true;
|
||||||
} else if (e.getKey().startsWith("profile:")) {
|
} else if (e.getKey().startsWith("profile:")) {
|
||||||
if (rc.keyValues == null) {
|
if (rc.keyValues == null) {
|
||||||
|
@ -205,7 +205,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
||||||
} else if (e.getKey().equals("straight")) {
|
} else if (e.getKey().equals("straight")) {
|
||||||
String[] sa = e.getValue().split(",");
|
String[] sa = e.getValue().split(",");
|
||||||
for (int i = 0; i < sa.length; i++) {
|
for (int i = 0; i < sa.length; i++) {
|
||||||
int v = Integer.valueOf(sa[i]);
|
int v = Integer.parseInt(sa[i]);
|
||||||
if (wplist.size() > v) wplist.get(v).direct = true;
|
if (wplist.size() > v) wplist.get(v).direct = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class CompactMapTest {
|
||||||
for (int i = 0; i < mapsize; i++) {
|
for (int i = 0; i < mapsize; i++) {
|
||||||
String s = "" + i;
|
String s = "" + i;
|
||||||
long k = mapsize < 10 ? i : rand.nextInt(20000);
|
long k = mapsize < 10 ? i : rand.nextInt(20000);
|
||||||
Long KK = new Long(k);
|
Long KK = k;
|
||||||
|
|
||||||
if (!hmap.containsKey(KK)) {
|
if (!hmap.containsKey(KK)) {
|
||||||
hmap.put(KK, s);
|
hmap.put(KK, s);
|
||||||
|
@ -44,7 +44,7 @@ public class CompactMapTest {
|
||||||
cmap_fast = new FrozenLongMap<>(cmap_fast);
|
cmap_fast = new FrozenLongMap<>(cmap_fast);
|
||||||
}
|
}
|
||||||
long k = mapsize < 10 ? i : rand.nextInt(20000);
|
long k = mapsize < 10 ? i : rand.nextInt(20000);
|
||||||
Long KK = new Long(k);
|
Long KK = k;
|
||||||
String s = hmap.get(KK);
|
String s = hmap.get(KK);
|
||||||
|
|
||||||
boolean contained = hmap.containsKey(KK);
|
boolean contained = hmap.containsKey(KK);
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class CompactSetTest {
|
||||||
|
|
||||||
for (int i = 0; i < setsize; i++) {
|
for (int i = 0; i < setsize; i++) {
|
||||||
long k = setsize < 10 ? i : rand.nextInt(20000);
|
long k = setsize < 10 ? i : rand.nextInt(20000);
|
||||||
Long KK = new Long(k);
|
Long KK = k;
|
||||||
|
|
||||||
if (!hset.contains(KK)) {
|
if (!hset.contains(KK)) {
|
||||||
hset.add(KK);
|
hset.add(KK);
|
||||||
|
@ -43,7 +43,7 @@ public class CompactSetTest {
|
||||||
cset_fast = new FrozenLongSet(cset_fast);
|
cset_fast = new FrozenLongSet(cset_fast);
|
||||||
}
|
}
|
||||||
long k = setsize < 10 ? i : rand.nextInt(20000);
|
long k = setsize < 10 ? i : rand.nextInt(20000);
|
||||||
Long KK = new Long(k);
|
Long KK = k;
|
||||||
|
|
||||||
boolean contained = hset.contains(KK);
|
boolean contained = hset.contains(KK);
|
||||||
Assert.assertEquals("contains missmatch (slow)", contained, cset_slow.contains(k));
|
Assert.assertEquals("contains missmatch (slow)", contained, cset_slow.contains(k));
|
||||||
|
|
|
@ -22,15 +22,15 @@ public class DenseLongMapTest {
|
||||||
for (int i = 0; i < mapsize; i++) {
|
for (int i = 0; i < mapsize; i++) {
|
||||||
int value = i % 255;
|
int value = i % 255;
|
||||||
long k = (long) (rand.nextDouble() * keyrange);
|
long k = (long) (rand.nextDouble() * keyrange);
|
||||||
Long KK = new Long(k);
|
Long KK = k;
|
||||||
|
|
||||||
hmap.put(KK, new Integer(value));
|
hmap.put(KK, value);
|
||||||
dmap.put(k, value); // duplicate puts allowed!
|
dmap.put(k, value); // duplicate puts allowed!
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < trycount; i++) {
|
for (int i = 0; i < trycount; i++) {
|
||||||
long k = (long) (rand.nextDouble() * keyrange);
|
long k = (long) (rand.nextDouble() * keyrange);
|
||||||
Long KK = new Long(k);
|
Long KK = k;
|
||||||
Integer VV = hmap.get(KK);
|
Integer VV = hmap.get(KK);
|
||||||
int hvalue = VV == null ? -1 : VV.intValue();
|
int hvalue = VV == null ? -1 : VV.intValue();
|
||||||
int dvalue = dmap.getInt(k);
|
int dvalue = dmap.getInt(k);
|
||||||
|
@ -53,12 +53,12 @@ public class DenseLongMapTest {
|
||||||
DenseLongMap dmap = new DenseLongMap(512);
|
DenseLongMap dmap = new DenseLongMap(512);
|
||||||
for (int i = 0; i < mapputs; i++) {
|
for (int i = 0; i < mapputs; i++) {
|
||||||
long k = (long) (rand.nextDouble() * keyrange);
|
long k = (long) (rand.nextDouble() * keyrange);
|
||||||
hset.add(new Long(k));
|
hset.add(k);
|
||||||
dmap.put(k, 0);
|
dmap.put(k, 0);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < trycount; i++) {
|
for (int i = 0; i < trycount; i++) {
|
||||||
long k = (long) (rand.nextDouble() * keyrange);
|
long k = (long) (rand.nextDouble() * keyrange);
|
||||||
boolean hcontains = hset.contains(new Long(k));
|
boolean hcontains = hset.contains(k);
|
||||||
boolean dcontains = dmap.getInt(k) == 0;
|
boolean dcontains = dmap.getInt(k) == 0;
|
||||||
|
|
||||||
if (hcontains != dcontains) {
|
if (hcontains != dcontains) {
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
<exclude name="OneDeclarationPerLine" />
|
<exclude name="OneDeclarationPerLine" />
|
||||||
<exclude name="OverrideBothEqualsAndHashcode" />
|
<exclude name="OverrideBothEqualsAndHashcode" />
|
||||||
<exclude name="PreserveStackTrace" />
|
<exclude name="PreserveStackTrace" />
|
||||||
<exclude name="PrimitiveWrapperInstantiation" />
|
|
||||||
<exclude name="ReturnEmptyCollectionRatherThanNull" />
|
<exclude name="ReturnEmptyCollectionRatherThanNull" />
|
||||||
<exclude name="UncommentedEmptyConstructor" />
|
<exclude name="UncommentedEmptyConstructor" />
|
||||||
<exclude name="UncommentedEmptyMethodBody" />
|
<exclude name="UncommentedEmptyMethodBody" />
|
||||||
|
|
Loading…
Reference in a new issue