https://bz.apache.org/bugzilla/show_bug.cgi?id=63898

            Bug ID: 63898
           Summary: JSP EL generation is wrong when using newer version of
                    Java 1.8 & tag class uses method overloading and
                    isELIgnored="false
           Product: Tomcat 9
           Version: 9.0.x
          Hardware: PC
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: EL
          Assignee: dev@tomcat.apache.org
          Reporter: jeffrey.lobe...@cerner.com
  Target Milestone: -----

JSP EL generation is wrong when using newer version of Java 1.8 & tag class
uses method overloading and isELIgnored="false. Our tag class has an overloaded
method, setValue(String) & setValue(Object).  The TLD file defines the tag
attribute as java.lang.Object.

    <attribute>
        <name>value</name>
        <required>true</required>
        <rtexprvalue>true</rtexprvalue>
        <type>java.lang.Object</type>
    </attribute>

All versions of tomcat using newer versions of Java 1.8 generate calls to
setValue(String) instead of setValue(Object).

// /tagUnitTests/sui/formatDate/ testCaliHDateTime1.jsp(20,0) name =
value type = java.lang.Object reqTime = true required = true fragment =
false deferredValue = false expectedTypeName = null deferredMethod =
false methodSignature = null
_jspx_th_sui_005fformatDate_005f0.setValue((java.lang.String)
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${chdt}",
java.lang.String.class,
(javax.servlet.jsp.PageContext)_jspx_page_context, null));

Here's an example JSP:
<%@ page language="java" contentType="text/html" isELIgnored="false" %>
<%@ page import="java.util.Date" %>
<%@ taglib uri="/WEB-INF/tld/suitags.tld" prefix="sui" %>

<%
Date chdt = new Date();
request.setAttribute("chdt", chdt);
%>

<sui:formatDate value="${chdt}" type="date" dateStyle="shortfull" />


Here's an example tag class

    public void setValue(final String value) {
    }
    public void setValue(final Object value) {
    }

If we delete the setValue(String) setter then tomcat generates the correct
setter call.  The issue appears when using >= 1.8.0.222.

Adopt jdk standard (1.8.0.222) issue
Oracle jdk shiny new (1.8.0.231) issue
Oracle jdk 4.3.100 style (1.8.0.201) no issue
Adopt jdk older (1.8.0.202) NO ISSUE.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to