webtier@glassfish.java.net

Re: [webtier] JSP Compilation error (Mixing Generics and Autoboxing) - Glassfish 2.1

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Mon, 07 Dec 2009 17:41:41 -0800

Rahul,

please see my evaluation of the issue you filed:

  https://glassfish.dev.java.net/issues/show_bug.cgi?id=11275

It is invalid. You could have done this simple check yourself.

In the future, please file a P1 only when it's justified. It was
certainly not justified in this case. I've added a link to the bug
filing guidelines for GlassFish to the bug report, and I repeat it
here for your and everybody else's convenience:

http://wiki.glassfish.java.net/Wiki.jsp?page=PrioSeverDef

In addition, casting 5 of your own votes for this non-issue seems
like a waste.

Jan

On 12/07/09 16:43, webtier_at_javadesktop.org wrote:
> In Glassfish 2.1, when we mix Generics with auto-boxing of variables, the JSP compiler throws an exception. To reproduce the problem you can do the following. <br/> <br/>
>
> In a web application create a java class say, "Macros.java" with the following method : <br/><br/>
>
> package com.tests; <br/><br/>
>
> import javax.servlet.http.HttpServletRequest; <br/><br/>
>
> public class Macros { <br/><br/>
>
> @SuppressWarnings("unchecked")<br/>
> public static <T> T attr(String attribute, HttpServletRequest request){<br/>
> return (T)request.getAttribute(attribute);<br/>
> }<br/><br/>
>
> }<br/>
>
> <br/><br/>
>
> The JSP is:<br/><br/>
>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <br/>
> <%_at_page contentType="text/html;charset=utf-8" session="false"%> <br/><br/>
>
> <%_at_page import="com.tests.Macros"%><br/><br/>
>
> &lt;%<br/><br/>
> request.setAttribute("integer", 24);<br/>
> [b]int a = RestMacros.attr("integer", request);<br/><br/>[/b]
> %&gt;<br/><br/>
>
> <html><br/>
> <head><br/>
> <title>GlassFish Test Page</title><br/>
> </head><br/>
> <body><br/>
> &lt;h2&gt;Test Attributes&lt;/h2&gt;<br/>
> &lt;ul>&lt;br/>
> &lt;li>&lt;%=a %>&lt;/li&gt;<br/>
> &lt;/ul><br/>
> </body><br/>
> </html><br/><br/>
>
> You get a compilation error : <br/>
>
> PWC6033: Unable to compile class for JSP PWC6197<br/>
> type parameters of T cannot be determined; no unique maximal instance exists for type <br/>variable T with upper bounds int,java.lang.Object <br/><br/>
>
> However, when you change <br/><br/>
>
> int a = RestMacros.attr("integer", request); --> Integer a = RestMacros.attr("integer", request); <br/><br/>
>
> there is no error. This is a bug in Glassfish 2.1. Are they any known workarounds / patches? <br/><br/>
>
> Thanks, <br/>
> Rahul
> [Message sent by forum member 'tikurahul' ]
>
> http://forums.java.net/jive/thread.jspa?messageID=375259
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: webtier-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: webtier-help_at_glassfish.dev.java.net
>
>