• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • DSO:L1
  • hhuynh
  • Reporter: rbodkin
  • May 01, 2007
  • 0
  • Watchers: 0
  • June 04, 2007
  • May 03, 2007

Description

Our application uses Java 5 syntax in JSPs and is hitting problems when running with Terracotta but works normally. For example this code:

HashMap<String,Long> times = (HashMap<String,Long>)request.getAttribute(“timings”);

long totalTime = System.currentTimeMillis() - times.remove(“total time”);

Results in a compiler error:

An error occurred at line: 35 in the jsp file: /footer.jsp Generated servlet error: The operator - is undefined for the argument type(s) long, Object

If I load a JSP on Tomcat without TC, then restart with TC it works fine, i.e., the bug is solely when compiling the JSP. Eugene believes that the TC bootjar has lost the generic parameter information javac needs so it doesn’t know that times.remove is a Long - it has only the raw type so it thinks it’s an Object.

Work-around options (to be tested): * plug in ant to compile JSPs forking javac and set the bootstrap path to the uninstrumented classes * precompile JSPs

Comments

Steve Harris 2007-05-01

Tim can you take a look at this?

Eugene Kuleshov 2007-05-01

It seems like javac see HashMap class from the bootjar that we put in there after renaming from HashMapTC.

Because HashMapTC is compiled with 1.4 it don’t have generics signatures and as a result javac can’t do type inference and unbox to long value (it thinks that collection has raw Object types). So, we need to put “signature” values for all methods that HashMapTC overwrite from the original HashMap class. We can hardcode those values in the bootjar tool, or maybe less preferable - maintain separate version of HashMapTC for Java 5.

Eugene Kuleshov 2007-05-01

To clarify, this particular error don’t really have much todo with jsp compilation. One would hit into it when running javac compiler anywhere with dso bootjar.

Steve Harris 2007-05-01

Is this something difficult to fix? Should we have antonio jump on it or is this something you can do?

Eugene Kuleshov 2007-05-01

I’ll fix this. It should be reasonable trivial.

Eugene Kuleshov 2007-05-03

Fix is in trunk now. Added test case into ParameterizedTypesTest

Fiona OShea 2007-05-30

verify that test works and bug is fixed

Hung Huynh 2007-05-30

verified