redhat-developer / redhat-developer/vscode-java
@SuperBuilder with Custom TestBuilder Causes Syntax Highlighting Issue in VSCode for Java
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 547
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 issue 中展示的 Java 类和自定义 TestBuilder,配合 Lombok’s @SuperBuilder 重现该问题,然后比较有无自定义 builder 时的高亮效果。追踪 VSCode Java 扩展的语法高亮或 Java 解析入口;当两种情况下类结构和类颜色都能保持正确渲染时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java, vscode
- 领域
- developer-experience, tooling
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100