Skip to content

Commit

Permalink
Merge pull request #689 from zod/pmd-7
Browse files Browse the repository at this point in the history
Update PMD to 7.0.0
  • Loading branch information
afischerdev committed Apr 17, 2024
2 parents 23c8123 + 47f5812 commit 36e169a
Show file tree
Hide file tree
Showing 63 changed files with 193 additions and 207 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle-publish.yml
Expand Up @@ -20,10 +20,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Expand Up @@ -16,10 +16,10 @@ jobs:
environment: BRouter
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Create local.properties
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,6 +1,7 @@
*.iml
.gradle
.idea/
build
/local.properties
/.idea/caches
/.idea/gradle.xml
Expand All @@ -10,7 +11,6 @@
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
Expand Down
1 change: 0 additions & 1 deletion brouter-codec/.gitignore

This file was deleted.

3 changes: 1 addition & 2 deletions brouter-codec/build.gradle
@@ -1,8 +1,7 @@
plugins {
id 'java-library'
id 'brouter.library-conventions'
}

dependencies {
implementation project(':brouter-util')
testImplementation 'junit:junit:4.13.1'
}
3 changes: 0 additions & 3 deletions brouter-codec/src/main/AndroidManifest.xml

This file was deleted.

5 changes: 3 additions & 2 deletions brouter-codec/src/main/java/btools/codec/MicroCache2.java
@@ -1,6 +1,7 @@
package btools.codec;

import java.util.HashMap;
import java.util.Map;

import btools.util.ByteDataReader;
import btools.util.IByteArrayUnifier;
Expand Down Expand Up @@ -287,7 +288,7 @@ public boolean isInternal(int ilon, int ilat) {

@Override
public int encodeMicroCache(byte[] buffer) {
HashMap<Long, Integer> idMap = new HashMap<>();
Map<Long, Integer> idMap = new HashMap<>();
for (int n = 0; n < size; n++) { // loop over nodes
idMap.put(expandId(faid[n]), n);
}
Expand Down Expand Up @@ -418,7 +419,7 @@ public int encodeMicroCache(byte[] buffer) {
nlinks++;

if (isInternal) {
int nodeIdx = idx.intValue();
int nodeIdx = idx;
if (dodebug) System.out.println("*** target nodeIdx=" + nodeIdx);
if (nodeIdx == n) throw new RuntimeException("ups: self ref?");
nodeIdxDiff.encodeSignedValue(nodeIdx - n);
Expand Down
3 changes: 2 additions & 1 deletion brouter-codec/src/main/java/btools/codec/TagValueCoder.java
Expand Up @@ -4,6 +4,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Queue;

import btools.util.BitCoderContext;

Expand Down Expand Up @@ -58,7 +59,7 @@ public void encodeDictionary(BitCoderContext bc) {
TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
identityMap.put(dummy, dummy);
}
PriorityQueue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
Queue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
queue.addAll(identityMap.values());
while (queue.size() > 1) {
TagValueSet node = new TagValueSet(nextTagValueSetId++);
Expand Down
1 change: 0 additions & 1 deletion brouter-core/.gitignore

This file was deleted.

3 changes: 1 addition & 2 deletions brouter-core/build.gradle
@@ -1,13 +1,12 @@
plugins {
id 'java-library'
id 'brouter.library-conventions'
}

dependencies {
implementation project(':brouter-mapaccess')
implementation project(':brouter-util')
implementation project(':brouter-expressions')
implementation project(':brouter-codec')
testImplementation 'junit:junit:4.13.2'
}

// MapcreatorTest generates segments which are used in tests
Expand Down
3 changes: 0 additions & 3 deletions brouter-core/src/main/AndroidManifest.xml

This file was deleted.

4 changes: 2 additions & 2 deletions brouter-core/src/main/java/btools/router/OsmNogoPolygon.java
Expand Up @@ -168,7 +168,7 @@ public boolean isOnPolyline(long px, long py) {
Point p1 = points.get(0);
for (int i = 1; i <= i_last; i++) {
final Point p2 = points.get(i);
if (OsmNogoPolygon.isOnLine(px, py, p1.x, p1.y, p2.x, p2.y)) {
if (isOnLine(px, py, p1.x, p1.y, p2.x, p2.y)) {
return true;
}
p1 = p2;
Expand Down Expand Up @@ -234,7 +234,7 @@ public boolean isWithin(final long px, final long py) {
final long p1x = p1.x;
final long p1y = p1.y;

if (OsmNogoPolygon.isOnLine(px, py, p0x, p0y, p1x, p1y)) {
if (isOnLine(px, py, p0x, p0y, p1x, p1y)) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion brouter-core/src/main/java/btools/router/OsmPath.java
Expand Up @@ -296,7 +296,7 @@ protected void addAddionalPenalty(OsmTrack refTrack, boolean detailMode, OsmPath
// apply a start-direction if appropriate (by faking the origin position)
if (isStartpoint) {
if (rc.startDirectionValid) {
double dir = rc.startDirection.intValue() * CheapRuler.DEG_TO_RAD;
double dir = rc.startDirection * CheapRuler.DEG_TO_RAD;
double[] lonlat2m = CheapRuler.getLonLatToMeterScales((lon0 + lat1) >> 1);
lon0 = lon1 - (int) (1000. * Math.sin(dir) / lonlat2m[0]);
lat0 = lat1 - (int) (1000. * Math.cos(dir) / lonlat2m[1]);
Expand Down
4 changes: 2 additions & 2 deletions brouter-core/src/main/java/btools/router/OsmTrack.java
Expand Up @@ -166,7 +166,7 @@ public void buildMap() {
}

public List<String> aggregateMessages() {
ArrayList<String> res = new ArrayList<>();
List<String> res = new ArrayList<>();
MessageData current = null;
for (OsmPathElement n : nodes) {
if (n.message != null && n.message.wayKeyValues != null) {
Expand All @@ -188,7 +188,7 @@ public List<String> aggregateMessages() {
}

public List<String> aggregateSpeedProfile() {
ArrayList<String> res = new ArrayList<>();
List<String> res = new ArrayList<>();
int vmax = -1;
int vmaxe = -1;
int vmin = -1;
Expand Down
10 changes: 5 additions & 5 deletions brouter-core/src/main/java/btools/router/RoutingEngine.java
Expand Up @@ -187,7 +187,7 @@ public void doRouting(long maxRunningTime) {
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
OsmTrack[] lastTracks = new OsmTrack[nsections];
OsmTrack track = null;
ArrayList<String> messageList = new ArrayList<>();
List<String> messageList = new ArrayList<>();
for (int i = 0; ; i++) {
track = findTrack(refTracks, lastTracks);
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
Expand Down Expand Up @@ -690,9 +690,9 @@ private boolean snappPathConnection(OsmTrack tt, OsmTrack t, MatchedWaypoint sta
return false;
}
}
ArrayList<OsmPathElement> removeBackList = new ArrayList<>();
ArrayList<OsmPathElement> removeForeList = new ArrayList<>();
ArrayList<Integer> removeVoiceHintList = new ArrayList<>();
List<OsmPathElement> removeBackList = new ArrayList<>();
List<OsmPathElement> removeForeList = new ArrayList<>();
List<Integer> removeVoiceHintList = new ArrayList<>();
OsmPathElement last = null;
OsmPathElement lastJunction = null;
CompactLongMap<OsmTrack.OsmPathElementHolder> lastJunctions = new CompactLongMap<>();
Expand Down Expand Up @@ -1246,7 +1246,7 @@ private OsmTrack _findTrack(String operationName, MatchedWaypoint startWp, Match
addToOpenset(startPath1);
addToOpenset(startPath2);
}
ArrayList<OsmPath> openBorderList = new ArrayList<>(4096);
List<OsmPath> openBorderList = new ArrayList<>(4096);
boolean memoryPanicMode = false;
boolean needNonPanicProcessing = false;

Expand Down
Expand Up @@ -101,7 +101,7 @@ private OsmNodeNamed readPosition(double lon, double lat, String name) {
* @throws UnsupportedEncodingException
*/
public Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
HashMap<String, String> params = new HashMap<>();
Map<String, String> params = new HashMap<>();
String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&");
while (tk.hasMoreTokens()) {
Expand Down
1 change: 0 additions & 1 deletion brouter-expressions/.gitignore

This file was deleted.

3 changes: 1 addition & 2 deletions brouter-expressions/build.gradle
@@ -1,9 +1,8 @@
plugins {
id 'java-library'
id 'brouter.library-conventions'
}

dependencies {
implementation project(':brouter-util')
implementation project(':brouter-codec')
testImplementation 'junit:junit:4.13.1'
}
3 changes: 0 additions & 3 deletions brouter-expressions/src/main/AndroidManifest.xml

This file was deleted.

Expand Up @@ -242,15 +242,15 @@ private static BExpression parseRaw(BExpressionContext ctx, int level, String op
}
// parse operands
if (nops > 0) {
exp.op1 = BExpression.parse(ctx, level + 1, exp.typ == ASSIGN_EXP ? "=" : null);
exp.op1 = parse(ctx, level + 1, exp.typ == ASSIGN_EXP ? "=" : null);
}
if (nops > 1) {
if (ifThenElse) checkExpectedToken(ctx, "then");
exp.op2 = BExpression.parse(ctx, level + 1, null);
exp.op2 = parse(ctx, level + 1, null);
}
if (nops > 2) {
if (ifThenElse) checkExpectedToken(ctx, "else");
exp.op3 = BExpression.parse(ctx, level + 1, null);
exp.op3 = parse(ctx, level + 1, null);
}
if (brackets) {
checkExpectedToken(ctx, ")");
Expand Down

0 comments on commit 36e169a

Please sign in to comment.