Skip to content

Conversation

@tiger9800
Copy link
Contributor

When writing numeric values as strings, we would like to support alternative to base-10 representations. Let's add it via @JsonFormat annotation. Whenever the shape is STRING and pattern is a number, we serialize/deserialize annotated properties using the specified alternative radix.

When writing numeric values as strings, we would like to
support alternative to base-10 representations. Let's add it
via @jsonformat annotation. Whenever the shape is STRING
and pattern is a number, we serialize/deserialize annotated
properties using the specified alternative radix.
@tiger9800
Copy link
Contributor Author

I based the change on the 2.x branch. I understand that the latest release is 2.20 and this should is a backwards compatible change, so it should be done against the next minor version (2.21), but I could not find it as one of the remote branches.

Also addressing the comments now @pjfanning, thank you.

Copy link
Member

@pjfanning pjfanning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some changes requested

@tiger9800 tiger9800 marked this pull request as draft September 16, 2025 02:57
return Long.parseLong(text, radix);
} else {
ctxt.reportInputMismatch(handledType,
"Trying to deserialize a non-whole number with NumberToStringWithRadixSerializer");
Copy link
Contributor Author

@tiger9800 tiger9800 Sep 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered explicitly throwing here, but this seemed like a more common way to indicate an error.

@tiger9800 tiger9800 marked this pull request as ready for review September 16, 2025 20:23
@tiger9800 tiger9800 requested a review from pjfanning September 16, 2025 20:23
@tiger9800 tiger9800 requested a review from pjfanning September 16, 2025 22:53
@cowtowncoder cowtowncoder added the cla-received PR already covered by CLA (optional label) label Sep 18, 2025
@cowtowncoder
Copy link
Member

2.x is the right target branch indeed (for 2.21.x).

Impressive PR!

One big(ger) question/concern I have is the addition of radix in BaseSettings as discrete config option. I think I'd prefer requiring use of "Config Overrides" with JsonFormat.Value a la:

        mapper.configOverride(Integer.TYPE) // for `int`
            .setFormat(JsonFormat.Value.forShape(JsonFormat.Shape.STRING));
            // but with "Value.forPattern("16")"

but I realize there's the problem of changing radix for ALL integral types.

Perhaps that could be tackled by adding actual radix property for @JsonFormat annotation, and then allowing setting of base radix in ConfigOverrides, merged via ConfigOverride.
Or something along those lines.

I'd just not want to force it through all machinery via BaseSettings.

@cowtowncoder
Copy link
Member

cowtowncoder commented Sep 18, 2025

Fails CI; probably uses some Java 17 language feature (2.x still has Java 8 baseline; 3.x has 17)

@tiger9800
Copy link
Contributor Author

tiger9800 commented Sep 19, 2025

Just want to preface by saying this is not a final change but more of an outline where I am still using pattern as the field containing radix.

A few comments and questions:

  • I initially wanted to make ConfigOverrides have a JsonFormat.Value field instead of just radix, but there is a test that checks that ObjectReader is serializable. ObjectReader has a reference to ConfigOverrides through some other configs it refers to directly. As a result, we want to serialize ConfigOverrides as a part of that test and JsonFormat.Value is not serializable because Feature does not implement Serializable.

  • I refactored ConcreteBeanPropertyBase#findPropertyFormat because it seemed like an appropriate place to use _defaultFormat (that I was going to get from ConfigOverride) as a base format that gets overriden by v1 and v2. Since keeping JsonFormat.Value in ConfigOverride did not work, I just reserved to creating a JsonFormat.Value inside the method from an empty format, and I kept the refractor. To make sure the refactor works as intended, I added a unit test that uses stubs. I did not find a lot of other tests that use mockito, so I am not sure it is something you do in the repo. The problem with using mockito is that it shows a warning described here https://openjdk.org/jeps/451. The solution (described here) is adding a VM flag to test run configuration, and a flag to surefire plugin:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>3.5.2</version>
	<configuration>
		<argLine>
			-javaagent:${org.mockito:mockito-core:jar}
			-Xshare:off
		</argLine>
	</configuration>
</plugin>

However, the solution only works with newer mockito jars. The mockito-core-4.11.0.jar databind depends on does not specify Premain class in its MANIFEST.MF. I do not know which version is the first one to specify it, but here is an example of Premain being specified in mockito-core-5.19.0.jar's MANIFEST.MF: Premain-Class: org.mockito.internal.PremainAttach.
I also left a TODO saying this needs to be done once mockito is upgraded.

I think we have 2 options here:

  1. Create another issue to upgrade mockito & add the argument to the surefire plugin
  2. Remove the test
  • Finally, I was wondering what is the correct process for updating another "internal" project databind depends on to use a newly added construct from there. Specifically for adding radix field to the JsonFormat in the annotations repo, how do we get a new release of the annotations repo and then change the databind's pom to point to that new release?

@cowtowncoder
Copy link
Member

Quick note on:

JsonFormat.Value is not serializable because Feature does not implement Serializable.

I think it's Features (since Feature is Enum and should be java.io.Serializable).
But either way, could you please file an issue on jackson-annotations as we definitely do want all Value objects to be Serializable.
(change to go in 2.21 but good to solve now).

@tiger9800
Copy link
Contributor Author

Will file an issue and try to address it!

Please let me know what you think about the other questions/concerns once you get the chance.

@tiger9800
Copy link
Contributor Author

FasterXML/jackson-annotations#316 - made the pull request. Would it make sense to make the change to annotations and go with the initial approach that failed?

@cowtowncoder cowtowncoder merged commit 7657bab into FasterXML:2.x Oct 31, 2025
@cowtowncoder
Copy link
Member

Fudge! Was not supposed to merge; need to revert ASAP

@cowtowncoder
Copy link
Member

I do not know how, but somehow I managed to merge this -- not via UI. So had to revert via #5373.

Not sure how to re-create PR... sorry. I hate git sometimes. Today is such a day. :-(

@tiger9800
Copy link
Contributor Author

I can just try and get it from my local branch. Should I create a new PR?

@JooHyukKim
Copy link
Member

New PR sounds good @tiger9800

@tiger9800
Copy link
Contributor Author

I think the changes are still in. Though the change is incomplete, and I will finish it in with a new PR that starts using radix property of @JsonFormat annotation. We just need to merge FasterXML/jackson-annotations#321 first. I would appreciate if you could help with that @JooHyukKim.

@pjfanning
Copy link
Member

Just my opinion but I would prefer if this was removed from 2.x and only a 3.x target considered.

@tiger9800
Copy link
Contributor Author

Do you mean the new pull request or should we revert the changes from this one in 2.x?

@cowtowncoder
Copy link
Member

Agree wrt this targeting 3.1.
Note tho that annotation support needs to go in annotations 2.21 (PR is pointing to 2.x which is just fine).

@cowtowncoder
Copy link
Member

Do you mean the new pull request or should we revert the changes from this one in 2.x?

New PR with changes targeting 3.x. Changes were reverted from 2.x already.

@tiger9800
Copy link
Contributor Author

I see it in my 2.x local branch after pulling, but I guess there is a different 2.x branch somewhere. I will make the new PR targeting 3.x once the annotation change is merged.

@cowtowncoder
Copy link
Member

@tiger9800 Just merged annotations changes -- should be available via 2.21-SNAPSHOT

@cowtowncoder
Copy link
Member

I see it in my 2.x local branch after pulling, but I guess there is a different 2.x branch somewhere.

Main Github repo has 2.x branch too. The fact your remote repo (fork) used same name somehow contributed to accidental merge I did. Fwtw.

@tiger9800
Copy link
Contributor Author

I pulled the 3.x branch, but it does not look like radix made it to JsonFormat for some reason. Anything special I need to do?

@pjfanning
Copy link
Member

pjfanning commented Nov 18, 2025

Jackson-annotations remains as a 2.x only release. Ignore any 3.x snapshots. Use com.fasterxml.jackson.core jackson-annotations 2.21-SNAPSHOT.
(it will be pulled by jackson-databind from 3.x branch (3.1.0-SNAPSHOT))

@pjfanning
Copy link
Member

@tiger9800
Copy link
Contributor Author

When I look at the version pulled in from jackson bom, I see <jackson.version.annotations>2.21-SNAPSHOT</jackson.version.annotations>.

However, I see that it says that 2.21 is not released yet in the release notes hence databind cannot use it.

@pjfanning
Copy link
Member

pjfanning commented Nov 18, 2025

When I look at the version pulled in from jackson bom, I see <jackson.version.annotations>2.21-SNAPSHOT</jackson.version.annotations>.

However, I see that it says that 2.21 is not released yet in the release notes hence databind cannot use it.

Your PR can use jackson-annotations 2.21-SNAPSHOT - we will ensure that the jars are released in the right order.

If you create a branch based on jackson-databind 3.x branch, that build should already depend on jackson-annotations 2.21-SNAPSHOT.

@cowtowncoder
Copy link
Member

@tiger9800 Things "should just work" when starting branch from 3.x -- it has version 3.1.0-SNAPSHOT and depends on matching SNAPSHOT versions of its dependencies. At worst you may need to use -U flag for Maven to force update (reload) SNAPSHOT dependencies.

@tiger9800
Copy link
Contributor Author

After running mvn clean install -U, this is what I see for JsonFormat (i.e. radix missing):

public @interface JsonFormat
{
    /**
     * Value that indicates that default {@link java.util.Locale}
     * (from deserialization or serialization context) should be used:
     * annotation does not define value to use.
     */
    public final static String DEFAULT_LOCALE = "##default";

    /**
     * Value that indicates that default {@link java.util.TimeZone}
     * (from deserialization or serialization context) should be used:
     * annotation does not define value to use.
     *<p>
     * NOTE: default here does NOT mean JVM defaults but Jackson databindings
     * default, usually UTC, but may be changed on <code>ObjectMapper</code>.
     */
    public final static String DEFAULT_TIMEZONE = "##default";

    /**
     * Datatype-specific additional piece of configuration that may be used
     * to further refine formatting aspects. This may, for example, determine
     * low-level format String used for {@link java.util.Date} serialization;
     * however, exact use is determined by specific <code>JsonSerializer</code>
     */
    public String pattern() default "";

    /**
     * Structure to use for serialization: definition of mapping depends on datatype,
     * but usually has straight-forward counterpart in data format (JSON).
     * Note that commonly only a subset of shapes is available; and if 'invalid' value
     * is chosen, defaults are usually used.
     */
    public Shape shape() default Shape.ANY;

    /**
     * {@link java.util.Locale} to use for serialization (if needed).
     * Special value of {@link #DEFAULT_LOCALE}
     * can be used to mean "just use the default", where default is specified
     * by the serialization context, which in turn defaults to system
     * defaults ({@link java.util.Locale#getDefault()}) unless explicitly
     * set to another locale.
     */
    public String locale() default DEFAULT_LOCALE;

    /**
     * {@link java.util.TimeZone} to use for serialization (if needed).
     * Special value of {@link #DEFAULT_TIMEZONE}
     * can be used to mean "just use the default", where default is specified
     * by the serialization context, which in turn defaults to system
     * default (UTC) unless explicitly set to another timezone.
     */
    public String timezone() default DEFAULT_TIMEZONE;

    /**
     * Property that indicates whether "lenient" handling should be enabled or
     * disabled. This is relevant mostly for deserialization of some textual
     * datatypes, especially date/time types.
     *<p>
     * Note that underlying default setting depends on datatype (or more precisely
     * deserializer for it): for most date/time types, default is for leniency
     * to be enabled.
     *
     * @since 2.9
     */
    public OptBoolean lenient() default OptBoolean.DEFAULT;

@cowtowncoder
Copy link
Member

@tiger9800 I am not sure how you get the sources, but have a look at jar they come from, it is likely an older version: needs to be "2.21-SNAPSHOT".

Jackson-annotations, branch 2.x has:

    /**
     * Property that indicates whether "lenient" handling should be enabled or
     * disabled. This is relevant mostly for deserialization of some textual
     * datatypes, especially date/time types.
     *<p>
     * Note that underlying default setting depends on datatype (or more precisely
     * deserializer for it): for most date/time types, default is for leniency
     * to be enabled.
     *
     * @since 2.9
     */
    public OptBoolean lenient() default OptBoolean.DEFAULT;

    /**
     * Property that indicates the numeric base used to output {@link java.lang.Number} properties when 
{@link Shape#STRING}
     * is specified.
     * For example, if 2 is used, then the output will be a binary representation of a number as a strin
g,
     * and with 16, the number will be outputted in the hexadecimal form.
     *
     * @since 2.21
     */
    public int radix() default DEFAULT_RADIX;

merged via

commit 437705ad1272893f80e5b8c22f09eee74b697071
Author: Davyd Fridman <[email protected]>
Date:   Wed Nov 12 13:32:52 2025 -0600

    Add radix property to JsonFormat (#320) (#321)

and CI-built and published to Sonatype snapshot repo.

So something in your system is stale. It could be jackson-base or jackson-bom bringing in, say, version 2.20.

@tiger9800
Copy link
Contributor Author

The name of the jar says it's 2.21: jackson-annotations-2.21-20250909.010129-3-sources.jar

@cowtowncoder
Copy link
Member

cowtowncoder commented Nov 20, 2025 via email

@tiger9800
Copy link
Contributor Author

I am pulling the right dependency now. I have the change, and I am trying to debug it with my test. mvn test command works and reports errors but when I am trying to run through Intellij I run into:

/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/bin/java -javaagent:/Users/davydfridman/Library/Caches/JetBrains/IdeaIC2025.2/captureAgent/debugger-agent.jar=file:///var/folders/4j/4_j70stx2gvd0zcfnc5xr3v80000gn/T/capture262733322912167640.props -ea --add-opens=java.base/java.lang=tools.jackson.databind --add-opens=java.base/java.util=tools.jackson.databind -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=54329 -Dkotlinx.coroutines.debug.enable.creation.stack.trace=false -Ddebugger.agent.enable.coroutines=true -Dkotlinx.coroutines.debug.enable.flows.stack.trace=true -Dkotlinx.coroutines.debug.enable.mutable.state.flows.stack.trace=true --add-modules tools.jackson.databind --add-modules org.junit.platform.launcher -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit5-rt.jar:/Applications/IntelliJ IDEA CE.app/Contents/plugins/junit/lib/junit-rt.jar:/Users/davydfridman/.m2/repository/org/junit/jupiter/junit-jupiter/5.14.1/junit-jupiter-5.14.1.jar:/Users/davydfridman/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/davydfridman/.m2/repository/org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar:/Users/davydfridman/.m2/repository/com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar:/Users/davydfridman/.m2/repository/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar:/Users/davydfridman/.m2/repository/com/google/guava/guava/32.0.1-jre/guava-32.0.1-jre.jar:/Users/davydfridman/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:/Users/davydfridman/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/davydfridman/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar -p /Users/davydfridman/.m2/repository/org/junit/platform/junit-platform-launcher/1.14.1/junit-platform-launcher-1.14.1.jar:/Users/davydfridman/.m2/repository/org/junit/vintage/junit-vintage-engine/5.14.1/junit-vintage-engine-5.14.1.jar:/Users/davydfridman/.m2/repository/junit/junit/4.13.2/junit-4.13.2.jar:/Users/davydfridman/.m2/repository/net/bytebuddy/byte-buddy/1.17.7/byte-buddy-1.17.7.jar:/Users/davydfridman/.m2/repository/org/junit/jupiter/junit-jupiter-params/5.14.1/junit-jupiter-params-5.14.1.jar:/Users/davydfridman/.m2/repository/tools/jackson/core/jackson-core/3.1.0-SNAPSHOT/jackson-core-3.1.0-20251127.230955-27.jar:/Users/davydfridman/.m2/repository/net/bytebuddy/byte-buddy-agent/1.17.7/byte-buddy-agent-1.17.7.jar:/Users/davydfridman/.m2/repository/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar:/Users/davydfridman/Desktop/Open Source/jackson-databind/target/classes:/Users/davydfridman/Desktop/Open Source/jackson-databind/target/test-classes:/Users/davydfridman/.m2/repository/org/objenesis/objenesis/3.3/objenesis-3.3.jar:/Users/davydfridman/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.21-SNAPSHOT/jackson-annotations-2.21-20251126.015225-11.jar:/Users/davydfridman/.m2/repository/org/junit/platform/junit-platform-commons/1.14.1/junit-platform-commons-1.14.1.jar:/Users/davydfridman/.m2/repository/org/junit/jupiter/junit-jupiter-api/5.14.1/junit-jupiter-api-5.14.1.jar:/Users/davydfridman/.m2/repository/org/assertj/assertj-core/3.27.2/assertj-core-3.27.2.jar:/Users/davydfridman/.m2/repository/org/mockito/mockito-core/5.20.0/mockito-core-5.20.0.jar:/Users/davydfridman/.m2/repository/com/google/guava/guava-testlib/32.0.1-jre/guava-testlib-32.0.1-jre.jar:/Users/davydfridman/.m2/repository/org/opentest4j/opentest4j/1.3.0/opentest4j-1.3.0.jar:/Users/davydfridman/.m2/repository/org/junit/jupiter/junit-jupiter-engine/5.14.1/junit-jupiter-engine-5.14.1.jar:/Users/davydfridman/.m2/repository/org/junit/platform/junit-platform-engine/1.14.1/junit-platform-engine-1.14.1.jar com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit5 tools.jackson.databind.format.CollectionFormatShapeTest

org.junit.platform.launcher.core.DiscoveryIssueException: TestEngine with ID 'junit-vintage' encountered a critical issue during test discovery:

(1) [ERROR] ClassSelector [className = 'tools.jackson.databind.format.CollectionFormatShapeTest', classLoader = null] resolution failed
    Source: ClassSource [className = 'tools.jackson.databind.format.CollectionFormatShapeTest', filePosition = null]
            at tools.jackson.databind.format.CollectionFormatShapeTest.<no-method>(SourceFile:0)
    Cause: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: tools.jackson.databind.format.CollectionFormatShapeTest
	at [email protected]/org.junit.platform.engine.discovery.ClassSelector.lambda$getJavaClass$0(ClassSelector.java:98)
	at [email protected]/org.junit.platform.commons.function.Try$Failure.getOrThrow(Try.java:335)
	at [email protected]/org.junit.platform.engine.discovery.ClassSelector.getJavaClass(ClassSelector.java:97)
	at [email protected]/org.junit.vintage.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:47)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1685)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:149)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:118)
	at [email protected]/org.junit.vintage.engine.discovery.VintageDiscoverer.discover(VintageDiscoverer.java:42)
	at [email protected]/org.junit.vintage.engine.VintageTestEngine.discover(VintageTestEngine.java:62)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:195)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:174)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:119)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:84)
	at [email protected]/org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:104)
	at [email protected]/org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:91)
	at [email protected]/org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at [email protected]/org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$1(InterceptingLauncher.java:39)
	at [email protected]/org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
	at [email protected]/org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:38)
	at [email protected]/org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at [email protected]/org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:66)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:66)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:231)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.ClassNotFoundException: tools.jackson.databind.format.CollectionFormatShapeTest
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:534)
	at java.base/java.lang.Class.forName(Class.java:513)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.lambda$tryToLoadClass$10(ReflectionUtils.java:885)
	at [email protected]/org.junit.platform.commons.function.Try.lambda$call$0(Try.java:57)
	at [email protected]/org.junit.platform.commons.function.Try.of(Try.java:93)
	at [email protected]/org.junit.platform.commons.function.Try.call(Try.java:57)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:872)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:809)
	at [email protected]/org.junit.platform.commons.support.ReflectionSupport.tryToLoadClass(ReflectionSupport.java:100)
	at [email protected]/org.junit.platform.engine.discovery.ClassSelector.getJavaClass(ClassSelector.java:95)
	... 37 more


org.junit.platform.launcher.core.DiscoveryIssueException: TestEngine with ID 'junit-jupiter' encountered a critical issue during test discovery:

(1) [ERROR] ClassSelector [className = 'tools.jackson.databind.format.CollectionFormatShapeTest', classLoader = null] resolution failed
    Source: ClassSource [className = 'tools.jackson.databind.format.CollectionFormatShapeTest', filePosition = null]
            at tools.jackson.databind.format.CollectionFormatShapeTest.<no-method>(SourceFile:0)
    Cause: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: tools.jackson.databind.format.CollectionFormatShapeTest
	at [email protected]/org.junit.platform.engine.discovery.ClassSelector.lambda$getJavaClass$0(ClassSelector.java:98)
	at [email protected]/org.junit.platform.commons.function.Try$Failure.getOrThrow(Try.java:335)
	at [email protected]/org.junit.platform.engine.discovery.ClassSelector.getJavaClass(ClassSelector.java:97)
	at [email protected]/org.junit.jupiter.engine.discovery.ClassSelectorResolver.resolve(ClassSelectorResolver.java:87)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.lambda$resolve$2(EngineDiscoveryRequestResolution.java:135)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1685)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:129)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:527)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:647)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:189)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolve(EngineDiscoveryRequestResolution.java:126)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.resolveCompletely(EngineDiscoveryRequestResolution.java:92)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolution.run(EngineDiscoveryRequestResolution.java:83)
	at [email protected]/org.junit.platform.engine.support.discovery.EngineDiscoveryRequestResolver.resolve(EngineDiscoveryRequestResolver.java:149)
	at [email protected]/org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:63)
	at [email protected]/org.junit.jupiter.engine.JupiterTestEngine.discover(JupiterTestEngine.java:70)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverEngineRoot(EngineDiscoveryOrchestrator.java:195)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discoverSafely(EngineDiscoveryOrchestrator.java:174)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:119)
	at [email protected]/org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.discover(EngineDiscoveryOrchestrator.java:84)
	at [email protected]/org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:104)
	at [email protected]/org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:91)
	at [email protected]/org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at [email protected]/org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$1(InterceptingLauncher.java:39)
	at [email protected]/org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
	at [email protected]/org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:38)
	at [email protected]/org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
	at [email protected]/org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:66)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:66)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:231)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.ClassNotFoundException: tools.jackson.databind.format.CollectionFormatShapeTest
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:534)
	at java.base/java.lang.Class.forName(Class.java:513)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.lambda$tryToLoadClass$10(ReflectionUtils.java:885)
	at [email protected]/org.junit.platform.commons.function.Try.lambda$call$0(Try.java:57)
	at [email protected]/org.junit.platform.commons.function.Try.of(Try.java:93)
	at [email protected]/org.junit.platform.commons.function.Try.call(Try.java:57)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:872)
	at [email protected]/org.junit.platform.commons.util.ReflectionUtils.tryToLoadClass(ReflectionUtils.java:809)
	at [email protected]/org.junit.platform.commons.support.ReflectionSupport.tryToLoadClass(ReflectionSupport.java:100)
	at [email protected]/org.junit.platform.engine.discovery.ClassSelector.getJavaClass(ClassSelector.java:95)
	... 36 more


Process finished with exit code 255

I thought maybe it was my change but after dropping my commit I still see the same issue with other tests. Any chance you know what is happening?

@JooHyukKim
Copy link
Member

@tiger9800 test actions seem to be passing, so try clearing library cache

@tiger9800
Copy link
Contributor Author

@JooHyukKim I think the actions use maven and mvn test work locally for me too. However, I cannot debug with maven, so I tried using Intellij and saw the error above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-received PR already covered by CLA (optional label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants