Constants for @SuppressWarnings (original) (raw)
Paul Benedict pbenedict at apache.org
Wed Oct 14 17:42:55 UTC 2009
- Previous message: Fix for 5015163, and my first webrev
- Next message: hg: jdk7/tl/langtools: 6838467: JSR199 FileObjects don't obey general contract of equals.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 the javadoc: 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?
Paul
- Previous message: Fix for 5015163, and my first webrev
- Next message: hg: jdk7/tl/langtools: 6838467: JSR199 FileObjects don't obey general contract of equals.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]