Skip Menu |

This queue is for tickets about the Inline-Java CPAN distribution.

Report information
The Basics
Id: 21321
Status: resolved
Priority: 0/
Queue: Inline-Java

People
Owner: patl [...] cpan.org
Requestors: artem [...] bizlink.ru
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Strange AUTOSTUDY failure with UnmodifiableMap
The testcase attached prints: You are not allowed to invoke method get in class java.util.Collections$UnmodifiableMap: Class InlineJavaUserClassLink can not access a member of class java.util.Collections$UnmodifiableMap with modifiers "public" at (eval 13) line 352 at c:\tmp\map.pl line 15
Subject: map.pl
#!/usr/bin/env perl use Inline Java => <<'END_OF_JAVA_CODE', AUTOSTUDY => 1; public class TestUnmodifiableMap { public java.util.Map theMap() { java.util.HashMap map = new java.util.HashMap(); map.put("foo", "bar"); return java.util.Collections.unmodifiableMap(map); } } END_OF_JAVA_CODE my $test = new TestUnmodifiableMap(); my $map = $test->theMap(); my $bar = $map->get('foo'); die "Not bar: $bar" if $bar ne 'bar';
From: artem [...] bizlink.ru
Ahh, it is the case for "cast"... Sorry. Still, it would be nice to automatically check the class hyerarchy if the immediate method implementation isn't visible...
The cast() function is to be used in these situations.