Bug 243917 - [compiler] should not warn about unused field when native method present
Summary: [compiler] should not warn about unused field when native method present
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 trivial (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 360832
  Show dependency tree
 
Reported: 2008-08-12 13:43 EDT by Paulo R. Panhoto CLA
Modified: 2015-05-19 13:28 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (3.85 KB, patch)
2010-01-08 06:44 EST, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paulo R. Panhoto CLA 2008-08-12 13:43:10 EDT
I have a class simple as this:

/*
 * Created on 19/05/2008
 */
package br.com.voicetechnology.vp.brooktrout.tasks;

import java.io.IOException;

import br.com.voicetechnology.vp.provider.Device;

public class WaitForCall implements ChannelTask
{
	static
	{
		System.loadLibrary("tpbrooktrout");
	}
	
	private final int time;
	
	public WaitForCall(int delay)
	{
		time = delay;
	}

	public native void run(Device d) throws IOException;

}

which has a variable and a native method. In the presence of a native method, eclipse has no way to tell whether this variable is being used locally or not. Still, it issues warning message. There should be an option, at best to set whether I want or not this warning in the presence of native methods or, at least, the platform should issue no warning at all for this circumstance.
Comment 1 Dani Megert CLA 2008-08-13 03:03:11 EDT

*** This bug has been marked as a duplicate of bug 55696 ***
Comment 2 Dani Megert CLA 2008-08-13 03:04:49 EDT
Actually not a dup.
Comment 3 Srikanth Sankaran CLA 2010-01-06 00:19:58 EST
Dani,
    
    What is the JDT/UI team's take on the option suggestion below ? Do you
want to expose this to the user or have JDT/Core conservatively suppress the
warning in the presence of native methods ? -- Thanks.


(In reply to comment #0)

> which has a variable and a native method. In the presence of a native method,
> eclipse has no way to tell whether this variable is being used locally or not.
> Still, it issues warning message. There should be an option, at best to set
> whether I want or not this warning in the presence of native methods or, at
> least, the platform should issue no warning at all for this circumstance.
Comment 4 Dani Megert CLA 2010-01-06 04:34:23 EST
Flagging it as problem is wrong and should be fixed. There's no need for an additional option.
Comment 5 Srikanth Sankaran CLA 2010-01-08 06:44:29 EST
Created attachment 155588 [details]
Proposed patch
Comment 6 Srikanth Sankaran CLA 2010-01-09 01:16:23 EST
Released in HEAD for 3.6M5
Comment 7 Olivier Thomann CLA 2010-01-25 14:38:56 EST
Verified for 3.6M5 using I20100125-0800