This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271213 - "Use specific catch" hint is applied to "package" declaration
Summary: "Use specific catch" hint is applied to "package" declaration
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-01 09:51 UTC by Artyom
Modified: 2017-08-07 07:46 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Artyom 2017-08-01 09:51:02 UTC
If at least one method throws checked exceptions and has SneakyThrows annotation then "Use specific catch" hint is applied to "package" declaration. 

Also an attempt to use this hint breaks the structure of a class.
Comment 1 Svata Dedic 2017-08-04 10:35:29 UTC
Project Lombok specific, I think (SneakyThrows). I don't understand what "hint is applied to package declaration" means -- could you give an example source ?
Comment 2 Artyom 2017-08-04 13:26:52 UTC
(In reply to Svata Dedic from comment #1)
> Project Lombok specific, I think (SneakyThrows). I don't understand what
> "hint is applied to package declaration" means -- could you give an example
> source ?

I've meant that the "package" reserved word is highlighted by that hint.
Comment 3 Artyom 2017-08-04 13:28:52 UTC
P.S. You're right. "Lombok" library is used in my project.
Comment 4 Svata Dedic 2017-08-04 14:24:11 UTC
As we do not know Lombok much, a code example would greatly help. 
I am also not sure whether the culprit is not the lombok project itself - some generated Tree nodes are not properly marked as synthetic, so the IDE suggests changes on (lombok-reported) locations which do not match the Tree contents.
Comment 5 Artyom 2017-08-07 07:46:21 UTC
(In reply to Svata Dedic from comment #4)
> As we do not know Lombok much, a code example would greatly help. 
> I am also not sure whether the culprit is not the lombok project itself -
> some generated Tree nodes are not properly marked as synthetic, so the IDE
> suggests changes on (lombok-reported) locations which do not match the Tree
> contents.

Conditions of the issue are very simple. And I described them in the first comment. But here code example is:

package some_project;

import lombok.SneakyThrows;

public class SomeClass {

    @SneakyThrows
    public void someMethod() {
        throw new Exception();
    }
}