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';