redhat-developer / redhat-developer/vscode-java

@SuperBuilder with Custom TestBuilder Causes Syntax Highlighting Issue in VSCode for Java

Aperta
#3,824 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug highlighting Lombok
Lingua principale
TypeScript
Stelle
2.3k
Fork
546
Merge medio
20h 1m
PR unite (30g)
11

Descrizione

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

Snipaste_2024-10-21_10-05-21
Snipaste_2024-10-21_10-03-26
Snipaste_2024-10-21_10-03-17

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il problema usando la classe Java e il TestBuilder personalizzato mostrati nell’issue, con Lombok’s @SuperBuilder, quindi confronta l’evidenziazione con e senza il builder personalizzato. Traccia il punto di ingresso dell’estensione Java di VSCode per l’evidenziazione della sintassi o il parsing Java; il lavoro è completato quando la struttura della classe e i colori delle classi continuano a essere visualizzati correttamente in entrambi i casi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java, vscode
Ambito
developer-experience, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.