Skip to content

Commit

Permalink
Use jakarta.json instead of java.json
Browse files Browse the repository at this point in the history
This also fixes various lint issues
  • Loading branch information
tsmock committed Aug 22, 2023
1 parent c4d3b94 commit 6c20c47
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import java.util.stream.LongStream;

import javax.annotation.Nonnull;
import javax.json.Json;
import javax.json.JsonNumber;
import javax.json.JsonReader;
import javax.json.JsonStructure;
import javax.json.JsonValue;
import jakarta.json.Json;
import jakarta.json.JsonNumber;
import jakarta.json.JsonReader;
import jakarta.json.JsonStructure;
import jakarta.json.JsonValue;

import org.openstreetmap.josm.plugins.maproulette.api.model.TaskBundle;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.json.Json;
import javax.json.JsonNumber;
import javax.json.JsonObject;
import javax.json.JsonString;
import javax.json.JsonStructure;
import javax.json.JsonValue;
import jakarta.json.Json;
import jakarta.json.JsonNumber;
import jakarta.json.JsonObject;
import jakarta.json.JsonString;
import jakarta.json.JsonStructure;
import jakarta.json.JsonValue;

import org.openstreetmap.josm.plugins.maproulette.api.enums.Priority;
import org.openstreetmap.josm.plugins.maproulette.api.model.Challenge;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Map;
import java.util.TreeMap;

import javax.json.Json;
import jakarta.json.Json;
import javax.swing.text.html.Option;

import org.openstreetmap.josm.plugins.maproulette.api.enums.TaskStatus;
Expand All @@ -36,7 +36,7 @@ public final class TaskAPI {
private static final String TASKS = TASK + "s";

/**
* Don't allow isntantiation of this utility class
* Don't allow instantiation of this utility class
*/
private TaskAPI() {
// Hide constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import java.util.Objects;

import javax.annotation.Nullable;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonValue;
import javax.json.stream.JsonParser;
import jakarta.json.Json;
import jakarta.json.JsonObject;
import jakarta.json.JsonValue;
import jakarta.json.stream.JsonParser;

import org.openstreetmap.josm.plugins.maproulette.api.enums.Difficulty;
import org.openstreetmap.josm.plugins.maproulette.api.enums.TaskStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;

import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonObject;
import jakarta.json.Json;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;

import org.openstreetmap.josm.data.Bounds;
import org.openstreetmap.josm.data.DataSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import static org.openstreetmap.josm.plugins.maproulette.api.parsers.ParsingUtils.optionalObject;

import javax.annotation.Nonnull;
import javax.json.JsonArray;
import javax.json.JsonObject;
import javax.json.JsonValue;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;
import jakarta.json.JsonValue;

import org.openstreetmap.josm.plugins.maproulette.api.model.Grant;
import org.openstreetmap.josm.plugins.maproulette.api.model.GrantTarget;
Expand All @@ -29,7 +29,7 @@ private GrantParser() {
@Nonnull
static Grant[] parse(JsonArray multiple) {
final var grants = new Grant[multiple.size()];
for (int i = 0; i < grants.length; i++) {
for (var i = 0; i < grants.length; i++) {
final var tObj = multiple.get(i);
if (tObj.getValueType() != JsonValue.ValueType.OBJECT) {
throw new IllegalArgumentException("Bad Grant array: " + multiple);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.maproulette.api.parsers;

import javax.json.JsonObject;
import jakarta.json.JsonObject;

import org.openstreetmap.josm.plugins.maproulette.api.UnauthorizedException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.json.JsonArray;
import javax.json.JsonObject;
import jakarta.json.JsonArray;
import jakarta.json.JsonObject;

/**
* Utils to avoid some common patterns (e.g., object.containsKey("foo") ? object.getJsonNumber("foo").longValue() : 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package org.openstreetmap.josm.plugins.maproulette.api.parsers;

import javax.annotation.Nullable;
import javax.json.JsonObject;
import jakarta.json.JsonObject;

import org.openstreetmap.josm.plugins.maproulette.api.model.Point;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import static org.openstreetmap.josm.plugins.maproulette.api.parsers.ParsingUtils.optionalInteger;
import static org.openstreetmap.josm.plugins.maproulette.api.parsers.ParsingUtils.optionalObject;

import javax.json.JsonNumber;
import javax.json.JsonObject;
import jakarta.json.JsonNumber;
import jakarta.json.JsonObject;

import org.openstreetmap.josm.plugins.maproulette.api.model.PointReview;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import java.io.InputStream;

import javax.annotation.Nonnull;
import javax.json.Json;
import javax.json.JsonValue;
import jakarta.json.Json;
import jakarta.json.JsonValue;

import org.openstreetmap.josm.plugins.maproulette.api.model.Project;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonNumber;
import javax.json.JsonObject;
import javax.json.JsonString;
import jakarta.json.Json;
import jakarta.json.JsonArray;
import jakarta.json.JsonNumber;
import jakarta.json.JsonObject;
import jakarta.json.JsonString;

import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
import org.openstreetmap.josm.data.osm.PrimitiveId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package org.openstreetmap.josm.plugins.maproulette.api.parsers;

import javax.annotation.Nullable;
import javax.json.JsonObject;
import jakarta.json.JsonObject;

import org.openstreetmap.josm.plugins.maproulette.api.model.PointReview;
import org.openstreetmap.josm.plugins.maproulette.api.model.PublicUser;
Expand All @@ -11,6 +11,8 @@
* A parser for user objects
*/
final class UserParser {
private UserParser() { /* Hide constructor */ }

/**
* Parse a {@link PointReview} object
*
Expand Down

0 comments on commit 6c20c47

Please sign in to comment.