Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
uses: github/codeql-action/init@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
uses: github/codeql-action/autobuild@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.5
uses: github/codeql-action/analyze@3599b3baa15b485a2e49ef411a7a4bb2452e7f93 # v3.29.5
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: ./mvnw -B -q -ff -ntp test
- name: Publish code coverage
if: ${{ matrix.release_build && github.event_name != 'pull_request' }}
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/site/jacoco/jacoco.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger_dep_builds_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

steps:
- name: Repository dispatch
uses: peter-evans/repository-dispatch@0ee9de00feb82e6165438c503f0bc29f628b8317 # v3.0.0
uses: peter-evans/repository-dispatch@de78ac1a711fc6f29e77338f843065faf5335227 # v3.0.0
with:
token: ${{ secrets.token }}
repository: ${{ matrix.repo }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger_dep_builds_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

steps:
- name: Repository dispatch
uses: peter-evans/repository-dispatch@0ee9de00feb82e6165438c503f0bc29f628b8317 # v3.0.0
uses: peter-evans/repository-dispatch@de78ac1a711fc6f29e77338f843065faf5335227 # v3.0.0
with:
token: ${{ secrets.token }}
repository: ${{ matrix.repo }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Arrays;

import tools.jackson.core.*;
import tools.jackson.core.io.CharacterEscapes;
import tools.jackson.core.util.JacksonFeatureSet;
import tools.jackson.databind.*;
import tools.jackson.databind.util.RawValue;
Expand Down Expand Up @@ -142,6 +143,18 @@ public boolean has(StreamWriteCapability capability) {
return BOGUS_WRITE_CAPABILITIES.isEnabled(capability);
}

@Override
public CharacterEscapes getCharacterEscapes() { return null; }

@Override
public int getHighestNonEscapedChar() { return 0; }

@Override
public PrettyPrinter getPrettyPrinter() { return null; }

@Override
public FormatSchema getSchema() { return null; }

/*
/**********************************************************************
/* JsonGenerator implementation: low-level output handling
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/tools/jackson/databind/util/TokenBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import tools.jackson.core.exc.InputCoercionException;
import tools.jackson.core.exc.StreamWriteException;
import tools.jackson.core.exc.UnexpectedEndOfInputException;
import tools.jackson.core.io.CharacterEscapes;
import tools.jackson.core.io.NumberInput;
import tools.jackson.core.io.NumberOutput;
import tools.jackson.core.sym.PropertyNameMatcher;
Expand Down Expand Up @@ -340,6 +341,24 @@ public Version version() {
return tools.jackson.databind.cfg.PackageVersion.VERSION;
}

/*
/**********************************************************************
/* `JsonGenerator` config access
/**********************************************************************
*/

@Override
public CharacterEscapes getCharacterEscapes() { return null; }

@Override
public int getHighestNonEscapedChar() { return 0; }

@Override
public PrettyPrinter getPrettyPrinter() { return null; }

@Override
public FormatSchema getSchema() { return null; }

/*
/**********************************************************************
/* Additional accessors
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package tools.jackson.databind.records.tofix;

import tools.jackson.databind.testutil.failure.JacksonTestFailureExpected;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonValue;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.cfg.MutableConfigOverride;
import tools.jackson.databind.json.JsonMapper;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_DEFAULT;
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

import java.util.Map;

// [databind#5312] Include.NON_DEFAULT regression for objects with @JsonValue
public class JsonIncludeNonDefaultOnRecord5312Test
{
record StringValue(String value) {
@Override
@JsonValue
public String value() {
return value;
}
}

record Pojo1(StringValue value) { }

@JsonInclude(JsonInclude.Include.NON_DEFAULT)
record Pojo2(StringValue value) { }

record Pojo3(@JsonInclude(JsonInclude.Include.NON_DEFAULT) StringValue value) { }

private final ObjectMapper MAPPER = JsonMapper.builder()
//might be relevant for analysis, but does not affect test outcome
.changeDefaultPropertyInclusion(incl -> JsonInclude.Value.construct(NON_DEFAULT, NON_DEFAULT))
.withConfigOverride(String.class,
o -> o.setInclude(JsonInclude.Value.construct(NON_NULL, NON_NULL)))

.build();

@JacksonTestFailureExpected
@Test
void testSerialization1() throws Exception {
//FAIL on jackson 2.18.2 / 2.20.0
Assertions.assertEquals("{\"value\":\"\"}",
MAPPER.writeValueAsString(new Pojo1(new StringValue(""))));
}

//PASS
@Test
void testSerialization2() throws Exception {
Assertions.assertEquals("{\"value\":\"\"}",
MAPPER.writeValueAsString(new Pojo2(new StringValue(""))));
}

@JacksonTestFailureExpected
@Test
void testSerialization3() throws Exception {
//FAIL on jackson 2.18.2 / 2.20.0
Assertions.assertEquals("{\"value\":\"\"}", MAPPER.writeValueAsString(new Pojo3(new StringValue(""))));
}
}