Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365346 - Static constant not parsed correctly
Summary: Static constant not parsed correctly
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.3.2   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-01 12:59 EST by Mauro Molinari CLA
Modified: 2011-12-06 14:27 EST (History)
1 user (show)

See Also:


Attachments
Project demonstrating the problem (380.83 KB, application/zip)
2011-12-01 13:02 EST, Mauro Molinari CLA
no flags Details
patch (3.50 KB, patch)
2011-12-02 09:24 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.