Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343138 - [refactoring] Java source refactoring leads to JSP unfit source code
Summary: [refactoring] Java source refactoring leads to JSP unfit source code
Status: RESOLVED WORKSFORME
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: Future   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-18 07:49 EDT by Evgeniy Karyakin CLA
Modified: 2014-04-03 10:22 EDT (History)
1 user (show)

See Also:


Attachments
Simple project as an example (1.73 KB, application/octet-stream)
2011-04-18 07:50 EDT, Evgeniy Karyakin CLA
no flags Details
Screenshot with before/after view (35.92 KB, image/png)
2011-04-18 07:59 EDT, Evgeniy Karyakin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeniy Karyakin CLA 2011-04-18 07:49:02 EDT
Build Identifier: 20110218-0911

After making some refactoring in Java bean code which is included in JSP with "include" directive that JSP is made unusable. Moreover, JSP file gets reformatted and loses its original state, what makes it very difficult to compare with its previous version in any VCS.
Eclipse is latest distribution, Helios SR2.
I'll attach Eclipse project zip file and couple of screenshots soon.

Reproducible: Always

Steps to Reproduce:
1. Create Java bean class (simple class with accessors/mutators), JSP file.
2. Link Java bean to JSP by means of "include" directive.
3. Use any accessors methods of bean class in JSP.
4. Refactor any of that accessors methods' names.
5. That methods in JSP file are erased. JSP file is reformatted.
Comment 1 Evgeniy Karyakin CLA 2011-04-18 07:50:45 EDT
Created attachment 193480 [details]
Simple project as an example
Comment 2 Evgeniy Karyakin CLA 2011-04-18 07:59:50 EDT
Created attachment 193483 [details]
Screenshot with before/after view
Comment 3 Evgeniy Karyakin CLA 2011-04-18 08:25:50 EDT
Additional info.

If I rename the method getStr() to getStr1(), it just disappears from JSP source code, making it unusable. You can see that on screenshot I attached. This behaviour is also seen in EclipseTest.inc file which is in project also.
If I rename the method isBool() to isBool1(), the JSP file *fragment* is reformatted where jb.isBool() is mentioned, like this:

Before rename:

<% if (jb.isBool1()) { %>
<p>Bool set!</p>
<% } %>

After rename:

<%
	if (jb.isBool1()) {
%>
<p>Bool set!</p>
<% } %>

It makes JSP source hard to compare with VCS diff tools: the code remains the same, but suddenly went through unexpected visual change.
Comment 4 Nick Sandonato CLA 2011-04-19 16:38:41 EDT
I've reproduced in 3.2.3 but I have yet to reproduce in 3.3.
Comment 5 Nitin Dahyabhai CLA 2011-04-27 23:30:41 EDT
Very interesting if it's only happening in 3.2.x...
Comment 6 Nitin Dahyabhai CLA 2012-04-25 16:25:20 EDT
Nick, if also not reproducible on 3.4, we should just resolve it.
Comment 7 Evgeniy Karyakin CLA 2012-04-26 03:08:16 EDT
I also can't reproduce it now on latest Eclipse Indigo SR2, nevertheless I'm leaving final decision to you fellows.
PART OF JSP file is still reformatted during re-factoring and this is bad for various version control systems, but that's another "bug".
Comment 8 Nick Sandonato CLA 2014-04-03 10:22:40 EDT
As mentioned, this no longer seems to be reproducible. So I'm resolving the defect. If the formatting is still an issue for you, please feel free to open a new defect so that we can track that issue separately. Thanks!