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

Bug 360832

Summary: Native methods influence the "unused" method warning for other private members
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, jarthana, manoj.palat, markus.kell.r, satyam.kandula, srikanth_sankaran
Version: 3.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Bug Depends on: 243917    
Bug Blocks:    

Description Ayushman Jain CLA 2011-10-13 09:59:44 EDT
HEAD

class MyClass {
//private native void foo();

private void bar() {
//
}

}

abstract class MyClass1 {
abstract void foo();

private void bar() {
//
}
}

In the above case, commenting and uncommenting the native method foo in MyClass makes the unused warning on bar appear or disappear. The location of the native method i.e. whether defined before/after bar doesnt seem to matter.
Comment 1 Satyam Kandula CLA 2011-10-13 10:27:22 EDT
I believe this was intentional and fixed through bug 243917.
Comment 2 Markus Keller CLA 2015-05-19 13:28:20 EDT
The fix for bug 243917 was a bad idea and should be removed.

Static analysis doesn't work with non-Java accesses via natives and reflection. We accept that everywhere else, and there's no reason to deviate in this special case. @SuppressWarnings("unused") solves the problem.
Comment 3 Jay Arthanareeswaran CLA 2015-05-20 04:13:55 EDT
(In reply to Markus Keller from comment #2)
> The fix for bug 243917 was a bad idea and should be removed.
> 
> Static analysis doesn't work with non-Java accesses via natives and
> reflection. We accept that everywhere else, and there's no reason to deviate
> in this special case. @SuppressWarnings("unused") solves the problem.

Agree, esp. I don't like warnings to be suppressed without being given a choice. Let's take a call during 4.6.
Comment 4 Jay Arthanareeswaran CLA 2016-05-03 04:42:09 EDT
(In reply to Jay Arthanareeswaran from comment #3)
> Agree, esp. I don't like warnings to be suppressed without being given a
> choice. Let's take a call during 4.6.

That will have to be 4.7. I will put it on my plate so we this doesn't slip.
Comment 5 Manoj N Palat CLA 2018-05-21 06:07:12 EDT
Bulk move out of 4.8
Comment 6 Eclipse Genie CLA 2020-06-15 14:56:11 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 7 Eclipse Genie CLA 2022-06-08 05:48:52 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.