Commit 05c15ab
Fix jcpan DateTime installation and related issues (#348)
* Fix MYMETA.yml format and create jcpan DateTime fix plan
1. ExtUtils/MakeMaker.pm: Generate meta-spec v2 format MYMETA.yml
- Test dependencies now properly detected by CPAN.pm
- Uses nested prereqs structure instead of flat v1.4 format
2. dev/design/JCPAN_DATETIME_FIXES.md: Comprehensive fix plan
- Documents all errors from clean cache DateTime install
- Prioritized implementation plan
- Critical: File::stat.pm needed for DateTime::Locale
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Add Class::Struct and File::stat via import system; document JVM VerifyError
Phase 17 DateTime fixes:
- Import Class::Struct.pm from perl5/lib (required by File::stat)
- Import File::stat.pm from perl5/lib (required by File::ShareDir::Install)
- Document JVM VerifyError with minimal reproducer
File::stat triggers a JVM bytecode verification error due to a bug when
compiling: no strict 'refs' + for loop + defined eval { &{symbolic_ref} }
Minimal reproducer:
no strict 'refs';
for (qw(X Y Z)) { defined eval { &{"Fcntl::S_IF$_"} } }
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Update JVM VerifyError analysis with simpler reproducer and root cause
The minimal reproducer doesn't require a for loop:
no strict 'refs';
my $result = defined eval { &{"Fcntl::S_IFX"} };
Root cause: The block dispatcher stores ordinal in controlFlowActionSlot,
but different code paths merge at a label with inconsistent types for
that slot (integer vs TOP).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Update design doc: JVM VerifyError fix completed
Document the root cause analysis and fix for Issue #11 (VerifyError
when loading File::stat.pm.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EOF
)
* Add missing S_* mode constants to Fcntl.pm
File::stat.pm requires S_IRUSR, S_IWUSR, S_IXUSR and other mode constants
from Fcntl. These were listed in @EXPORT_OK but never actually defined.
Added:
- File type masks: S_IFMT, S_IFREG, S_IFDIR, S_IFLNK, etc.
- Special mode bits: S_ISUID, S_ISGID, S_ISVTX
- User permissions: S_IRUSR, S_IWUSR, S_IXUSR, S_IRWXU
- Group permissions: S_IRGRP, S_IWGRP, S_IXGRP, S_IRWXG
- Other permissions: S_IROTH, S_IWOTH, S_IXOTH, S_IRWXO
- File type test functions: S_ISREG, S_ISDIR, S_ISLNK, etc.
- Permission extraction: S_IMODE
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Update design doc: File::stat.pm now loads successfully
Both the JVM VerifyError and the missing Fcntl constants have been fixed.
File::stat.pm now loads and works correctly.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix require bareword handling with CORE::GLOBAL::require override
When CORE::GLOBAL::require is overridden and a module uses 'require Bareword;'
under strict subs, the bareword was incorrectly flagged as a strict subs violation.
Root cause: When the parser detected a CORE::GLOBAL::require override, it rewrote
the require call to a subroutine call, but the bareword argument (e.g., 'Exporter')
was parsed as an expression instead of using require's special bareword-to-filename
conversion.
Fix: Added special handling in ParsePrimary.java for 'require' when
CORE::GLOBAL::require is overridden:
1. Parse the argument using standard require handling (converts bareword to filename)
2. Build a subroutine call node with the &CORE::GLOBAL::require code ref
Also added Exporter::require_version() method which delegates to UNIVERSAL::VERSION
for historical compatibility with older Exporter usage.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Update JCPAN_DATETIME_FIXES.md with completed fixes
- Marked Exporter::require_version as FIXED
- Marked CORE::GLOBAL::require bareword handling as FIXED
- Updated progress tracking section
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix Exporter version check in import arguments
When calling Module->import('0.03', 'symbol'), Perl's Exporter treats
arguments starting with a digit as version checks, not symbols to export.
Added this logic to the Java Exporter:
1. If symbol starts with digit, call $pkg->VERSION($version)
2. If version was only argument, import from @export
3. If version + empty string ('use Foo 1.23, ""'), import nothing
4. Otherwise skip version and continue with other imports
This fixes: 'Symbol 0.03 not allowed for export in package File::ShareDir::Install'
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix MakeMaker $(INST_LIB) variable expansion
When Makefile.PL scripts provide an explicit PM hash with Make-style
variables like $(INST_LIB)/Module.pm, expand them to actual paths.
Without this fix, modules would be installed to a literal '$(INST_LIB)'
directory instead of the actual install base.
This fixes Class::Inspector and similar modules using explicit PM hashes.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Update design doc: jcpan DateTime installation complete
All blocking issues have been fixed:
- Exporter version check in import arguments
- MakeMaker $(INST_LIB) variable expansion
jcpan install DateTime now works successfully.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Add File::ShareDir::Install support to MakeMaker
When Makefile.PL uses File::ShareDir::Install to register share directories
(via install_share()), our MakeMaker now processes @file::ShareDir::Install::DIRS
and copies those files to the proper location under auto/share/dist/<DistName>/.
This enables DateTime::Locale to work correctly, as it uses share files for
locale data (1070 .pl files for different locales).
Test: jcpan install DateTime::Locale now installs all locale data files.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix IPC::Open3 redirection directive handling
When open3() is called with redirection directives like '>&STDERR', they are
read-only strings that cannot be modified. This fix:
1. In IPCOpen3.java:
- Added isOutputRedirection() and isInputRedirection() to detect >&/&< directives
- Added handleOutputRedirection() to pipe process output to named handles
- Added isUsableHandle() to properly detect undef handles (not just reference-to-undef)
- Added getStringValue() to properly dereference scalar references
2. In Open3.pm:
- Check for redirection directives before trying to update caller's variables
- Skip assignment to $_[N] when it's a redirection directive (read-only)
This fixes: 'open3: Modification of a read-only value attempted' errors in
tests like t/00-compile.t that use open3($stdin, '>&STDERR', $stderr, ...).
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix prototype parsing: allow trailing comma before semicolon
When calling a prototype function without parentheses, a trailing comma
before the statement terminator was incorrectly treated as 'too many
arguments'. In Perl, trailing commas are allowed:
like $warning, qr/foo/, 'test',; # valid Perl
The fix checks if the comma is followed by a statement terminator (;, EOF,
or other expression terminators) and allows it in that case.
This fixes t/conflicts.t in Dist::CheckConflicts which uses this pattern.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix version comparison with undef values
- Version.java: Treat empty/undef values as version 0 in VCMP, matching
Perl 5 behavior where `version->new("1.0") <=> undef` returns 1
- CompareOperators.java: Move checkUninitialized() call to after the
overload check in greaterThan(), so overloaded comparison operators
don't produce spurious "uninitialized value" warnings
This fixes warnings during CPAN::Meta::Requirements checks when modules
don't have a $VERSION defined.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix file test operators for JAR directory entries
- Jar.java: Add isFile() and isResourceDirectory() methods to distinguish
between files and directories in JAR resources. Directory entries have
contentLength of 0.
- FileTestOperator.java: Check for JAR directory entries and return
correct results for -d and -f tests
- FileTestOperator.java: Always reset lastBasicAttr in updateLastStat()
to prevent stale attributes from being used when switching between
real filesystem paths and JAR resources
This fixes Module::Metadata version detection for modules in the JAR,
which was returning undef because it could not distinguish directories
from files in JAR paths.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix stat/lstat to set attributes after updateLastStat
The updateLastStat function now resets lastBasicAttr to null, so
stat and lstat need to set the attributes AFTER calling updateLastStat.
This fixes the regression in op/filetest.t where lstat followed by
-e _ and -l _ would fail with 'The stat preceding -l _ wasn't an lstat'.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix numeric warnings with runtime ThreadLocal for proper scoping
Added ThreadLocal-based runtime warning state tracking:
- Added runtimeDisabledStack in Warnings class to track disabled categories
- 'no warnings "numeric"' sets runtime disabled flag (overrides $^W)
- 'use warnings' clears runtime disabled flag
- NumberParser checks runtime disabled state before warning
This properly handles the interaction between $^W and 'no warnings':
- $^W = 1 enables warnings
- 'no warnings "numeric"' suppresses them even when $^W is set
- Matches standard Perl behavior
Tests:
- infnan.t: 1071/1088 passing (uses $^W = 1, works correctly)
- DateTime tests: No spurious warnings (Test::Builder uses 'no warnings')
Note: Full lexical scoping would require generating code at block
boundaries to push/pop warning scope. Current implementation uses
runtime flag that persists until 'use warnings' is called.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Set STDERR to autoflush by default to match Perl behavior
In Perl, STDERR is unbuffered by default while STDOUT is line-buffered.
This ensures warnings are displayed immediately rather than being
interleaved with stdout output.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Add design doc for numeric warnings implementation
Documents thread-local flag approach that leverages numification cache
to minimize performance overhead. Only cache misses incur thread-local access.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Revert experimental numeric warnings changes
Reverting to master state. The proper implementation is documented in
dev/design/NUMERIC_WARNINGS_IMPLEMENTATION.md and will be implemented
as a separate effort.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Simplify numeric warnings design: check flag on cache miss only
- Warning happens inside parseNumber() on cache miss
- No operator duplication needed
- No caller changes needed
- One thread-local read per cache miss (rare after warmup)
- Uses existing local mechanism for proper scoping
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Document numeric warnings implementation options
Core decision: warn on cache miss only (not every use)
Options for runtime state tracking:
A. Perl global variable with local (correct scoping, slower)
B. ThreadLocal with try/finally (fast, but conflicts with goto)
C. Per-class static field + ThreadLocal on entry (fast, per-subroutine)
D. Simple global flag (simplest, no block scoping)
Decision deferred - all options documented with trade-offs.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---------
Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 1abf60e commit 05c15ab
11 files changed
Lines changed: 336 additions & 21 deletions
File tree
- dev/design
- src/main/java/org/perlonjava
- core
- frontend
- parser
- semantic
- runtime
- operators
- perlmodule
- runtimetypes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
171 | 183 | | |
172 | 184 | | |
173 | 185 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| 70 | + | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
| |||
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| 142 | + | |
| 143 | + | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| |||
159 | 165 | | |
160 | 166 | | |
161 | 167 | | |
| 168 | + | |
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
| |||
528 | 535 | | |
529 | 536 | | |
530 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
531 | 542 | | |
532 | 543 | | |
533 | 544 | | |
| |||
631 | 642 | | |
632 | 643 | | |
633 | 644 | | |
| 645 | + | |
| 646 | + | |
634 | 647 | | |
635 | 648 | | |
636 | 649 | | |
637 | 650 | | |
638 | 651 | | |
639 | 652 | | |
640 | 653 | | |
| 654 | + | |
| 655 | + | |
641 | 656 | | |
642 | 657 | | |
643 | 658 | | |
| |||
646 | 661 | | |
647 | 662 | | |
648 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
649 | 673 | | |
650 | 674 | | |
651 | 675 | | |
| |||
705 | 729 | | |
706 | 730 | | |
707 | 731 | | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
708 | 736 | | |
709 | 737 | | |
710 | 738 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
| |||
145 | 142 | | |
146 | 143 | | |
147 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
133 | 131 | | |
134 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
325 | 337 | | |
326 | 338 | | |
327 | 339 | | |
| |||
0 commit comments