apache / apache/netbeans

Add defaultSerialVersionUID to all Serializable classes that haven't yet it

Open
#5,915 0 comments 0 reactions 0 assignees View on GitHub
kind:feature needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Description

Currently, if I have checked the Serialization checkbox under Tools > Options > Editor > Hints > Standard Javac Warnings I can find all classes missing a defaultSerialVersionUID looking in the Action Items window.

Unfortunately, if there are many classes I have to open each class to add a defaultSerialVersionUID. Luckily the editor helps me because when I put the cursor on the class declaration I type ALT+ENTER and I choose Add defaultSerialVersionUID. The problem is that I have to repeat these operations for each class.

I would like adding a defaultSerialVersionUID to all Serializable classes which don't has one yet.

That is a refactoring scenario, so I would like to proceed in this way:

1. left click on the project in Projects window
2. click Refactor
3. click Inspect and Transform
4. choose Single Inspection
5. choose Serialization under a Standard Javac Warnings section
6. click Inspect
7. click Transform

Many thanks for your help,
Tarin

### Use case/motivation

_No response_

### Related issues

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start with NetBeans' Refactor > Inspect and Transform flow and the Serialization inspection under Standard Javac Warnings. Trace how the existing Add defaultSerialVersionUID editor action is exposed, then determine how the inspection can apply that action across all reported classes. Done means a project-level Transform operation adds the missing defaultSerialVersionUID to every applicable Serializable class.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.