| Summary: | Missing serialVersionUID warning should not be shown for anonymous inner classes | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | musor102 |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | Ayushman Jain <amj87.iitr> |
| Severity: | normal | ||
| Priority: | P3 | CC: | amj87.iitr, arend, markus.kell.r, Sebastian.Dietrich |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
| Bug Depends on: | |||
| Bug Blocks: | 426320 | ||
This warning should not be shown for any kind of inner classes (not only anonymous inner classes) On the contraty, we should get a warning if we provida a serialVersioNUID for inner classes. *** Bug 426320 has been marked as a duplicate of this bug. *** This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Build Identifier: M20110210-1200 Per Java spec, serialization of inner classes is discouraged. Correct serialization/deserialization of an inner anonymous class is impossible. Sun admitted as much - Java Bug ID 4862448 requesting this feature was closed as "Not a Defect". Therefore "missing serialVersionUID" warning when such class is derived from a serializable base class is unnecessary. Presence of this superfluous warning, however, discourages, for example, this concise syntax for map init: Map<String, String> map = new HashMap<String, String>() {{ put("Harry", "Potter"); put("Ron", "Weasley"); put("Hermione", "Granger"); }}; This syntax produces an anonymous inner class derived from HashMap and overrides its default constructor. serialVersionUID is a very useful warning, but in this case it should not be displayed. Reproducible: Always Steps to Reproduce: 1. paste above example into code 2. Observe the warning