This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 245141 - "No definition of serialVersionUID" hint on serializable interface with default methods
Summary: "No definition of serialVersionUID" hint on serializable interface with defau...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-19 11:16 UTC by Leperous
Modified: 2014-07-30 02:33 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leperous 2014-06-19 11:16:03 UTC
If an interface that extends Serializable is defined, and a default method is written, then a hint to add a serialVersionUID may be displayed (if enabled). This is incorrect as a (private) serialVersionUID field cannot be defined in an interface. This does not occur on interfaces without default methods.

For example:

interface Blah extends java.io.Serializable {

  default int one() { return 1; }

}

The associated refactoring tries to modify this to the following, which does not compile:

interface Blah extends java.io.Serializable {

  private static final long serialVersionUID = 1L;

  default int one() { return 1; }

}
Comment 1 Svata Dedic 2014-07-15 19:42:51 UTC
default java algorithm which computes serialVersionUID does not include interface methods when serializing a class. There are a couple of JDK bugs related to this feature:

https://bugs.openjdk.java.net/browse/JDK-6356530
http://bugs.java.com/view_bug.do?bug_id=6368570

I will disable the warning, further changes may come based on the referenced bug resolution.

Fixed in jet-main#c27ec1bc71ab
Comment 2 Quality Engineering 2014-07-30 02:33:24 UTC
Integrated into 'main-silver', will be available in build *201407300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/c27ec1bc71ab
User: Svata Dedic <sdedic@netbeans.org>
Log: #245141: warning about serialversionuid in interface filtered out