Bug 538041 - "Method can be static" warning not shown for recursive method
Summary: "Method can be static" warning not shown for recursive method
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-17 10:19 EDT by Jeff Brower CLA
Modified: 2022-09-10 09:32 EDT (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 Jeff Brower CLA 2018-08-17 10:19:39 EDT
Steps to reproduce:
- Enable "Method can be static" warnings
- Copy the method below into a class

Issue:
- Method could actually be static, but it is not being marked as such.

Resolution:
I am not familiar with the eclipse source code, but I assume the warning is shown when a method does not call *any* instance methods. The correct behavior would be to check that a method does not call any instance methods *other than itself*.

Code sample:

private int factorial(final int n) {
  return n < 2 ? 1 : n * factorial(n - 1);
}
Comment 1 Eclipse Genie CLA 2020-09-19 11:47:58 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 2 Eclipse Genie CLA 2022-09-10 09:32:12 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.