import java.sql.SQLException; class Exption<T extends Exception> { public static void main(String[] args) { try { new Exption<RuntimeException>().pleaseThrow(new SQLException()); }catch (final SQLException ex){ ex.printStackTrace(); } } private void pleaseThrow(final Exception t) throws T{ throw (T)t; }}
Standard input is empty
Main.java:7: error: exception SQLException is never thrown in body of corresponding try statement }catch (final SQLException ex){ ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!