<%@ include page="/something.inc" %>
When I start to compile this site against Java 5/6, I get the following error message:
[javac] Note: Some input files use unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
I found a poster on your site from back in 2007 who was experiencing this exact same problem. Unfortunately, the best answer back in 2007 was to ignore the warnings. My webapp has thousands of these warnings and I would really like to find a better resolution.
For reference, here is the thread from 2007:
Does anyone have any new/better ideas about how to resolve the unchecked warnings when using taglibs in JSP pages on java 5/6? Thanks!
Jeanne Boyarsky wrote:Legacy code has scriptlets unless you can refactor it and the warnings are valid.
Actually the problem in that old thread (and this one as well) was JSP tags which perform unchecked operations. From my understanding, a scriplet is java code directly in the JSP page. A JSP tag is something like <jsp:include>. If the problem was in a scriplet, I could easily edit the scriplet to correct the unchecked operation. Since the problem is in a tag, I would need to obtain the source code of the taglib and make changes to it. So in summary, the problem is not related to scriplets but JSP tags.
Bear Bibeault wrote:What is being included by the JSP include tags? JSP files containing scriptlets perhaps?
The JSP file being included does not have any scriplets. The included JSP tag contains a long list of JSP includes. Here is small excerpt:
When I run the compile with Xlint:unchecked, the error is from the include tag itself and not the content being included. Here is the more detailed warning:
warning: [unchecked] unchecked call to add(E) as a member of the raw type java.util.Vector
The only reference to "something.inc" is the name of the file being included. The phrase "something.inc" does not appear anywhere in the file named "something.inc". The poster from the previous thread in 2009 actually pulled up the source code for the offending tag and found the following:
How are you "compiling" this code? Is it precompiling your JSPs?
I don't know any way to avoid this issue, except by ignoring those errors.
Maybe you can upgrade the servlet container? What are you using right now?
A newer container may generate code that doesn't generate compile warnings...