Skip to content

Commit

Permalink
Merge branch '2.17' into Shounaks/2.17
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Feb 19, 2024
2 parents 5ef9666 + 11d0611 commit cf3f6d2
Show file tree
Hide file tree
Showing 35 changed files with 609 additions and 281 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
groups:
github-actions:
patterns:
- "*"
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: ['8', '11', '17']
java_version: ['8', '11', '17', '21']
os: ['ubuntu-20.04']
env:
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
steps:
- uses: actions/[email protected].0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
run: ./mvnw -B -q -ff -ntp test
- name: Publish code coverage
if: github.event_name != 'pull_request' && matrix.java_version == '8'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./target/site/jacoco/jacoco.xml
Expand Down
20 changes: 18 additions & 2 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.file.Path;
import java.util.*;

import com.fasterxml.jackson.core.*;
Expand Down Expand Up @@ -217,21 +218,30 @@ public void writeField(String fieldName, Object value, int type) throws IOExcept
writeBigIntegerField(fieldName, (BigInteger) value);
return;
case SER_NUMBER_FLOAT: // fall through
case SER_NUMBER_FLOAT_WRAPPER:
writeFloatField(fieldName, ((Float) value).floatValue());
return;
case SER_NUMBER_DOUBLE:
writeDoubleField(fieldName, ((Number) value).doubleValue());
case SER_NUMBER_DOUBLE_WRAPPER:
writeDoubleField(fieldName, ((Double) value).doubleValue());
return;
case SER_NUMBER_BYTE: // fall through
case SER_NUMBER_SHORT: // fall through
case SER_NUMBER_INTEGER:
writeIntField(fieldName, ((Number) value).intValue());
return;
case SER_NUMBER_INTEGER:
case SER_NUMBER_INTEGER_WRAPPER:
writeIntField(fieldName, ((Integer) value).intValue());
return;
case SER_NUMBER_LONG:
writeLongField(fieldName, ((Number) value).longValue());
case SER_NUMBER_LONG_WRAPPER:
writeLongField(fieldName, ((Long) value).longValue());
return;

// Scalar types:

case SER_BOOLEAN:
case SER_BOOLEAN_WRAPPER:
writeBooleanField(fieldName, ((Boolean) value).booleanValue());
return;
case SER_CHAR:
Expand All @@ -257,6 +267,9 @@ public void writeField(String fieldName, Object value, int type) throws IOExcept
case SER_URI:
writeStringLikeField(fieldName, value.toString(), type);
return;
case SER_PATH:
writeStringLikeField(fieldName, ((Path) value).toUri().toString(), type);
return;

// Others

Expand Down Expand Up @@ -327,16 +340,24 @@ protected void _writeValue(Object value, int type) throws IOException
// Number types:

case SER_NUMBER_FLOAT: // fall through
case SER_NUMBER_FLOAT_WRAPPER: // fall through
writeFloatValue(((Float) value).floatValue());
return;
case SER_NUMBER_DOUBLE:
writeDoubleValue(((Number) value).doubleValue());
case SER_NUMBER_DOUBLE_WRAPPER:
writeDoubleValue(((Double) value).doubleValue());
return;
case SER_NUMBER_BYTE: // fall through
case SER_NUMBER_SHORT: // fall through
case SER_NUMBER_INTEGER:
writeIntValue(((Number) value).intValue());
return;
case SER_NUMBER_INTEGER:
case SER_NUMBER_INTEGER_WRAPPER:
writeIntValue(((Integer) value).intValue());
return;
case SER_NUMBER_LONG:
writeLongValue(((Number) value).longValue());
case SER_NUMBER_LONG_WRAPPER:
writeLongValue(((Long) value).longValue());
return;
case SER_NUMBER_BIG_DECIMAL:
writeBigDecimalValue((BigDecimal) value);
Expand All @@ -348,6 +369,7 @@ protected void _writeValue(Object value, int type) throws IOException
// Other scalar types:

case SER_BOOLEAN:
case SER_BOOLEAN_WRAPPER:
writeBooleanValue(((Boolean) value).booleanValue());
return;
case SER_CHAR:
Expand Down Expand Up @@ -375,6 +397,9 @@ protected void _writeValue(Object value, int type) throws IOException
case SER_URI:
writeStringLikeValue(value.toString(), type);
return;
case SER_PATH:
writeStringLikeValue(((Path) value).toUri().toString(), type);
return;

case SER_ITERABLE:
writeIterableValue((Iterable<?>) value);
Expand Down Expand Up @@ -582,6 +607,14 @@ protected void writeLongField(String fieldName, long v) throws IOException {
_generator.writeNumberField(fieldName, v);
}

protected void writeFloatValue(float v) throws IOException {
_generator.writeNumber(v);
}

protected void writeFloatField(String fieldName, float v) throws IOException {
_generator.writeNumberField(fieldName, v);
}

protected void writeDoubleValue(double v) throws IOException {
_generator.writeNumber(v);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.nio.file.Paths;
import java.util.*;

import com.fasterxml.jackson.core.JsonParser;
Expand Down Expand Up @@ -60,6 +61,7 @@ public Object readNext(JSONReader reader, JsonParser p) throws IOException
// cases default to "standard" handling which does range checks etc

case SER_NUMBER_INTEGER:
case SER_NUMBER_INTEGER_WRAPPER:
{
int i = p.nextIntValue(-2);
if (i != -2) {
Expand All @@ -69,6 +71,7 @@ public Object readNext(JSONReader reader, JsonParser p) throws IOException
}

case SER_NUMBER_LONG:
case SER_NUMBER_LONG_WRAPPER:
{
long l = p.nextLongValue(-2L);
if (l != -2L) {
Expand All @@ -80,6 +83,7 @@ public Object readNext(JSONReader reader, JsonParser p) throws IOException
// Other scalar types:

case SER_BOOLEAN:
case SER_BOOLEAN_WRAPPER:
{
Boolean b = p.nextBooleanValue();
if (b != null) {
Expand Down Expand Up @@ -115,8 +119,16 @@ public Object read(JSONReader reader, JsonParser p) throws IOException

// Number types:

case SER_NUMBER_FLOAT: // fall through
case SER_NUMBER_FLOAT_WRAPPER:
if (p.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
case SER_NUMBER_FLOAT:
return Float.valueOf((float) p.getValueAsDouble());
case SER_NUMBER_DOUBLE_WRAPPER:
if (p.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
case SER_NUMBER_DOUBLE:
return p.getValueAsDouble();

Expand All @@ -125,8 +137,16 @@ public Object read(JSONReader reader, JsonParser p) throws IOException

case SER_NUMBER_SHORT: // fall through
return (short) p.getValueAsInt();
case SER_NUMBER_INTEGER_WRAPPER:
if (p.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
case SER_NUMBER_INTEGER:
return p.getValueAsInt();
case SER_NUMBER_LONG_WRAPPER:
if (p.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
case SER_NUMBER_LONG:
return p.getValueAsLong();

Expand All @@ -139,14 +159,16 @@ public Object read(JSONReader reader, JsonParser p) throws IOException
// Other scalar types:

case SER_BOOLEAN:
case SER_BOOLEAN_WRAPPER:
switch (p.currentTokenId()) {
case JsonTokenId.ID_TRUE:
return Boolean.TRUE;
case JsonTokenId.ID_FALSE:
return Boolean.FALSE;
case JsonTokenId.ID_NULL:
// 07-Jul-2020, tatu: since `boolean` and `java.lang.Boolean` both handled
// here, can not (alas!) separate yet
if (_typeId == SER_BOOLEAN_WRAPPER) {
return null;
}
return Boolean.FALSE;

case JsonTokenId.ID_STRING:
Expand Down Expand Up @@ -191,7 +213,7 @@ public Object read(JSONReader reader, JsonParser p) throws IOException
try {
return Class.forName(v);
} catch (Exception e) {
throw new JSONObjectException("Failed to bind java.lang.Class from value '"+v+"'");
throw new JSONObjectException("Failed to bind `java.lang.Class` from value '"+v+"'");
}
}
case SER_FILE:
Expand All @@ -218,6 +240,16 @@ public Object read(JSONReader reader, JsonParser p) throws IOException
return null;
}
return URI.create(p.getValueAsString());
case SER_PATH:
if (p.hasToken(JsonToken.VALUE_NULL)) {
return null;
}
String v = p.getValueAsString();
try {
return Paths.get(new URI(v));
} catch (Exception e) {
throw new JSONObjectException("Failed to bind `java.nio.file.Path` from value '"+v+"'");
}

// case SER_MAP:
// case SER_LIST:
Expand Down
Loading

0 comments on commit cf3f6d2

Please sign in to comment.