Preserve imported CV captured by code reference across namespace cleanup
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Start by reading EmitSubroutine and GlobalVariable.getGlobalCodeRefForNamedReference, then trace how the interpreter handles the same captured &name reference after namespace::clean removes the package symbol. Add a focused regression test for capture, cleanup, and invocation; check it under standard Perl and on both PerlOnJava backends, while confirming the direct-call behavior covered by PR #694 remains intact.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Subclass-Of 0.009 fails when its Moo attribute helper captures the imported has function with &has, runs namespace::clean, and invokes the captured code reference. Perl 5 preserves the imported CV even after the package stash entry is cleaned. PerlOnJava instead calls an undefined stub.
This is reproducible on both PerlOnJava execution backends and affects the upstream t/03moo.t test.
Reproducer
my $has = eval q{
package DirectMooEval;
use Moo;
my $has = \&has;
use namespace::clean;
return $has;
};
die $@ unless $has;
$has->("foo", is => "ro");
Expected: the captured CV remains callable and the attribute is installed.
Actual on PerlOnJava: Undefined subroutine &DirectMooEval::has called.
System Perl 5.34.1 passes this focused reproducer. The archived CPAN oracle ran Perl 5.42.2 and passed the full Subclass-Of suite.
CPAN evidence
- Distribution: Subclass-Of 0.009
- Run: 20261119-133823-51077
- Standard Perl: all available upstream tests pass (80 tests; Mouse-dependent test skipped)
- PerlOnJava: 61/63 tests; failures in t/03moo.t, t/07warnings.t, and t/08lazy.t
- The focused t/03moo.t failure was reproduced on both JVM and interpreter with PerlOnJava commit aa51fb913, OpenJDK 24.0.2, macOS arm64.
The actionable scope here is the imported CV capture failure in t/03moo.t. The other failing files are recorded as run evidence and have not been established as the same defect.
Root-cause evidence
The upstream sequence captures the imported function before use namespace::clean removes its package entry. A code reference created before that cleanup must continue to point to the imported CV.
PerlOnJava’s JVM emitter currently resolves a named code reference through GlobalVariable.getGlobalCodeRefForNamedReference when the expression runs (EmitSubroutine). The interpreter path also fails to retain a callable CV through the same cleanup sequence. This indicates a mismatch in when &name binds an imported CV and how that binding survives package-stash cleanup; it is not simply a missing Moo dependency or an import that never ran.
PR #694 covers imported CVs for direct calls across stash cleanup, but not a captured &name reference invoked after cleanup. Closed issue #1548 covers caller metadata and is unrelated to this binding behavior.
Acceptance
- Add a focused project regression test for capturing an imported CV, cleaning its package symbol, and then calling the saved reference.
- Validate the behavior under standard Perl.
- Make the regression pass on both JVM and interpreter backends.
- Preserve the direct-call behavior covered by PR #694.
- Ngôn ngữ chính
- Perl
- Star
- 67
- Fork
- 8
- Merge trung bình
- 5 giờ 12 phút
- Pull request đã merge (30 ngày)
- 131
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fglock/PerlOnJava
-
area:cpan-port bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
fglock/PerlOnJava#2153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port area:parser bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fglock/PerlOnJava#2137 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:backend area:cpan-port area:runtime bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fglock/PerlOnJava#2071 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:runtime documentation enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
fglock/PerlOnJava#1579 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cpan-port bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
fglock/PerlOnJava#2157 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fglock/PerlOnJava
Issue tương tự
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksĐang mởteam-cli
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 93/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
inverse-inc/packetfence#9728 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
fix(char-create): show the real reason a character is refusedCó thể đã có người làm @baphomello đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày