Bug 528410 - Wrong "can be declared as static" warning for readResolve() and writeReplace()
Summary: Wrong "can be declared as static" warning for readResolve() and writeReplace()
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7.1a   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact: Stephan Herrmann CLA
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2017-12-11 06:51 EST by Eugene Ryazanov CLA
Modified: 2023-12-24 14:40 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Ryazanov CLA 2017-12-11 06:51:36 EST
If "Method can be static" warning is enabled the following code compiles with two such warnings:

import java.io.Serializable;

class Tst implements Serializable {
	static class Ser implements Serializable {
		private Object readResolve() {
			return INSTANCE;
		}
	}

	static final Tst INSTANCE = new Tst();

	private Object writeReplace() {
		return new Ser();
	}
}

Both warnings are invalid for serializable classes. Suggested "Add 'static' modifier" fix breaks functionality of this methods.
Comment 1 Eclipse Genie CLA 2020-01-12 14:33:57 EST
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.
Comment 2 Stephan Herrmann CLA 2020-01-12 16:08:35 EST
This is a valid request. The analysis should know about the special semantics of serialization methods.
Comment 3 Eclipse Genie CLA 2022-01-02 01:11:57 EST
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.
Comment 4 Stephan Herrmann CLA 2022-01-02 06:42:19 EST
This looks like a perfect bug for a new contributor.
Comment 5 Eclipse Genie CLA 2023-12-24 14:40:10 EST
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.