3
votes

In my Struts2 action, the getters and setters are not being used according to IntelliJ IDEA. Which obviously isn't the case. They are both greyed out and have the grey squiggly lines underneath them. Is there anyway to tell IntelliJ IDEA they are being used?

I'm new to IntelliJ IDEA, and I did not have this problem with Eclipse.

1
Are your getters and setters public? - Mark Elliot
I have sometimes the issue, that the annotations stop to work reliable. I'm not sure whether it was with the community edition or with Ultimate, but what you can try is to File->Invalidate Caches and restart IDEA. This of course assumes that your getter/setters are really used. - halirutan
Btw, it would be helpful if you would specify your system completely: operating system, IDEA version. - halirutan
Mac osx 10.9.1, IDEA 13.0.1. The struts getters and setters are never explicitly called by me. It's all handled by struts. Which I think is where IDEA is having the issue. - crumbug
@halirutan Invalidate caches and restart did not resolve the issue - crumbug

1 Answers

0
votes

IntelliJ IDEA marks grey unused methods or fields if they are not used in the code. You could check that with highlighting a word and press Alt+F7. If you do this with grey word it will show a message that "No usages found". This means that usages in your code, it doesn't include a reflection API code. IntelliJ IDEA use inspections to highlight elements of the code if it doesn't comply the rules defined in the inspection profile which you can configure if you click on the man icon in the status bar. Also, there you can choose a highlighting level.