netbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklas Matthies (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (NETBEANS-34) "Too broad 'catch' clause" hint doesn't properly support generic 'throws' declarations
Date Sun, 09 Jul 2017 23:07:00 GMT

     [ https://issues.apache.org/jira/browse/NETBEANS-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Niklas Matthies updated NETBEANS-34:
------------------------------------
    Description: 
Example:
{code:java}
import java.security.GeneralSecurityException;
import java.security.cert.CertificateException;

class Example
{
    <T extends Throwable> void foo() throws T { }

    void bar() throws CertificateException { }

    void example()
    {
        try {
            this.<GeneralSecurityException> foo();
            bar();
        }
        catch (GeneralSecurityException ex) {
            // ignore
        }
    }
}
{code}
NetBeans shows the following hint: "_The catch(java.security.GeneralSecurityException) is
too broad, the actually caught exception is java.security.cert.CertificateException_". Which
is incorrect, because the call to foo() throws a GeneralSecurityException.

Furthermore, when adding a second catch clause specifically for CertificateException (before
the existing catch clause), the hint on the existing catch clause becomes: "_The catch(java.security.GeneralSecurityException)
is too broad, it catches the following exception types: null_".


  was:
Example:
{code:java}
import java.security.GeneralSecurityException;
import java.security.cert.CertificateException;

class Example
{
    <T extends Throwable> void foo() throws T { }

    void bar() throws CertificateException { }

    void example()
    {
        try {
            this.<GeneralSecurityException> foo();
            bar();
        }
        catch (GeneralSecurityException ex) {
            // ignore
        }
    }
}
{code}
NetBeans shows the following hint: "The catch(java.security.GeneralSecurityException) is too
broad, the actually caught exception is java.security.cert.CertificateException". Which is
incorrect, because the call to foo() throws a GeneralSecurityException.

Furthermore, when adding a second catch clause specifically for CertificateException (before
the existing catch clause), the hint on the existing catch clause becomes: "The catch(java.security.GeneralSecurityException)
is too broad, it catches the following exception types: null".



> "Too broad 'catch' clause" hint doesn't properly support generic 'throws' declarations
> --------------------------------------------------------------------------------------
>
>                 Key: NETBEANS-34
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-34
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Hints
>    Affects Versions: 8.2
>            Reporter: Niklas Matthies
>
> Example:
> {code:java}
> import java.security.GeneralSecurityException;
> import java.security.cert.CertificateException;
> class Example
> {
>     <T extends Throwable> void foo() throws T { }
>     void bar() throws CertificateException { }
>     void example()
>     {
>         try {
>             this.<GeneralSecurityException> foo();
>             bar();
>         }
>         catch (GeneralSecurityException ex) {
>             // ignore
>         }
>     }
> }
> {code}
> NetBeans shows the following hint: "_The catch(java.security.GeneralSecurityException)
is too broad, the actually caught exception is java.security.cert.CertificateException_".
Which is incorrect, because the call to foo() throws a GeneralSecurityException.
> Furthermore, when adding a second catch clause specifically for CertificateException
(before the existing catch clause), the hint on the existing catch clause becomes: "_The catch(java.security.GeneralSecurityException)
is too broad, it catches the following exception types: null_".



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message