strange :JavaCorrect after update to 2.2.3

17 views
Skip to first unread message

KangBerlin

unread,
Oct 25, 2012, 10:38:51 AM10/25/12
to ecli...@googlegroups.com
Hi,

the command :JavaCorrect works no more good like before after i update Eclim from 2.2.0 to 2.2.3. 
For Excample i have a followed code snippet:
...
Mitarbeiter mit = em.createQuery("select m where Mitarbeiter m where m.name='xxxx').getSingleResult();
...
Surely it has a cast failure. :JavaCorrect show me only one stupid option: "change Mitarbeiter to Object " , where is the option of adding a casting ??

please help

thanks!!


Eric Van Dewoestine

unread,
Oct 25, 2012, 1:00:54 PM10/25/12
to ecli...@googlegroups.com
Hmm, it works fine for me using this code:

package org.eclim.test.correct;

import java.util.ArrayList;

public class TestCorrect
{
private ArrayList<Object> list;

public String get(int index){
String result = list.get(index);
return result;
}
}

:JavaCorrect on line 10

Type mismatch: cannot convert from Object to String
0.176: Add cast to 'String'
...
public String get(int index){
String result = (String) list.get(index);
return result;
...
}
1.176: Change type of 'result' to 'Object'
...
public String get(int index){
Object result = list.get(index);
return result;
...
}

If you open up the eclipse gui and edit your file in the eclipse java
editor, does it give you the cast as a correction proposal? If so, can
you give me a sample file which reproduces the issue (cast proposal in
the eclipse gui, but no cast proposal via eclim)?

--
eric

KangBerlin

unread,
Oct 26, 2012, 7:47:47 AM10/26/12
to ecli...@googlegroups.com
Hi eric,

Thank you for reply.I tested the your example , it works also by me . I saw the 'cast' option. 

But it still not work by my code. Eclipse give me the "cast" option but Elim not. Please take a look at this:

You can test it simply use "mvn archetype:generate" and choose 481

In Resources.java add one line like followed :

..

public void test(){ Member mit = this.em.createQuery("").getSingleResult(); }


Thanks,

Eric Van Dewoestine

unread,
Oct 29, 2012, 11:37:37 AM10/29/12
to ecli...@googlegroups.com
On 2012-10-26 04:47:47, KangBerlin wrote:
> Hi eric,
>
> Thank you for reply.I tested the your example , it works also by me . I saw
> the 'cast' option.
>
> But it still not work by my code. Eclipse give me the "cast" option but
> Elim not. Please take a look at this:
>
> <https://lh6.googleusercontent.com/-347u1N1v6Ok/UIp2cNa_Q3I/AAAAAAAAJBg/f5HZ_iLo9dM/s1600/elcim-vim-test-no-cast.jpg>
>
> <https://lh4.googleusercontent.com/-Ofob7Sx_2nM/UIp2kTGsk2I/AAAAAAAAJBo/A6vJbUXyDxA/s1600/eclipse-gui.jpg>
>
> You can test it simply use "mvn archetype:generate" and choose 481
>
> In Resources.java add one line like followed :
>
> ..
>
> public void test(){ Member mit = this.em.createQuery("").getSingleResult();
> }
>
>
> Thanks,
>

Thank you for the steps to reproduce the problem :)

I was able to track down the issue and I've committed a fix[1].

[1] https://github.com/ervandew/eclim/commit/bed068ddad75975aa66963e2433601f0c3979661
--
eric
Reply all
Reply to author
Forward
0 new messages