Unreachable catch classes
Joe Darcy
joe.darcy at oracle.com
Wed Apr 27 01:53:23 UTC 2011
Hello.
FYI, javac in JDK 7 does a more precise analysis than before on what
catch blocks can actually be reached and warnings are issued for
unreachable catch blocks. I've extracted those warnings from a recent
full JDK build in case anyone wants to update the code in question.
-Joe
../../../../../../src/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java:124:
warning: unreachable catch clause
} catch (java.lang.Exception ex) {
^
thrown type RuntimeException has already been caught
../../../../../../src/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java:124:
warning: unreachable catch clause
} catch (java.lang.Exception ex) {
^
thrown type RuntimeException has already been caught
../../../src/share/classes/java/util/concurrent/ThreadPoolExecutor.java:1115:
warning: unreachable catch clause
} catch (Throwable x) {
^
thrown types RuntimeException,Error have already been caught
../../../src/share/classes/java/net/DatagramSocket.java:183: warning:
unreachable catch clause
} catch(IOException e) {
^
thrown type SocketException has already been caught
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 warnings
../../../src/share/classes/java/security/cert/X509CertSelector.java:2217:
warning: unreachable catch clause
} catch (CertificateException e3) {
^
thrown types
CertificateNotYetValidException,CertificateExpiredException have already
been caught
../../../src/share/classes/javax/management/modelmbean/RequiredModelMBean.java:1220:
warning: unreachable catch clause
} catch (Exception e) {
^
thrown types
InvocationTargetException,IllegalAccessException,RuntimeException have
already been caught
1 warning
../../../../src/share/classes/sun/security/rsa/RSASignature.java:205:
warning: unreachable catch clause
} catch (GeneralSecurityException e) {
^
thrown type BadPaddingException has already been caught
More information about the core-libs-dev
mailing list