DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36582>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36582

           Summary: Eclipse JDT compiler bug in 5.5.11
           Product: Tomcat 5
           Version: 5.5.11
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


The latest IBM Eclipse JDT compiler that handles Java 5 and is included with
Tomcat 5.5.11 behaves differently than Sun's compiler. It doesn't seem to
implement autoboxing correctly with the conditional operator.  

method call in example code:  int getMinAge() //returns an int.

This line in a jsp
<%= type.getMinAge() < 0 ? "" : type.getMinAge() %>

becomes this line in the servlet version
out.print( type.getMinAge() < 0 ? "" : type.getMinAge() );


Sun's Java 5 compiler will compile the code above, IBM's won't.

Compile error:
An error occurred at line: 184 in the jsp file: /jsp/createConstraint.jsp
Generated servlet error:
Incompatible conditional operand types String and int



The following test class compiles and runs with Sun's 1.5. 
autoboxing converts the int to Integer 
==========

import java.io.*;

public class TernaryTest{

   static int getInt(){return 0;}

   public static void main(String[] args) throws Exception{
      PrintStream ps = new PrintStream("test.out");
      ps.println("");
      ps.println(getInt() < 0 ? "x" : getInt());
      ps.close();

      Object obj = (getInt() < 0 ? "x" : getInt());
      System.out.println("obj = " + obj);
   }
}

==========

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to