maddi-java-openjdk: type-use annotations dropped from a nested class's field typed by the enclosing generic class
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
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- compilers, devtools, testing-qa
Línea de trabajo
Start with the reduced case exercised through JavaInspectorImpl as TestNullabilityPass, then trace how nested-class field types are represented in FieldInfo.type(). Compare the enclosing-class, nested-library-type, and enclosing-generic-type cases, and inspect where ParameterizedType type-use annotations are copied or lost. Done means AS<@Nullable Object> retains the annotation for the nested Holder field and the Kotlin translation no longer produces the nullability mismatch.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
In a static nested class, a field whose type is the enclosing generic class loses the type-use annotations on its type arguments. guava's Ordering:
public abstract class Ordering<T> implements Comparator<T> {
private static final class ArbitraryOrderingHolder {
static final Ordering<@Nullable Object> ARBITRARY_ORDERING = new ArbitraryOrdering();
}
...
}
ARBITRARY_ORDERING's FieldInfo.type() arrives as Ordering<Object>, and the type argument's annotations() is empty.
Reduced, through JavaInspectorImpl as TestNullabilityPass in maddi-mod runs it:
package a.b;
import java.util.Comparator;
@java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) @interface Nullable {}
abstract class AS<T> implements Comparator<T> {
static final AS<@Nullable Object> ARBITRARY = new Arbitrary(); // AS<@Nullable Object> (kept)
static AS<@Nullable Object> plain; // AS<@Nullable Object> (kept)
private static final class Holder {
static final AS<@Nullable Object> ARBITRARY = new Arbitrary(); // AS<Object> (dropped)
}
static class Arbitrary extends AS<@Nullable Object> {
public int compare(@Nullable Object a, @Nullable Object b) { return 0; }
}
}
The same annotation is kept on:
- a field of the outer class itself;
- a field of the nested class typed by a library class, e.g.
Comparator<@Nullable Object>inHolder.
The annotation is not needed on the @interface either: a top-level annotation type and one nested in AS give the same result.
Effect: the Kotlin translation prints internal val ARBITRARY_ORDERING: Ordering<Any> = ArbitraryOrdering(), while arbitrary(): Ordering<Any?> returns it. kotlinc reports "type mismatch: expected Ordering<Any?>, actual Ordering" (guava Ordering.kt:214).
Expected: the field's ParameterizedType carries the type-use annotations as written, as it does for the outer class's own fields.
Found while reducing guava's KotlinConf scoreboard compile errors, together with the printer session. Related: #144 (anonymous class creation types).
🤖 Generated with Claude Code
- Lenguaje dominante
- Java
- Estrellas
- 1
- Forks
- 1
- Merge medio
- 1 h 58 min
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CodeLaser/maddi
-
build/ci good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Los mantenedores suelen responder en 1 día
-
C# printer: a self-bounded interface's wildcard interface and companion class share a name (CS0102)Abiertofront-end:csharp
Dificultad 3/5 1-2 días Aptitud para principiantes 64/100
CodeLaser/maddi#160 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
C# printer: an inner class of a generic class needs the outer type's arguments (Outer<A>.Inner)Abiertofront-end:csharp
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
Los mantenedores suelen responder en 1 día
Todos los issues de CodeLaser/maddi
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/rocketmq-dashboard#7302 ·
Los mantenedores suelen responder en 3 días
-
area: android good first issue help wanted testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Gautam-aman/ResQNet#56 ·
Los mantenedores suelen responder en 1 día
-
documentation hermes-queue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
chrisalunlloyd2-sudo/mindpalace#294 ·
Los mantenedores suelen responder en 1 día
-
better night vision compatAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
QuicksilverMC/Argentum#31 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
avniproject/avni-server#1098 · 2 comentarios ·