Java printer: a fully qualified package annotation prints by simple name without an import
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Java
- Stars
- 1
- Forks
- 1
- Avg merge
- 2h 51m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CodeLaser/maddi
-
build/ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 Half a day Newbie friendliness 62/100
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
apache/rocketmq-dashboard#6331 ·
Maintainers usually reply within 5 days
-
status: team-only type: dependency-upgrade
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
spring-projects/spring-boot#52143 · 1 comment ·
Maintainers usually reply within 1 day
-
area/frontend good first issue kind/cooldown
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kestra-io/kestra#20704 · 1 comment ·
Maintainers usually reply within 1 day