Kotlin printer: comments inside method bodies are not printed

Abierto
#181 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java, kotlin
Área
compilers

Línea de trabajo

Start in KotlinStatementPrinter, which never reads a statement's comments(), and in KotlinComments, which already turns file, type and member comments into KDoc. Read KotlinApply to see how it refuses to fold commented statements. Done means a comment inside a method body appears in the Kotlin output, with a stated rule for statements that are merged, split or hoisted. Decide those rules with the maintainers before coding.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Since d452873f5 the Java→Kotlin printer carries the comments of the file (licence header), types, fields, methods, constructors, enum entries and header properties, with Javadoc turned into KDoc (KotlinComments). Comments inside method bodies are still dropped: KotlinStatementPrinter never reads a statement's comments().

What makes this more than a one-liner: the printer does not map statements one to one. It merges and splits them (T().apply { … }, val copies for smart casts, hoisted locals, init blocks built from a constructor body), so a statement's comment needs a rule for where it goes when its statement is folded into another or disappears. KotlinApply already refuses to fold a statement that carries comments, which is one of these rules; the others need deciding.

Seen in the IDE's Java→Kotlin translation preview.

🤖 Generated with Claude Code

Lenguaje dominante
Java
Estrellas
1
Forks
1
Merge medio
1 h 13 min
PR fusionados (30 d)
6

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de CodeLaser/maddi

Todos los issues de CodeLaser/maddi

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.