Rust printer: equals/hashCode in a closed class hierarchy
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with RustTypePrinter to trace why hierarchy equals and hashCode methods are reported as unsupported, then inspect RustBodyPrinter.methodCall and RustJdk for the equality call paths described. Reproduce the fernflower (test-oss) failures, especially the Exprent and Statement cases. Done means hierarchy equality and hashing translate correctly, including inherited or identity comparison and reference or nullable operands, and the affected collection operations compile.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The Rust printer does not translate equals/hashCode declared in a closed class hierarchy (RustHierarchies). RustTypePrinter skips such methods and reports UNSUPPORTED ("equals or hashCode in a class hierarchy"), so the hierarchy's enum gets no PartialEq/Hash.
Calls then fail in two ways:
a.equals(b)on the hierarchy's root type, which declares noequalsitself while its members do, resolves toObject.equals. RustJdk maps that to a plaina == &b, which leaves the two operands at different reference orOptionlevels, and the enum has noPartialEqin any case.- Collection operations that need equality (
list.remove(o),indexOf,contains, map keys) on hierarchy members fail the same way.
On fernflower (test-oss) this accounts for 44 of the 62 E0277 "can't compare" errors, in 34 functions, mostly Exprent and Statement. For example, if (asexpr.getLeft().equals(field)) becomes asexpr.get_left().as_ref().unwrap() == &field.
Proposed translation:
- print each member's
equalsas an implementation method, thenimpl PartialEq for <Root>that dispatches on the kind to the member's implementation; - a member without its own
equalsinherits the nearest one, or is compared by identity when there is none; - the same for
hashCode→impl Hash, when the hierarchy is used as a key; - route
Object.equalswith a source receiver type to the source-equality branch ofRustBodyPrinter.methodCall, soShared<T>operands compare throughShared::equalsand nullable ones throughOption<&T>.
🤖 Generated with Claude Code
- Lenguaje dominante
- Java
- Estrellas
- 1
- Forks
- 1
- Merge medio
- 48 min
- PR fusionados (30 d)
- 2
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
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Javadoc warnings are the only noise on an otherwise clean CI runQuizá libre de nuevo @jayeshamundkar06-bit la tomó hace 27 días y no hay ningún pull request abierto. Abiertobuild/ci good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Todos los issues de CodeLaser/maddi
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
federicoiosue/Omni-Notes#1044 ·
-
Industrial Center Text TypoAbiertoBug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Terraform releases proxy leaves a temp folder behind on every cache refreshPosiblemente ocupada @dhananjay6561 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
terrakube-io/terrakube#4069 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
find-sec-bugs/find-sec-bugs#789 ·