Rust printer: equals/hashCode in a closed class hierarchy
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Java
- スター
- 1
- フォーク
- 1
- 平均マージ
- 48分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CodeLaser/maddi のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
Javadoc warnings are the only noise on an otherwise clean CI run再び着手できるかも @jayeshamundkar06-bit が 27 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbuild/ci good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
CodeLaser/maddi の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
federicoiosue/Omni-Notes#1044 ·
-
Bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Terraform releases proxy leaves a temp folder behind on every cache refresh対応中かも @dhananjay6561 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
terrakube-io/terrakube#4069 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
find-sec-bugs/find-sec-bugs#789 ·