Describe the bug
The annotation @SneakyThrows hides compilation error that should be raised in the IDE. I use IntelliJ Idea 2020.1.4
To Reproduce
The following code doesn't compile, which is correct. Placing @SneakyThrows hides the red-wave underline in the IDE the file at the line log.error("File [{}] not found", file);. Removing such annotation leaves the file correctly detected by the IDE.
static Logger log = LoggerFactory.getLogger(Foo.class); // or @Slf4J, there is no difference in the behavior
@SneakyThrows
public static void main(String[] args) {
boolean condition = true;
final String file;
final InputStream inputStream;
try {
if (condition) {
file = "classpath:data/resource.json";
inputStream = new FileInputStream(file);
} else {
file = "/app/mounted-resource/resource.json";
inputStream = new FileInputStream(file);
}
} catch (IOException e) {
log.error("File [{}] not found", file);
}
}
Version info:
Additional context
I know the code can be simplified to avoid such issue, however, this is the way to reproduce the behavior.
Yeah, I can reproduce it and I think I found the problem...
@Lekanich Looks great, I am impressed of the quick fix. What is the target release version? Will you close this issue after a retest or shall I take care of it by myself?
@Nikolas-Charalambidis It depends on @mplushnikov He is the owner of the repository.