RFR: 8320144: Compilation crashes when a custom annotation with invalid default value is used

Vicente Romero vromero at openjdk.org
Tue Dec 5 21:37:34 UTC 2023


On Tue, 5 Dec 2023 16:34:03 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

> The erroneous case of:
> 
> `public String[] excludeModules() default new String[0];`
> 
> was not short-circuited in the compiler and we were getting an NPE in `l.nonEmpty()` for `l`. Now, `getAnnotationArrayValue` returns the error attribute, if that case is detected.

looks sensible to me

test/langtools/tools/javac/T8320144.out line 2:

> 1: T8320144.java:16:54: compiler.err.new.not.allowed.in.annotation
> 2: 1 error

there seems to be an empty new line missing at the end of the file

-------------

Marked as reviewed by vromero (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16977#pullrequestreview-1766132751
PR Review Comment: https://git.openjdk.org/jdk/pull/16977#discussion_r1416292070


More information about the compiler-dev mailing list