Tip 002: highlight method exit points
There since 4.5, I think, but nice to mention again.
Using Ctrl-shift-F7 you cna highlight usages of fields/methods/...
But it can even more. Being used on:
- "throws" keyword it shows all possible causes of any declared exception
- "return" keyword it shows all exit points
- "catch" keyword it shows all places where this exception is thrown in
the try-catch-block.
Please sign in to leave a comment.
Also: record a macro that does "escape" then "ctrl-shift-f7" and
associate this macro to mouse click. Now when you click on any symbol
its usage is automatically highlighted.
BoD
Sven Steiniger wrote:
Very nice. Thanks.
"BoD" <BoD@JRAF.org> wrote in message news:ddt1td$67j$1@is.intellij.net...
>
>
>
>> There since 4.5, I think, but nice to mention again.
>> Using Ctrl-shift-F7 you cna highlight usages of fields/methods/...
>> But it can even more. Being used on:
>> - "throws" keyword it shows all possible causes of any declared exception
>> - "return" keyword it shows all exit points
>> - "catch" keyword it shows all places where this exception is thrown in
>> the try-catch-block.
Well.
In fact I noticed that when you do that, you can't make a mouse
selection anymore :(
BoD
Brad wrote:
>>Also: record a macro that does "escape" then "ctrl-shift-f7" and associate
>>this macro to mouse click. Now when you click on any symbol its usage is
>>automatically highlighted.
>>
>>BoD
>>
>>
>>Sven Steiniger wrote:
>>
>>>There since 4.5, I think, but nice to mention again.
>>>Using Ctrl-shift-F7 you cna highlight usages of fields/methods/...
>>>But it can even more. Being used on:
>>>- "throws" keyword it shows all possible causes of any declared exception
>>>- "return" keyword it shows all exit points
>>>- "catch" keyword it shows all places where this exception is thrown in
>>>the try-catch-block.
I mapped mine to Shift+Click so it doesn't interfere with normal clicking.
"BoD" <BoD@JRAF.org> wrote in message news:ddt506$jkm$1@is.intellij.net...
>
>
>
>> Very nice. Thanks.
>>
>> "BoD" <BoD@JRAF.org> wrote in message
>> news:ddt1td$67j$1@is.intellij.net...
>>
>>>Also: record a macro that does "escape" then "ctrl-shift-f7" and
>>>associate this macro to mouse click. Now when you click on any symbol its
>>>usage is automatically highlighted.
>>>
>>>BoD
>>>
>>>
>>>Sven Steiniger wrote:
>>>
>>>>There since 4.5, I think, but nice to mention again.
>>>>Using Ctrl-shift-F7 you cna highlight usages of fields/methods/...
>>>>But it can even more. Being used on:
>>>>- "throws" keyword it shows all possible causes of any declared
>>>>exception
>>>>- "return" keyword it shows all exit points
>>>>- "catch" keyword it shows all places where this exception is thrown in
>>>>the try-catch-block.
>>
>>
Hi all,
in the following example, it works only for checked exception (`Ctrl +Shift + F7` on `catch` keyword). It actually doesn't work for `NoSuchElementException` here. Maybe this is because `iterator().next()` do not explicitly declare exception in `throws` clause but only in Javadoc. It might take into account the Javadoc `@throws` too:
public static void main(String[] args) {
List<String> test = new ArrayList<>();
try {
String next = test.iterator().next();
} catch (NoSuchElementException e) {
e.printStackTrace();
}
StringReader ppp = new StringReader("PPP");
try {
int read = ppp.read();
} catch (IOException e) {
e.printStackTrace();
}
}
Screenshot: