Emit constant-subroutine redefinition warning for equal cached values

Open
#2,075 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, perl
Domain
backend, testing

Research direction

Start by reading RuntimeGlob and tracing isSameCachedConstant through the wrapper identity and cached scalar value checks. Add project owned regression coverage for the reported redefinition and same wrapper re-export cases, and first verify the expected warning behavior with standard Perl. Done means one warning on both PerlOnJava backends for replacement by a distinct wrapper with an equal cached value, and no spurious warning when re-exporting the same wrapper.

Written by the indexing model from the issue text.

Description

area:runtime area:warnings bug

Summary

PerlOnJava misses Perl's constant-subroutine redefinition warning when a newly installed constant wrapper has the same cached return value as the previous wrapper.

Evidence

The Constant-Export-Lazy 0.17 test suite passed all 123 tests under system Perl 5.42.2. In CPAN random-tester run 20261116-130945-12232, PerlOnJava failed 2 of 15 assertions in t/private_name_munger.t on both the JVM and interpreter backends.

The test imports BLAH once, changes the private-name mapping, and imports BLAH again. It expects one warning matching Constant subroutine main::BLAH redefined; PerlOnJava reports no warning. The other assertions in the test pass.

Investigation clue

RuntimeGlob suppresses a redefinition warning when isSameCachedConstant considers the old and new constant wrappers equivalent by their cached scalar values. This case suggests that equal returned values do not make distinct constant subroutine definitions equivalent for Perl's redefinition-warning behavior. Please verify the wrapper identity and cached-value path while fixing it.

Acceptance criteria

  • The focused behavior emits one Constant subroutine main::BLAH redefined warning on both PerlOnJava backends.
  • Re-exporting the same constant wrapper without replacing its definition does not introduce a spurious warning.
  • Add project-owned regression coverage and validate its standard Perl behavior before using it to drive the fix.
Dominant language
Perl
Stars
67
Forks
8
Avg merge
5h 12m
Merged PRs (30d)
131

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fglock/PerlOnJava

All issues in fglock/PerlOnJava

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.