Constants for @SuppressWarnings
pbenedict at apache.org
Wed Oct 14 10:42:55 PDT 2009
Question for anyone on the list. What do you think about adding a
limited number of String constants to identify common warning types? I
personally don't like raw string in my code and would prefer to use
constants for them.
I would prefer something like:
@SuppressWarnings(UNCHECKED) // static import from SuppressWarnings
My choices would be:
public static final String ALL = "all";
public static final String FALL_THROUGH = "fallthrough";
public static final String SERIAL = "serial";
public static final String UNCHECKED = "unchecked";
>From what I understand, the warnings are vendor specific, but reality
shows me there's a practical pool of constants already in use. From
> Compiler vendors should document the warning names they support in
> conjunction with this annotation type. They are encouraged to cooperate
> to ensure that the same names work across multiple compilers.
Would such a patch be considered?
More information about the core-libs-dev