[Runtime] Carp::carp reports Java source location in compile-time attribute handlers
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 54/100
Direzione di ricerca
Start by reading Attributes.java near line 402 and the runtime stack or source-location handling used by Carp::carp; the issue identifies the Java call into the compile-time attribute handler as the failing path. Add project-owned regression coverage for a :ATTR(CODE,BEGIN) handler that calls Carp::carp, then run it on system Perl and both PerlOnJava backends. Done means the warning reports the Perl source file and line on both backends.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
A compile-time custom code attribute handler that calls Carp::carp gets the PerlOnJava implementation file and line as its warning location. In the Attribute-RecordCallers 0.02 suite, the warning points to Attributes.java line 402 instead of the Perl test file t/03my.t, so the test's source-location assertion fails.
Reproduction
Install or add Attribute-RecordCallers 0.02 to @INC, then run its upstream test t/03my.t:
use 5.18.0;
use warnings;
use feature 'lexical_subs';
no warnings 'experimental::lexical_subs';
use Attribute::RecordCallers;
my @w;
BEGIN { $SIG{__WARN__} = sub { push @w, @_ }; }
my sub foo :RecordCallers { }
print $w[0];
The upstream test checks that the warning matches:
Ignoring RecordCallers attribute on anonymous subroutine at .*03my.t
System Perl 5.42.2 passes the complete distribution suite: 8 files, 64 tests. On PerlOnJava, the JVM and interpreter backends both emit:
Ignoring RecordCallers attribute on anonymous subroutine at Attributes.java line 402.
The archived CPAN run 20261117-153921-75160 fails only t/03my.t test 4: 63/64 assertions pass (1 of 8 test files fails).
Root cause
Attributes.java:402 invokes the Perl custom MODIFY_CODE_ATTRIBUTES handler during compilation. Attribute::RecordCallers calls Carp::carp from that handler. Carp's stack walk receives the Java implementation call site as the source location instead of the Perl compilation unit and line. The resulting warning therefore contains Attributes.java line 402 rather than t/03my.t.
This reproduces on both execution backends. It is a Perl source-location/runtime stack mapping issue, not an Attribute-RecordCallers dependency or environment failure; the distribution is pure Perl and passes on system Perl.
Expected behavior
Warnings emitted by Carp::carp in compile-time attribute handlers should identify the Perl source file and line where the attribute is being applied, matching system Perl.
Related issues
Issues #1656 and #1666 addressed Carp::croak locations through Moo-generated eval/destructor wrappers. This report is a distinct reproducible Carp::carp location failure during compile-time attribute application; the existing fixes do not correct this case.
Suggested regression coverage
Add a project-owned test for a compile-time custom :ATTR(CODE,BEGIN) handler that calls Carp::carp, asserting that the warning location names the Perl source file rather than a Java implementation file. Validate the test on system Perl and both PerlOnJava backends.
- Lingua principale
- Perl
- Stelle
- 67
- Fork
- 8
- Merge medio
- 5h 12m
- PR unite (30g)
- 131
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fglock/PerlOnJava
-
area:cpan-port bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
fglock/PerlOnJava#2153 ·
I maintainer di solito rispondono entro 1 giorno
-
area:cpan-port area:parser bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
fglock/PerlOnJava#2137 ·
I maintainer di solito rispondono entro 1 giorno
-
area:backend area:cpan-port area:runtime bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
fglock/PerlOnJava#2071 ·
I maintainer di solito rispondono entro 1 giorno
-
area:runtime documentation enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
fglock/PerlOnJava#1579 ·
I maintainer di solito rispondono entro 1 giorno
-
area:cpan-port bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
fglock/PerlOnJava#2157 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di fglock/PerlOnJava
Issue simili
-
Dev-output directory preparation accepts file-valued lib/include paths and fails on dangling linksApertateam-cli
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 93/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
inverse-inc/packetfence#9728 ·
I maintainer di solito rispondono entro 1 giorno
-
fix(char-create): show the real reason a character is refusedForse già presa @baphomello l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno