Lombok(1.14.8)

@SneakyThrows

@SneakyThrows,声明异常。

package com.huey.lombok;

import java.io.UnsupportedEncodingException;

import lombok.SneakyThrows;

public class SneakyThrowsExample implements Runnable {
    
    @SneakyThrows(UnsupportedEncodingException.class)
    public String utf8ToString(byte[] bytes) {
        return new String(bytes, "UTF-8");
    }

    @SneakyThrows
    public void run() {
        throw new Throwable();
    }
}
原文地址:https://www.cnblogs.com/huey/p/4694961.html