tags:

views:

52

answers:

2

Recently I upgraded my development tomcat from 7.0.0 to 7.0.4. I had things like:

<c:set var="static" value=".." />
<c:set var="class" value=".." />

Both worked on 7.0.0 but stopped working on 7.0.4. I opened a bug, it was closed, with the answer that:

In and of itself, that tag will compile.

The checks for Java identifiers were added to the EL processing so I suspect you have some illegal EL elsewhere on the page.

This didn't sound quite clear, but I didn't get a subsequent answer, so I looked at the EL spec. For the JSP 2.1 (the latest being 2.2) I found that:

Chapter 1, page 21: An identifier is constrained to be a Java identifier - e.g., no -, no /, etc.

And that's the most that I found. I would read this line in a way that the syntax requirements applying to java identifiers apply, but not the reserved words (since neighter class nor static appear in the list of reserved words in EL). The JLS isn't referred to for the term "Java identifier" (and it is for some other cases in the 2.2 spec, which I didn't review fully)

So, is Tomcat right to reject these names; which point of the spec they are referring to, and do you think they are interpreting it correctly.

+2  A: 

The spec says identifiers are limited to identifiers that would be valid in Java.

Both static and class are Java keywords, and so can't possibly be valid identifiers. You couldn't, for example, write this:

public int static = 7;

And so neither static nor class will be valid identifiers here either.

VoteyDisciple
+2  A: 

From JSP 2.2 EL specification:

1.14 Reserved Words

The following words are reserved for the language and must not be used as identifiers.

    and   eq     gt     true   instanceof
    or    ne     le     false  empty
    not   lt     ge     null   div        mod

Note that many of these words are not in the language now, but they may be in the future, so developers must avoid using these words.

I don't see static, class, etc. This change in Tomcat 7.0.4 does not make sense to me.

BalusC
yup, it appears a reference to the JLS was added to the spec.
Bozho