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

Interface with defaults invalid compiler warning for Serializable

XMLWordPrintable

    • b39
    • x86_64
    • linux_ubuntu

        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.

              jjg Jonathan Gibbons
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: