Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 426320

Summary: [quick fix] Add serial version ID does not work correctly on anonymous inner classes
Product: [Eclipse Project] JDT Reporter: Sebastian Dietrich <Sebastian.Dietrich>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 4.3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 343858    
Bug Blocks:    

Description Sebastian Dietrich CLA 2014-01-22 03:18:48 EST
QuickFix for serialVersionUID on an anonymous inner class does the following:

* when selecting "add default serial version ID"
  * generates a private static final long serialVersionUID = 1L;
* when selecting "add generated serial version ID":
  * Warning "The following problem occurred: Could not find class file. Make sure the file is compilable".
  * When clicking on OK, generates a private static final long serialVersionUID = 1L;


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".

--> There should be no warning/error in the first place (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=343858)
--> QuickFix for e.g. other serialVersionUID warinings in the same file should not affect (anonymous) inner classes
Comment 1 Dani Megert CLA 2014-01-22 06:46:30 EST
Once bug 343858 is fixed, the Quick Fix won't be available.

*** This bug has been marked as a duplicate of bug 343858 ***