Skip to content

[BUG] Lombok val can be used only once with JDK25 and --release 8 #3947

@asheldon

Description

@asheldon

Describe the bug
When compiling with OpenJDK25, if val is used more than once and the target platform is Java 8 or Java 9, all uses of val after the first result in errors like the following:

MutliVal.java:6: error: incompatible types: long cannot be converted to val
        val two = 2L;

To Reproduce

MultiVal.java

import lombok.val;

public class MutliVal {
    // This does not compile with JDK 25, Lombok 1.18.42 and --release 8 or --release 9.
    public static void jdk25failure() {
        val one = 1L;
        val two = 2L;
    }
}

Compiling:

javac MutliVal.java -classpath lombok.jar -proc:full --release 8

Expected behavior
Compilation to succeed as it does with JDK 21 and earlier.

Version info (please complete the following information):

  • Lombok version - 1.18.42
  • Platform - javac 25

Additional context
n/a

Metadata

Metadata

Assignees

Labels

acceptedThe issue/enhancement is valid, sensible, and explained in sufficient detailbugjavac

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions