Bug 550255 - "The method X can be made static" ignores synchronized
Summary: "The method X can be made static" ignores synchronized
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.12   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-20 05:24 EDT by Ville Oikarinen CLA
Modified: 2023-08-07 12:08 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ville Oikarinen CLA 2019-08-20 05:24:49 EDT
If a method is made static, the meaning of a synchronized keyword in the signature changes, so it's not generally safe to let the quick-fix to do the change.

Of course accessing only static data in a non-static method and synchronizing on an instance is bad style, but still, the quick-fixes should play it safe.
Comment 1 Ville Oikarinen CLA 2019-08-26 01:41:15 EDT
In case my description wasn't clear enough:

Eclipse warns that a method can be made static when the method doesn't access anything non-static. But it fails to recognize the fact that the keyword synchronized actually does access the object instance i.e. something non-static. So the method actually cannot be made static without changing semantics.
Comment 2 Eclipse Genie CLA 2021-08-16 08:39:14 EDT
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 3 Eclipse Genie CLA 2023-08-07 12:08:30 EDT
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.