maddi-java-openjdk: type-use annotations on an anonymous class creation's type are dropped
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by tracing how the OpenJDK front end builds the anonymous class’s parent ParameterizedType and the ConstructorCall type, then compare that path with the named class supertype clause that preserves annotations. The issue names no files or tests, so first locate those entry points and a focused front end test. Done when the anonymous class parent type retains @Nullable and the Kotlin output keeps the annotation consistently with the next() return type.
Written by the indexing model from the issue text.
Description
The OpenJDK front end keeps no type-use annotations on the type of an anonymous class creation. guava's Iterators.partitionImpl:
return new UnmodifiableIterator<List<@Nullable T>>() {
@Override
public List<@Nullable T> next() { ... }
};
arrives as UnmodifiableIterator<List<T>>. Neither the anonymous class's parent type nor the ConstructorCall's type carries the @Nullable. The same annotation on a named class's supertype clause is kept; the J2K printer prints that one as T? since 367ca79bc.
Effect: the Kotlin translation prints the anonymous class header as UnmodifiableIterator<MutableList<T>>, while its next(): MutableList<T?> keeps the annotation. kotlinc then reports "return type of 'fun next(): MutableList<T?>' is not a subtype of the return type of the overridden member" (guava Iterators.kt:387, Iterables.kt:177, and Iterators.kt:376/397 downstream).
Expected: the parent ParameterizedType of the anonymous TypeInfo, or the ConstructorCall's parameterizedType(), carries the type-use annotations as written, as for a named class's extends/implements clause.
Found while reducing guava's KotlinConf scoreboard compile errors, together with the printer session.
🤖 Generated with Claude Code
- Dominant language
- Java
- Stars
- 1
- Forks
- 1
- Avg merge
- 1h 58m
- Merged PRs (30d)
- 5
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
Maintainers usually reply within 1 day
-
bug front-end:javac
Difficulty 4/5 3-5 days Newbie friendliness 42/100
CodeLaser/maddi#145 · 1 comment ·
Maintainers usually reply within 1 day
-
C# printer: an inner class of a generic class needs the outer type's arguments (Outer<A>.Inner)Openfront-end:csharp
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
CodeLaser/maddi#140 · 4 comments ·
Maintainers usually reply within 1 day
-
Java → C# translation: an idiomatic C# printer driven by the modification and nullability analysesOpenenhancement extension front-end:csharp
Difficulty 5/5 Over a week Newbie friendliness 8/100
Maintainers usually reply within 1 day
Similar issues
-
status: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
spring-projects/spring-ai#7206 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
eclipse-dirigible/dirigible#7958 ·
Maintainers usually reply within 1 day
-
bug ci sev-6
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
-
area/cli
Difficulty 2/5 Half a day Newbie friendliness 78/100
quarkusio/quarkus#57623 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
jhipster/prettier-java#1113 ·
Maintainers usually reply within 2 days