Suppressing Java unchecked warnings in JSP files

后端 未结 3 882
情书的邮戳
情书的邮戳 2021-01-17 14:13

I have a legacy webapp which uses jstl and Struts 1 tags. When I pre-compile the JSP files with Java 5/6, the jstl and Struts 1 tags throw warnings about \"unchecked or unsa

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-17 14:39

    Those messages are a (mandatory for JDK >= 1.5) note, not a warning.

    compiler.note.unchecked.plural=\
        Some input files use unchecked or unsafe operations.
    

    The default compiler behaviour is the same as with -Xlint:-unchecked.

    With -Xlint:unchecked you turn the warning on, reporting each instance.

    compiler.warn.unchecked.assign=\
        [unchecked] unchecked assignment: {0} to {1}
    ...
    

    Mandatory notes cannot be disabled individually, they are all disabled with -Xlint:none. Unfortunately, the rest of the warnings are also disabled.

    You can check other responses for alternatives, but filtering compiler output messages seems the easiest solution.

提交回复
热议问题