netbeans-commits mailing list archives

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

             Summary: "Too broad 'catch' clause" hint doesn't properly support generic 'throws'
                 Key: NETBEANS-34
             Project: NetBeans
          Issue Type: Bug
          Components: java - Hints
    Affects Versions: 8.2
            Reporter: Niklas Matthies

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

        void bar() throws CertificateException { }

        void example()
            try {
                this.<GeneralSecurityException> foo();
            catch (GeneralSecurityException ex) {
                // ignore
NetBeans shows the following hint: "The catch( is too
broad, the actually caught exception is". 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(
is too broad, it catches the following exception types: null".

This message was sent by Atlassian JIRA

View raw message