Bug 162903 - SuppressWarnings and NON-NLS'd strings as errors
Summary: SuppressWarnings and NON-NLS'd strings as errors
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-31 09:34 EST by Rafael Chaves CLA
Modified: 2006-12-12 13:55 EST (History)
0 users

See Also:


Attachments
Proposed fix (1022 bytes, patch)
2006-10-31 14:50 EST, Olivier Thomann CLA
no flags Details | Diff
Updated regression tests (4.12 KB, patch)
2006-10-31 14:50 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Chaves CLA 2006-10-31 09:34:41 EST
Eclipse 3.2

This seems to hit an integration problem between the compiler and APT.

Setting the compiler to mark non-externalized strings as errors does not work properly for code annotated with SupressWarnings("nls") (or "all").

The effect is that the compiler will generate code throwing an error for unresolved compilation problems, but the IDE will show no indication that the code has errors. The only way of finding out about the errors is by running the code. The expected effect is that either markers are created for non-externalized strings, or the compiler generates code that does not report errors (the former is better).

To reproduce, create a Java project with project-specific compiler settings that will report non-externalized strings as compiler errors, and put the class below in it:

public class Main {
  @SuppressWarnings("nls")
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}
Comment 1 Olivier Thomann CLA 2006-10-31 10:41:51 EST
SuppressWarnings is designed to remove warnings not errors.
If you set them as error, then simply fix them.
SuppressWarnings as its name says is used to remove warnings. So leave them as warnings and use SuppressWarnings where you don't want them to be reported.
Closing as INVALID.
Comment 2 Rafael Chaves CLA 2006-10-31 11:00:12 EST
What I said is that if I set non-externalized strings to be signaled as errors, no problem markers will be created by the builder for code that is annotated with SuppressWarnings("nls"). This is what is wrong.

> SuppressWarnings is designed to remove warnings not errors.

This is *exactly* what this PR is about. SuppressWarnings is suppressing errors (it shouldn't, it should only suppress warnings), but the compiler is properly "reporting" them (by generating code that throws an error).

Reopening for reconsideration. If this is APT (not Core) please reassign as appropriate.
Comment 3 Olivier Thomann CLA 2006-10-31 13:44:56 EST
Reproduced.
Comment 4 Olivier Thomann CLA 2006-10-31 14:25:55 EST
Sorry I read it too quickly. I believe the fix is quite simple.
I'll run our tests before releasing it.
It won't be part of 3.3M3 since our contribution for M3 is already done.
Comment 5 Olivier Thomann CLA 2006-10-31 14:50:06 EST
Created attachment 53020 [details]
Proposed fix
Comment 6 Olivier Thomann CLA 2006-10-31 14:50:20 EST
Created attachment 53022 [details]
Updated regression tests
Comment 7 Rafael Chaves CLA 2006-11-01 07:58:13 EST
No worries. Thanks for promptly looking into it.
Comment 8 Olivier Thomann CLA 2006-11-06 16:49:01 EST
Released for 3.3M4.
Comment 9 Frederic Fusier CLA 2006-12-12 13:55:01 EST
Verified for 3.3 M4 using build I20061212-0010.