<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 06/26/2014 03:09 PM, Xavier Coulon
wrote:<br>
</div>
<blockquote
cite="mid:51BEF7E4-CDE7-4F5A-A733-9DFCC64DC9C6@redhat.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Alexey,
<div><br>
</div>
<div>Thanks for your response !</div>
<div>It's done: <a moz-do-not-send="true"
href="https://issues.jboss.org/browse/JBIDE-17708">https://issues.jboss.org/browse/JBIDE-17708</a>
+ <a moz-do-not-send="true"
href="https://github.com/jbosstools/jbosstools-base/pull/291">https://github.com/jbosstools/jbosstools-base/pull/291</a></div>
<div><br>
</div>
<div>Please, beware that since I have TP/build issues on my
machine, I could not run an 'mvn clean verify' before submitting
the PR.</div>
</blockquote>
No problem, I should run maven build/tests anyway. And it will take
some time because I have to run all components that depends on this
code too (javaee, jst).<br>
<br>
<br>
<br>
<br>
<blockquote
cite="mid:51BEF7E4-CDE7-4F5A-A733-9DFCC64DC9C6@redhat.com"
type="cite">
<div><br>
</div>
<div><br>
<div>
<span class="Apple-style-span" style="border-collapse:
separate; border-spacing: 0px;"><span
class="Apple-style-span" style="border-collapse: separate;
color: rgb(0, 0, 0); font-family: Helvetica; font-style:
normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: normal; orphans: 2;
text-align: -webkit-auto; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;
-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width:
0px; ">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; ">Best
regards,</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; ">/Xavier<br>
<br>
<br>
</div>
</span></span>
</div>
<br>
<div>
<div>On 26 Jun 2014, at 23:27, Alexey Kazakov <<a
moz-do-not-send="true" href="mailto:akazakov@exadel.com">akazakov@exadel.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi,<br>
<br>
Yes, it makes sense. Please go ahead and open a JIRA
with your PR.<br>
<br>
On 06/26/2014 09:22 AM, Xavier Coulon wrote:<br>
</div>
<blockquote
cite="mid:CFAD0202-CFEF-4234-8795-6C955CB71037@redhat.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
Hello,
<div><br>
</div>
<div>I'm writing a JUnit test to verify that a quickfix
for a JAX-RS problem works fine, but my test fails
because the change is not applied during the call to
Change#perform(). </div>
<div>When digging into the code, I found that my problem
is in the following method of <span
style="font-family: 'Source Code Pro'; font-size:
11px;">org.jboss.tools.common.refactoring.MarkerResolutionUtils:</span></div>
<div><br>
</div>
<div><br>
</div>
<div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro'; color: rgb(119, 119, 119);"><span
style=""><span class="Apple-tab-span"
style="white-space:pre"> </span></span>@SuppressWarnings<span
style="">(</span><span style="color: #3933ff">"unchecked"</span><span
style="">)</span></div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>public</b></span> <span
style="color: #931a68"><b>static</b></span> <T
<span style="color: #931a68"><b>extends</b></span>
IJavaElement> T findWorkingCopy(ICompilationUnit
<span style="color: #7e504f">compilationUnit</span>,
T <span style="color: #7e504f">element</span>) <span
style="color: #931a68"><b>throws</b></span>
JavaModelException{</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">element</span> <span
style="color: #931a68"><b>instanceof</b></span>
IAnnotation){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>IJavaElement <span
style="color: #7e504f">parent</span> =
findWorkingCopy(<span style="color: #7e504f">compilationUnit</span>,
<span style="color: #7e504f">element</span>.getParent());</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">parent</span> <span
style="color: #931a68"><b>instanceof</b></span>
IAnnotatable){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>for</b></span>(IAnnotation
<span style="color: #7e504f">a</span> :
((IAnnotatable)<span style="color: #7e504f">parent</span>).getAnnotations()){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">a</span>.getElementName().equals(<span
style="color: #7e504f">element</span>.getElementName()))</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>return</b></span> (T)<span
style="color: #7e504f">a</span>;</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}<span
style="color: #931a68"><b>else</b></span> <span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">element</span> <span
style="color: #931a68"><b>instanceof</b></span>
ILocalVariable && ((ILocalVariable) <span
style="color: #7e504f">element</span>).isParameter()){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>IJavaElement <span
style="color: #7e504f">parent</span> =
findWorkingCopy(<span style="color: #7e504f">compilationUnit</span>,
<span style="color: #7e504f">element</span>.getParent());</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">parent</span> <span
style="color: #931a68"><b>instanceof</b></span>
IMethod){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>for</b></span>(ILocalVariable
<span style="color: #7e504f">parameter</span> :
((IMethod)<span style="color: #7e504f">parent</span>).getParameters()){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">parameter</span>.getElementName().equals(<span
style="color: #7e504f">element</span>.getElementName())
&& <span style="color: #7e504f">parameter</span>.getTypeSignature().equals(((ILocalVariable)<span
style="color: #7e504f">element</span>).getTypeSignature()))</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>return</b></span> (T)<span
style="color: #7e504f">parameter</span>;</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}<span
style="color: #931a68"><b>else</b></span>{</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>IJavaElement[] <span
style="color: #7e504f">elements</span> = <span
style="color: #7e504f">compilationUnit</span>.findElements(<span
style="color: #7e504f">element</span>);</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">elements</span> != <span
style="color: #931a68"><b>null</b></span>){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>for</b></span>(IJavaElement
<span style="color: #7e504f">e</span> : <span
style="color: #7e504f">elements</span>){</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>if</b></span>(<span
style="color: #7e504f">e</span>.getClass().equals(<span
style="color: #7e504f">element</span>.getClass()))</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span><span
style="color: #931a68"><b>return</b></span> (T)<span
style="color: #7e504f">e</span>;</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro'; color: rgb(147, 26, 104);"><span
style=""><span class="Apple-tab-span"
style="white-space:pre"> </span></span><b>return</b><span
style=""> </span><b>null</b><span style="">;</span></div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><span class="Apple-tab-span"
style="white-space:pre"> </span>}</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><br>
</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><br>
</div>
<div style="margin: 0px; font-size: 11px; font-family:
'Source Code Pro';"><br>
</div>
<div apple-content-edited="true"> <span
class="Apple-style-span" style="border-collapse:
separate; border-spacing: 0px;">
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;">In the code above, the last
if/else block checks if <span
style="font-family: 'Source Code Pro';
font-size: 11px; orphans: auto; widows: auto;
color: rgb(126, 80, 79);">e</span><span
style="font-family: 'Source Code Pro';
font-size: 11px; orphans: auto; widows: auto;">.getClass().equals(</span><span
style="font-family: 'Source Code Pro';
font-size: 11px; orphans: auto; widows: auto;
color: rgb(126, 80, 79);">element</span><span
style="font-family: 'Source Code Pro';
font-size: 11px; orphans: auto; widows: auto;">.getClass())</span>,
which does not work in my case because I have <span
style="font-family: 'Source Code Pro';
font-size: 11px; text-align: -webkit-auto;">org.eclipse.jdt.internal.core.SourceType</span><span
style="text-align: -webkit-auto;"> vs </span><span
style="font-family: 'Source Code Pro';
font-size: 11px; text-align: -webkit-auto;">org.eclipse.jdt.internal.core.ResolvedSourceType</span><span
style="text-align: -webkit-auto;">. I wonder
if we should not replace this part with a
comparison of a comparision of
getHandleIdentifier() of both elements, which
would make more sense, I believe.</span></div>
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;">For example, in my unit
tests, it would be: <span style="font-family:
'Source Code Pro'; font-size: 11px;
text-align: -webkit-auto;">=org.jboss.tools.ws.jaxrs.tests.sampleproject/src\/main\/java<org.jboss.tools.ws.jaxrs.sample.services{BAZ.java[BAZ</span><span
style="text-align: -webkit-auto;"> in both
cases ;-)</span></div>
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;"><span style="text-align:
-webkit-auto;">WDYT ? </span></div>
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;"><span style="text-align:
-webkit-auto;"><br>
</span></div>
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;"><span style="text-align:
-webkit-auto;">If the change I suggest makes
sense, I'll be more than happy to open a JIRA
and attach a PR to it ;-)</span></div>
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;"><span style="text-align:
-webkit-auto;"><br>
</span></div>
<div style="word-wrap: break-word;
-webkit-nbsp-mode: space; -webkit-line-break:
after-white-space;"><span style="text-align:
-webkit-auto;">Thanks. </span></div>
<div style="font-family: Helvetica; word-wrap:
break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;"><br>
</div>
<div style="font-family: Helvetica; word-wrap:
break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;">Best
regards,</div>
<div style="font-family: Helvetica; word-wrap:
break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space;">/Xavier<br>
<br>
<br>
</div>
</span> </div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
jbosstools-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:jbosstools-dev@lists.jboss.org">jbosstools-dev@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a></pre>
</blockquote>
<br>
</div>
_______________________________________________<br>
jbosstools-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:jbosstools-dev@lists.jboss.org">jbosstools-dev@lists.jboss.org</a><br>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a></blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>