redhat-developer / redhat-developer/vscode-java
@SuperBuilder with Custom TestBuilder Causes Syntax Highlighting Issue in VSCode for Java
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
When using Lombok’s @SuperBuilder in a Test class and defining a custom TestBuilder to add more methods, VSCode’s syntax highlighting fails. The class colors are incorrectly rendered, and it appears the IDE no longer correctly interprets the structure of the class. This only occurs after adding the custom builder; without it, highlighting works as expected.
Environment
- Operating System: macOS 15.0.1
- JDK version: OpenJDK 64-Bit Server VM Temurin-21.0.4+7 (build 21.0.4+7-LTS, mixed mode, sharing)
- Visual Studio Code version: 1.94.2
- Java extension version: v1.36.2024101808
Steps To Reproduce
1. Create a class Test annotated with Lombok’s @SuperBuilder.
2. Manually define a TestBuilder to add additional methods beyond the automatically generated builder.
3. Open the project in VSCode and observe the syntax highlighting for the Test class.
import com.google.common.collect.Lists;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
@SuperBuilder
@NoArgsConstructor
@Data
public abstract class Test {
private List<String> exampleList;
public abstract class TestBuilder<C extends Test, B extends Test.TestBuilder<C, B>> {
public TestBuilder() {
exampleList = Lists.newArrayList();
}
public void addExample(String example) {
exampleList.add(example);
}
}
}
Current Result
VSCode’s syntax highlighting becomes incorrect when a custom TestBuilder is defined. The class colors are rendered improperly, and it seems the IDE fails to properly handle the class structure.
Expected Result
VSCode should continue to correctly render syntax highlighting, even when a custom TestBuilder is used with Lombok’s @SuperBuilder.
Additional Informations
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the problem using the Java class and custom TestBuilder shown in the issue, with Lombok’s @SuperBuilder, then compare highlighting with and without the custom builder. Trace the VSCode Java extension’s syntax-highlighting or Java parsing entry point; done means the class structure and class colors remain correctly rendered in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100