Issue Compiling Plugin with Java 11

Answered

Context

I'm trying to update a plugin to work with IntelliJ 2020.3. To do this, I need to build the plugin with Java 11 (please correct me if this assumption is incorrect).

Problem

I'm running into the following when trying to compile a plugin with Java 11.0.9:

compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.9.1, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java.lang.AssertionError: exception_index is not set

I am still targeting Java 8 as the language level.

Compilation was previously working with Java 8. I've tried both OpenJDK and Amazon Corretto.

Update - Solved

The issue was caused by the following situation:

() -> {
try {
...
} catch (@NotNull SomeException | OtherException e) {
...
}
}

Removing the @NotNull annotation fixes the issue.

2
2 comments
Official comment

Hello! It looks like you've hit a java compiler bug that was introduced in Java 9. Reported it to OpenJDK issue tracker: JDK-8257740. Unfortunately, we cannot fix it on the IntelliJ IDEA side. But in this case, you're correct: the NotNull annotation on the catch parameter makes little sense. IDEA already knows that the catch parameter is not-null. So you can work-around the problem by removing the annotation.

You must use Java 11 _only_ if your plugin targets 2020.3 and later _only_.

0

Please sign in to leave a comment.