CLASS v1.1.8 constant returns main in non-main package

オープン
#1,405 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
perl
領域
compilers

調査の方向性

まず、JVM バックエンドとインタープリターバックエンドの両方で、upstream の CLASS.t カバレッジと reproducer を実行します。インポートされた定数サブルーチンがパッケージコンテキストをどのように解決するかを追跡し、失敗する裸の CLASS パスと、動作する $CLASS パスを比較します。main 以外のパッケージにインポートされた定数サブルーチンについて、プロジェクト所有の回帰テストを追加し、その後、両方のバックエンドで CLASS が Foo を返し、CLASS->bar が 23 を返すことを確認します。

索引モデルが issue の本文から書いたものです。

説明

area:backend area:cpan-port area:runtime bug

Summary

CLASS v1.1.8 fails when imported into a non-main package. Its exported
constant subroutine returns main instead of the importing package, causing
class-method calls through CLASS to dispatch incorrectly.

Minimal reproducer

use CLASS;

package Foo;
use CLASS;

sub bar { 23 }

print CLASS, "\\n";
print CLASS->bar, "\\n";

Expected output under Perl:

Foo
23

Actual PerlOnJava behavior:

main
Can't locate object method "bar" via package "main"

The same failure is covered by upstream CLASS.t:

package Foo;
use CLASS;

is( CLASS, __PACKAGE__, 'CLASS is right' );
is( CLASS->bar, 23, 'CLASS->meth' );

Reproduction results

  • CLASS v1.1.8, CPAN run 20260916-111623-23683
  • System Perl 5.42.2: all 22 tests pass
  • PerlOnJava JVM backend: fails at CLASS is right (main vs Foo), then
    aborts at CLASS->bar
  • PerlOnJava interpreter backend: same failure
  • CPAN result: 1/2 test programs failed; 1/3 executed tests failed

The distribution is pure Perl and does not require XS or native libraries.
Because both PerlOnJava backends reproduce the issue while system Perl passes,
this appears to be a shared compiler/runtime bug involving imported constant
subroutines and package context. The $CLASS variable exported by the module
does return Foo; the bare CLASS constant is the failing path.

Acceptance criteria

  • CLASS v1.1.8's upstream test suite passes completely on both PerlOnJava
    backends.
  • The reproducer returns Foo and then 23.
  • A permanent project-owned regression test covers an imported constant
    subroutine in a non-main package.
主要言語
Perl
スター
64
フォーク
6
平均マージ
5時間 25分
マージ済み PR(30日)
157

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

fglock/PerlOnJava のほかの issue

fglock/PerlOnJava の issue をすべて見る

似ている issue

Perl の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。