Bug 315912 - Switching unusedWarningToken has no immediate effect
Summary: Switching unusedWarningToken has no immediate effect
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-06 15:46 EDT by Aaron Digulla CLA
Modified: 2011-01-25 12:36 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Digulla CLA 2010-06-06 15:46:47 EDT
Build Identifier: I20100527-1700

I'm using PMD to enhance the quality of my code. When I set the compiler option

org.eclipse.jdt.core.compiler.problem.unusedWarningToken

from "warning" to "ignore", the warnings don't go away even when I do a clean of the project. After a restart of Eclipse, they are gone (eventually; can't reproduce). When I enable the warnings again, they don't show up.

Reproducible: Always

Steps to Reproduce:
1. Add @SuppressWarnings({"nls", "PMD.AvoidDuplicateLiterals"}) somewhere in your code.

2. Switch the compiler setting "Java Compiler" / "Errors/Warnings" / "Annotations" / "Unused @SuppressWarnings token:" between "Warning" and "Ignore".
Comment 1 Dani Megert CLA 2010-06-07 08:45:27 EDT
It works for built-in categories (e.g. "nls"). Could be a problem of the PMD compiler participant or annotation processor.

Moving to JDT Core for comment.
Comment 2 Olivier Thomann CLA 2010-06-07 10:28:28 EDT
Please describe how to setup an environment to reproduce this issue.
Comment 3 Aaron Digulla CLA 2010-06-08 03:59:56 EDT
... PEBKAC

But since I wrote it, here is how to do it:

1. Download Eclipse 3.6RC4 (http://download.eclipse.org/eclipse/downloads/drops/S-3.6RC4-201006031500/index.php)

2. Install the PMD plugin from http://pmd.sourceforge.net/integrations.html#eclipse (Update site: http://pmd.sf.net/eclipse )

3. Create a new project

4. Enable PMD in the project properties.

5. In the compiler options for the project, enable "Enable project specific settings" and then, under "Code Style", change "Non-externalized strings" (last option) to "Warning".

6. Paste this code into the project:

---------------- cut here ----------------------
package demo;

public class Demo {
	public String test () throws Exception
	{
		return "xxx";
	}
}
---------------- cut here ----------------------

You should get two warnings.

7. Go to the "xxx" and select "Add @SuppressWarnings 'nls' to 'test()'" from the quick fix menu

8. Change the @SuppressWarnings to

@SuppressWarnings({"nls", "PMD"})

9. Now one warning should be left: Unsupported @SuppressWarnings("PMD")

10. Open the compiler options again and open the "Annotations" group. Set "Unhandled token in '@SuppressWarnings'" to "Ignore".

11. Click OK to recompile ... damn :-(

Resolution: I probably mixed up "Unhandled token" and "Unused token".
Comment 4 Olivier Thomann CLA 2011-01-25 11:18:05 EST
Verified.
Comment 5 Olivier Thomann CLA 2011-01-25 12:36:59 EST
Verified.