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

クローズ
#109 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
java
領域
compilers

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
1
フォーク
1
平均マージ
1時間 13分
マージ済み PR(30日)
6

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CodeLaser/maddi のほかの issue

CodeLaser/maddi の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。