@SneakyThrows 注解

来源:互联网 发布:天猫魔盒网络无法连接 编辑:程序博客网 时间:2024/06/05 05:44
package org.digdata.swustoj;import lombok.Cleanup;import lombok.SneakyThrows;import java.io.IOException;import java.io.InputStream;/** * Created by hongfei.whf on 2016/8/31. */public class Main {    @SneakyThrows    public static void test() {        @Cleanup InputStream in=new InputStream() {            @Override            public void close() throws IOException {                super.close();                System.out.println("this is close");            }            @Override            public int read() throws IOException {                return 0;            }        };        System.out.println("haha1");        if (1 == 1) {            Integer.valueOf("s");        }        System.out.println("haha2");    }    public static void main(String args[]) {        try {            test();            System.out.println("hshs3");        } catch (Exception e) {            System.out.println("haha3");        }    }}
0 0
原创粉丝点击