Repository navigation
Closed
Labels
Description
https://github.com/eclipse-ee4j/openmq/actions/runs/22488407428/job/65143797675?pr=2889#step:5:135:
Error: /home/runner/work/openmq/openmq/mq/main/mqcomm-util/src/main/java/com/sun/messaging/jmq/util/selector/SelectorToken.java:[27,1] An unhandled exception was thrown by the Error Prone static analysis plugin.
Please report this at https://github.com/google/error-prone/issues/new and include the following, as well as a reproducing code sample (if possible):
error-prone version: 2.48.0
BugPattern: UnnecessarySemicolon
Stack Trace:
java.lang.IndexOutOfBoundsException: Range [4507, 2437) out of bounds for length 4510
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
at java.base/java.util.Objects.checkFromToIndex(Objects.java:391)
at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:731)
at java.base/java.nio.HeapCharBuffer.subSequence(HeapCharBuffer.java:48)
at com.google.errorprone.VisitorState.getOffsetTokens(VisitorState.java:543)
at com.google.errorprone.bugpatterns.UnnecessarySemicolon.matchClass(UnnecessarySemicolon.java:95)
at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:541)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:650)
at com.google.errorprone.scanner.ErrorProneScanner.visitClass(ErrorProneScanner.java:180)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:899)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:74)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:48)
at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:110)
at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:118)
at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:151)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:663)
at com.google.errorprone.scanner.ErrorProneScanner.visitCompilationUnit(ErrorProneScanner.java:180)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:627)
at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:66)
at com.google.errorprone.scanner.Scanner.scan(Scanner.java:58)
at com.google.errorprone.scanner.ErrorProneScannerTransformer.apply(ErrorProneScannerTransformer.java:43)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:231)
at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:133)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1423)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1370)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:955)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:337)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.executeReal(AbstractCompilerMojo.java:1236)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:708)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:235)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:328)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:316)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:174)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:75)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:162)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:919)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:285)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:207)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Reacted by Thomas Sapelza
Activity
pzygielo commentedon Feb 27, 2026
I'm seeing the same exception on different but much simpler project with much much simpler (than
SelectorToken) class (i.e. it shall be easily reproducible and I can prepare reproducer should it be needed).cushon commentedon Feb 27, 2026
Thanks for the report, a repro would be helpful if you're able to provide one.
pzygielo commentedon Feb 27, 2026
Common factor:
cushon commentedon Feb 27, 2026
Thanks, I suspect the crash is caused by lombok and has a similar root cause to the issue discussed in #4918 (comment)
pzygielo commentedon Feb 27, 2026
[-]2.48.0/UnnecessarySemicolon: unhandled `IndexOutOfBoundsException`[/-][+]Lombok causes an IndexOutOfBoundsException in UnnecessarySemicolon[/+]cushon commentedon Feb 27, 2026
I'll leave this open as a separate issue since it affects a different check
ben-manes commentedon Feb 28, 2026
I received this error in Caffeine, which does not use lombok. It fails on the region
byte p000,. This snippet is for cache line padding to protect a volatile field from false sharing.Java snippet
Stacktrace
cushon commentedon Feb 28, 2026
Thanks for the report!
For multi-variable declarations like
byte p000, p001, p002, p003, p004, p005, p006, p007;the parser lowers them into separate declarations, and each synthetic declaration has the original start position and a different end position, so the source ranges for each declaration overlap and that breaks assumptions inUnnecessarySemicolon. I'll fix it.Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Add `VisitorState#getSourceCode(int, int)` that returns a subrange
Handle multi-variable declarations in UnnecessarySemicolon
Handle multi-variable declarations in UnnecessarySemicolon
cushon commentedon Mar 3, 2026
#5548 (comment) is fixed by ad78428, and I also made the error messages for this a bit better: 6f7268d. I think that should have taken care of the original problem as well, the check will now skip over cases where the source positions would be invalid.
pzygielo commentedon Apr 7, 2026
with EP:2.49.0 I'm getting (for
@Getterline):which is no longer reported as error, indeed, but with fail on warning build - it still fails of course.
ThoSap commentedon Oct 22, 2026
The crash is fixed, but the false positive that @pzygielo described is still there in 2.51.0, and the suggested fix removes a semicolon that is required.
Minimal reproduction (Error Prone 2.51.0, Lombok 1.18.48, JDK 25.0.4, only
UnnecessarySemicolonenabled):The positions of the class members after Lombok has run (printed with a small javac plugin,
TreeInfo.getStartPosandTreeInfo.getEndPos):<init>()(javac default constructor)firstprivate String first = "";secondprivate String second = "";getFirst()(Lombok)first = "";getSecond()(Lombok)second = "";setFirst()(Lombok)@SettersetSecond()(Lombok)@SettersetSecond()is the last member, andhasExplicitSourceaccepts it because its start and end differ.So
matchClassscans the tokens from offset 76 to the end of the class, finds the;of both fields, and reports them on the@Setterline.With
lombok.addLombokGeneratedAnnotation = true, the result is the same: every generated member carries@lombok.Generated, but the check does not look at it.An idea, not tested: in
matchClass, skip a member (ascurrentornext) that has a@Generatedannotation (lombok.Generated,javax.annotation.processing.Generated).That would cover member-level checks such as this one, independent of how the end positions are fixed (see projectlombok/lombok#3917).
Should I open a new issue for the false positive, as this one is closed?
Related: #6232 (
TraditionalJavadocToMarkdownwith Lombok), projectlombok/lombok#3917.