Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Java printer: a fully qualified package annotation prints by simple name without an import

Chiusa
#109 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
compilers

Direzione di ricerca

The bug is in how Formatter2Impl prints annotations on a package declaration, and how the import computer treats them. Start by finding the annotation printing path for package-info.java units, then check why a fully qualified package annotation is shortened to its simple name without an import. There is no small reproducer yet, so first build one from the gson package-info.java example. Done means the printed output either keeps the qualified name or adds a matching import, and the gson package-info units compile again.

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

Descrizione

bug

Problem

An annotation on a package declaration (package-info.java) that is written fully qualified is printed by its simple name, and no import is added. The printed file fails to resolve: Type 'CheckReturnValue' not found.

gson's com/google/gson/package-info.java:

@com.google.errorprone.annotations.CheckReturnValue
package com.google.gson;

prints as

@CheckReturnValue
package com.google.gson;

Expected

Either keep the qualified name on a package annotation, or add the import. A package-info.java may have imports after the package declaration, so either works, but keeping the qualified name is the simpler of the two.

Seen on

Printing parsed sources with Formatter2Impl (imports computed by the import computer) on maddi 0.9.5-alpha.5. gson loses 5 package-info units this way. I haven't reduced it further: package-info units don't go through the same small round-trip harness as the other reports.

Lingua principale
Java
Stelle
1
Fork
1
Merge medio
1h 58m
PR unite (30g)
5

Preparare l'ambiente

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.

Altre issue di CodeLaser/maddi

Tutte le issue di CodeLaser/maddi

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.