johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Karg (Jira)" <>
Subject [jira] [Created] (JOHNZON-276) StackOverflowError in DefaultPropertyVisibilityStrategy
Date Wed, 18 Sep 2019 07:05:00 GMT
Markus Karg created JOHNZON-276:

             Summary: StackOverflowError in DefaultPropertyVisibilityStrategy
                 Key: JOHNZON-276
             Project: Johnzon
          Issue Type: Bug
          Components: JSON-B
    Affects Versions: 1.2.1
            Reporter: Markus Karg

The following code produces a StackOverflowError:


public final class C {

  @JsonProperty private boolean foo;


The problem is caused by the fact that this strategy tries to compare "this" by "==" with
a _new instance_ of itself, which certainly fails, because the new copy is definitively a
different reference than the one currently executed and instantiated due to the class annotation.

The fix is simple: Adding an equals method just comparing the class type (as the strategy
has no members other than a cache), and calling that instead of "==".

This message was sent by Atlassian Jira

View raw message