Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations on Java8 default interface are ignored #160

Open
freddyboucher opened this issue Oct 3, 2019 · 1 comment
Open

Annotations on Java8 default interface are ignored #160

freddyboucher opened this issue Oct 3, 2019 · 1 comment

Comments

@freddyboucher
Copy link
Collaborator

freddyboucher commented Oct 3, 2019

The following code will work as expected with the real Jackson library but it will fail will gwt-jackson.

    public static interface InterfaceBean {
        @JsonIgnore
        default String getName(){
            return "defaultName";
        }
    }

Find attached a branch to reproduce the issue: freddyboucher@6ac68d2

I also opened this GWT thread: https://groups.google.com/forum/#!topic/google-web-toolkit/JqHMFcrHKDI

freddyboucher added a commit to freddyboucher/gwt-jackson that referenced this issue Oct 3, 2019
@freddyboucher
Copy link
Collaborator Author

As of latest GWT 2.8.2, we cannot fix this issue because default methods are not exposed in Generator.

I'm quoting Thomas Broyer

This is a known (and on-purpose) limitation; see gwtproject/gwt#9371 (tl;dr: exposing the method like any other would have been a breaking change for all existing generators, which would have wanted to implement the method, unless they are updated to recognize them as default methods; and for static methods it would have really broken many generators which would have tried to override the static method!).
Because we want to encourage migration of generators to annotation processors, there was no pressing need to support it in generators; so generators (and users of generators!) cannot take advantage of static or default methods on interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant