RFR: 8282574: Cleanup unnecessary calls to Throwable.initCause() in jdk.compiler

Joe Darcy darcy at openjdk.java.net
Fri Mar 4 06:51:03 UTC 2022

On Wed, 2 Mar 2022 18:43:35 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> Pass cause exception as constructor parameter is shorter and easier to read.

Marked as reviewed by darcy (Reviewer).

src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java line 303:

> 301:                 processorIterator = List.of(new PrintingProcessor()).iterator();
> 302:             } catch (Throwable t) {
> 303:                 throw new AssertionError("Problem instantiating PrintingProcessor.", t);

When this annotation processing code was written in JDK 6, I wondered why we didn't use the other constructor at the time. Turns out, that constructor of AssertionError was only added in JDK 7 under [JDK-6935997](https://bugs.openjdk.java.net/browse/JDK-6935997) :-)


PR: https://git.openjdk.java.net/jdk/pull/7662

More information about the compiler-dev mailing list