Bug 409303 - [batch][compiler][options] "-warn:+unused" should include unusedAllocation
Summary: [batch][compiler][options] "-warn:+unused" should include unusedAllocation
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.14 M1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-28 11:39 EDT by Markus Keller CLA
Modified: 2019-10-09 19:44 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2013-05-28 11:39:05 EDT
task-using_batch_compiler.htm said that the "-warn:+unused" command-line argument would also include unusedAllocation, but the code in org.eclipse.jdt.internal.compiler.batch.Main doesn't do that. In contrast, @SuppressWarnings("unused") does suppress unused allocation warnings.

I've fixed the documentation with bug 391643.

To help the team avoid such mistakes in the future, also sort the options alphabetically in the code. Then it becomes trivial to always update the documentation at the same time something is changed in the Main class.
Comment 1 Jay Arthanareeswaran CLA 2013-06-07 00:49:47 EDT
Markus, if I understand it correctly, this bug is only to sort the options in the code, isn't it?
Comment 2 Markus Keller CLA 2013-06-07 04:09:46 EDT
No, I should have repeated the summary in the description: "-warn:+unused" should include unusedAllocation. It was just too late for code changes when I discovered this, so the best "solution" at that time was to adapt the documentation to the reality.

The fix should:
- sort the options in the code
- add OPTION_ReportUnusedObjectAllocation to the "unused" macro
- re-add "unusedAllocation" to the "unused" macro in task-using_batch_compiler.htm
Comment 3 Jay Arthanareeswaran CLA 2013-06-07 04:13:36 EDT
(In reply to comment #2)
> No, I should have repeated the summary in the description: "-warn:+unused"
> should include unusedAllocation. It was just too late for code changes when
> I discovered this, so the best "solution" at that time was to adapt the
> documentation to the reality.

Ah, I see. I assumed you were just happy with the documentation being adjusted to reflect the current behavior. Anyway, thanks for clarifying.
Comment 4 Eclipse Genie CLA 2019-09-05 07:57:40 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 5 Eclipse Genie CLA 2019-10-03 16:34:56 EDT
New Gerrit change created: https://git.eclipse.org/r/150560
Comment 6 Stephan Herrmann CLA 2019-10-03 16:36:08 EDT
(In reply to Eclipse Genie from comment #5)
> New Gerrit change created: https://git.eclipse.org/r/150560

unusedAllocation wasn't the only thing that ran out of sync.

So, I sorted sub-options of "unused" in 
 - CompilerOptions.warningTokenFromIrritant(int)
 - o.e.j.i.compiler.batch.Main.handleErrorOrWarningToken(String, boolean, int)

I used the former as the master and added in the latter (batch compiler):
+ OPTION_ReportDeadCode
+ OPTION_ReportRedundantSuperinterface
+ OPTION_ReportUnusedExceptionParameter


***********************
Now for some good news:
***********************
With these changes BatchCompilerTest begged for reverting some changes:

from
	"At least one of the problems in category 'unused' is not analysed due to a compiler option being ignored\n" + 

back to
	"Unnecessary @SuppressWarnings(\"unused\")\n" +

Woohooo :)
Comment 9 Stephan Herrmann CLA 2019-10-03 17:37:29 EDT
(In reply to Eclipse Genie from comment #8)
> Gerrit change https://git.eclipse.org/r/150560 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/
> ?id=9f7623dbf89718c901b626f8024cbc33b5147b6e

Code changes released for 4.14 M1
Comment 10 Manoj N Palat CLA 2019-10-09 19:44:10 EDT
Verified with ecj-I20191009-0600.jar for Eclipse 4.14 M1