You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@johnzon.apache.org by "Markus Karg (Jira)" <ji...@apache.org> on 2019/10/07 13:34:00 UTC

[jira] [Closed] (JOHNZON-276) StackOverflowError in DefaultPropertyVisibilityStrategy

     [ https://issues.apache.org/jira/browse/JOHNZON-276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Markus Karg closed JOHNZON-276.
-------------------------------
    Resolution: Won't Fix

According to general concensus among the contributors, this issue will not get fixed.

> StackOverflowError in DefaultPropertyVisibilityStrategy
> -------------------------------------------------------
>
>                 Key: JOHNZON-276
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-276
>             Project: Johnzon
>          Issue Type: Bug
>          Components: JSON-B
>    Affects Versions: 1.2.1
>            Reporter: Markus Karg
>            Priority: Major
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> The following code produces a StackOverflowError:
> @JsonVisibility(DefaultPropertyVisibilityStrategy.class)
> 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
(v8.3.4#803005)