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

Bug 343138

Summary: [refactoring] Java source refactoring leads to JSP unfit source code
Product: [WebTools] WTP Source Editing Reporter: Evgeniy Karyakin <anthropophagite>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED WORKSFORME QA Contact: Nick Sandonato <nsand.dev>
Severity: major    
Priority: P3 CC: thatnitind
Version: unspecified   
Target Milestone: Future   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Simple project as an example
none
Screenshot with before/after view none

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!