Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365346

Summary: Static constant not parsed correctly
Product: [WebTools] WTP Source Editing Reporter: Mauro Molinari <mauromol>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: thatnitind
Version: 3.3.1   
Target Milestone: 3.3.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Project demonstrating the problem
none
patch none

Description Mauro Molinari CLA 2011-12-01 12:59:58 EST
Build Identifier: 20110916-0149

The class constant seems to be not parsed correctly in some circumstances

Reproducible: Always

Steps to Reproduce:
1. download Eclipse IDE for Java EE Developers 
2. open on a brand-new workspace (i.e.: no server runtime defined)
3. setup a server runtime (I'm using Apache Tomcat 6)
4. import the attached project
5. open WebContent/test.jsp
6. look at line 6:

<fmt:message key="<%= MyClass.class %>"></fmt:message>

MyClass.class has no syntax coloring.

7. place the cursor on MyClass at line 6 and hit F3 to go to MyClass declaration: it does not work; however, if you do the same on MyClass at line 4 it does work
Comment 1 Mauro Molinari CLA 2011-12-01 13:02:11 EST
Created attachment 207803 [details]
Project demonstrating the problem
Comment 2 Mauro Molinari CLA 2011-12-01 13:05:39 EST
I changed the summary, because it seems that even if you declare:

public static final String CONSTANT = "test"; 

in MyClass and then you change the JSP so that:

<fmt:message key="<%= MyClass.CONSTANT %>"></fmt:message>

the same problem happens. F3 does not work in either MyClass and CONSTANT.

It does work if you put the same in another place, for instance:

<body>
<%= MyClass.CONSTANT %>
</body>
Comment 3 Mauro Molinari CLA 2011-12-01 13:07:38 EST
Another information: if you try to rename MyClass to MyTestClass, the refactoring does not change the MyClass reference in:

<fmt:message key="<%= MyClass.CONSTANT %>"></fmt:message>

while it changes it in all the other places.
Comment 4 Nick Sandonato CLA 2011-12-02 09:24:53 EST
Created attachment 207845 [details]
patch
Comment 5 Nick Sandonato CLA 2011-12-06 14:27:28 EST
Code released along with unit tests. Thanks, Mauro.