Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8191637

Interface with defaults invalid compiler warning for Serializable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 9.0.1, 10
    • Fix Version/s: 10
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b39
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Backports

        Description

        FULL PRODUCT VERSION :


        A DESCRIPTION OF THE PROBLEM :
        As I mentioned in this link: https://stackoverflow.com/questions/47390432/functional-interface-with-default-behavior-with-serializable

        I think the behavior of compiler is wrong.

        When an Interface with no default method extends Serializable everythings works fine. But When a default method for that interface comes in picture we have a warning that says:

        MyInterface.java: serializable class MyInterface has no definition of serialVersionUID
        It got intersting when I change that interface to a abstract class. The error disappears.

        To sum up the warning happening table is as below:

        |----------------------------|------------------|
        | Type | WARNING |
        |----------------------------|------------------|
        | interface with no defaults | NO |
        |----------------------------|------------------|
        | interface with defaults | YES |
        |----------------------------|------------------|
        | abstract class | NO |
        |----------------------------|------------------|
        Is there any reason for that or it's just a bug?




        REPRODUCIBILITY :
        This bug can be reproduced always.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jjg Jonathan Gibbons
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: