Closed
Description
I read this blogpost describing this problem:
@SneakyThrows
@Transactional
public void lombokSurprise() {
jdbcTemplate.execute("insert into test_table values('lombok!')");
throw new Exception("Simple exception");
}
This code is supposed to commit the transaction but it does not. The problem is that Spring wraps checked exceptions that aren't declared in the signature within an UndeclaredThrowableException over here and from that point treats it as unchecked.
I think we should treat this one as a checked exception to preserve the promised behavior. I believe it's controlled here:
So, we could append || ex instanceof UndeclaredThrowableException
to solve it.
It will be a breaking change, but I think most people expect it to work that way anyway.