评论操作 固定链接

Dave, could you insert in next version of ipp:

- inspection to change visilibity: public, protected, private



U¿ytkownik "Dave Griffith" <dave.griffith@cnn.com> napisa³ w wiadomo¶ci
news:8924570.1065463214617.JavaMail.itn@is.intellij.net...
>

Recompiled for build 944. No other changes. Available at

http://www.intellij.org/twiki/bin/view/Main/IntentionPowerPack
>

Let me know if there are any issues.

>

--Dave Griffith



0
评论操作 固定链接


Sadly no. I've already got inspections for detecting fields and inner classes with too high of visibility, but there are no quick-fixes for those inspections. In cases of excessive visibility for fields, the Right Thing to do isn't to simply tag them "private". The built-in "declaration access can be weaker" inspection will do that for you, if such tagging won't break the code. Instead, the Right Thing for me to do is to fire the "Encapsulate Fields" refactoring, which would not only tag the field with a tighter visibility, but will also replace any external references to it with setters and getters, as appropriate. At present, there is no open or semi-open API in IDEA for firing refactorings, although I've got an open tracker request for such an API. With it, I would be able to have such nifties as having the naming convention inspections have "Rename" as their quick fix, and other such handy tools. Until then, the right answer is to call "Encapsulate Fields" by hand. (What an amazingly powerful tool we have where that seems unnecessarily clunky.)

0
评论操作 固定链接


I'm an idiot, and thought you were asking about InspectionGadgets. I've pretty much stopped active development on IntentionPowerPack, but will put your request on the list.

0
评论操作 固定链接


U¿ytkownik "Dave Griffith" <dave.griffith@cnn.com> napisa³ w wiadomo¶ci
news:24446686.1065473413690.JavaMail.itn@is.intellij.net...
>

I'm an idiot, and thought you were asking about InspectionGadgets. I've

pretty much stopped active development on IntentionPowerPack, but will put
your request on the list.

No, you are not an idiot, just human. InspectionGadgets of course, looks
much more powerful compared to IntentionPowerPack, especially when it comes
to cleaning up the code. I just needed quick fix to change
public/protected/private for given field.


0
评论操作 固定链接

Thanks for the update! This plugin is one I use almost every day.

Dave Griffith wrote:

Let me know if there are any issues.


I do have one issue with the "replace ?: with if-else" intention. Applying
the intention on the following test code produces uncompilable code:

public class ReplaceConditionalAssignmentWithIfIntentionTest {
public void test() {
int i = true ? 10 : 20;
}
}

This could be an issue with IDEA though, but I guess you're the expert on
that:-)

Thanks for all your work,
Bas


0
评论操作 固定链接


This is a known issue. The code generated isn't actually uncompilable, it's just got red lines because IDEA's compilability checker gets confused by the steps I take to alter the code. If run Ctrl-Alt-L, that resets the checker, and the red lines go away. Annoying, but I haven't found any other workaround.

--Dave

0
评论操作 固定链接

Dave Griffith wrote:

This is a known issue. The code generated isn't actually
uncompilable, it's just got red lines because IDEA's compilability
checker gets confused by the steps I take to alter the code. If run
Ctrl-Alt-L, that resets the checker, and the red lines go away.
Annoying, but I haven't found any other workaround.


Euhm, in my case the code is uncompilable. Maybe a previous IDEA version
generated different code but when I try the "replace ?: with if-else"
intention on the code I get:


0
评论操作 固定链接

Whoops, Outlook Expres problems... Ctrl+enter is such an easy keystroke to
make by accident:-)

Bas Leijdekkers wrote:

Dave Griffith wrote:

>> This is a known issue. The code generated isn't actually
>> uncompilable, it's just got red lines because IDEA's compilability
>> checker gets confused by the steps I take to alter the code. If run
>> Ctrl-Alt-L, that resets the checker, and the red lines go away.
>> Annoying, but I haven't found any other workaround.
>

Euhm, in my case the code is uncompilable. Maybe a previous IDEA
version generated different code but when I try the "replace ?: with
if-else" intention on the code I get:


public class ReplaceConditionalAssignmentWithIfIntentionTest {
public void test() {
{
int i;
}
if (true) {
i = 10;
}
else {
i = 20;
}
}
}

Which definately doesn't compile. It also isn't layed out according to my
preferences, which a Ctrl-Alt-L doesn't fix...

Bas


0
评论操作 固定链接

Small typo: 'priniciple' in description of 'Value of ++ or -- used'


0
评论操作 固定链接

Thanks. Fixed in next release.

0
评论操作 固定链接

Bug:
The textfields to configure for example naming convention patterns seem to be in some strange overwrite-mode which can't be turned off.

Question:

MY_SWITCH is reported from "Constant conditions & exceptions" as being always true. Can't we make an exception for such obvious switches? Maybe that would be a switch itself. I'm not sure about this, though.

0
评论操作 固定链接

Got this when navigating from hierarchy view to some class/method.
It endlessly repeats itself until the inspection is disabled.

0

请先登录再写评论。