Inline-Java-0.58~dfsg/0000755000000000000000000000000012436307565013316 5ustar rootrootInline-Java-0.58~dfsg/t/0000755000000000000000000000000012436307565013561 5ustar rootrootInline-Java-0.58~dfsg/t/02_primitives.t0000644000000000000000000001271312436307565016446 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'DATA' ) ; BEGIN { plan(tests => 102) ; } my $t = new types2() ; { my $max = undef ; my $min = undef ; $max = 127 ; $min = -128 ; ok($t->_byte(undef) == 1) ; ok($t->_byte(0) == 1) ; ok($t->_byte($max - 1) == $max) ; ok($t->_byte("$min") == $min + 1) ; eval {$t->_byte($max + 1)} ; ok($@, qr/out of range/) ; eval {$t->_byte($min - 1)} ; ok($@, qr/out of range/) ; ok($t->_Byte(undef) == 0) ; ok($t->_Byte(0) == 0) ; ok($t->_Byte($max) == $max) ; ok($t->_Byte("$min") == $min) ; eval {$t->_Byte($max + 1)} ; ok($@, qr/out of range/) ; eval {$t->_Byte($min - 1)} ; ok($@, qr/out of range/) ; $max = 32767 ; $min = -32768 ; ok($t->_short(undef) == 1) ; ok($t->_short(0) == 1) ; ok($t->_short($max - 1) == $max) ; ok($t->_short("$min") == $min + 1) ; eval {$t->_short($max + 1)} ; ok($@, qr/out of range/) ; eval {$t->_short($min - 1)} ; ok($@, qr/out of range/) ; ok($t->_Short(undef) == 0) ; ok($t->_Short(0) == 0) ; ok($t->_Short($max) == $max) ; ok($t->_Short("$min") == $min) ; eval {$t->_Short($max + 1)} ; ok($@, qr/out of range/) ; eval {$t->_Short($min - 1)} ; ok($@, qr/out of range/) ; $max = 2147483647 ; $min = -2147483648 ; ok($t->_int(undef) == 1) ; ok($t->_int(0) == 1) ; ok($t->_int($max - 1) == $max) ; ok($t->_int("$min") == $min + 1) ; eval {$t->_int($max + 1)} ; ok($@, qr/out of range/) ; eval {$t->_int($min - 1)} ; ok($@, qr/out of range/) ; ok($t->_Integer(undef) == 0) ; ok($t->_Integer(0) == 0) ; ok($t->_Integer($max) == $max) ; ok($t->_Integer("$min") == $min) ; eval {$t->_Integer($max + 1)} ; ok($@, qr/out of range/) ; eval {$t->_Integer($min - 1)} ; ok($@, qr/out of range/) ; $max = 3.4028235e38 ; $min = -3.4028235e38 ; ok($t->_float(undef) == 1) ; ok($t->_float(0) == 1) ; ok($t->_float($max / 2)) ; ok($t->_float($min / 2)) ; ok($t->_float($max - 1)) ; ok($t->_float("$min")) ; eval {$t->_float($max + $max)} ; ok($@, qr/out of range/) ; eval {$t->_float($min + $min)} ; ok($@, qr/out of range/) ; ok($t->_Float(undef) == 0) ; ok($t->_Float(0) == 0) ; ok($t->_Float($max / 2)) ; ok($t->_Float($min / 2)) ; # Equality tests for such large floating point number are not always reliable ok($t->_Float($max)) ; ok($t->_Float("$min")) ; eval {$t->_Float($max + $max)} ; ok($@, qr/out of range/) ; eval {$t->_Float($min + $min)} ; ok($@, qr/out of range/) ; # # Boundary testing for long, double are not predictable enough # to be reliable. # my $val = 123456 ; ok($t->_long(undef) == 1) ; ok($t->_long(0) == 1) ; ok($t->_long($val - 1) == $val) ; ok($t->_long("-$val") == -$val + 1) ; ok($t->_Long(undef) == 0) ; ok($t->_Long(0) == 0) ; ok($t->_Long($val) == $val) ; ok($t->_Long("-$val") == -$val) ; $val = 123456.789 ; ok($t->_double(undef) == 1) ; ok($t->_double(0) == 1) ; ok($t->_double($val - 1) == $val) ; ok($t->_double("-$val") == -$val + 1) ; ok($t->_Double(undef) == 0) ; ok($t->_Double(0) == 0) ; ok($t->_Double($val) == $val) ; ok($t->_Double("-$val") == -$val) ; # Number is forced to Double ok($t->_Number(undef) == 0) ; ok($t->_Number(0) == 0) ; ok($t->_Number($val) == $val) ; ok($t->_Number("-$val") == -$val) ; ok(! $t->_boolean(undef)) ; ok(! $t->_boolean(0)) ; ok(! $t->_boolean("")) ; ok($t->_boolean("true")) ; ok($t->_boolean(1)) ; ok(! $t->_Boolean(undef)) ; ok(! $t->_Boolean(0)) ; ok(! $t->_Boolean("")) ; ok($t->_Boolean("true")) ; ok($t->_Boolean(1)) ; ok($t->_char(undef), "\0") ; ok($t->_char(0), "0") ; ok($t->_char("1"), '1') ; eval {$t->_char("10")} ; ok($@, qr/Can't convert/) ; #' ok($t->_Character(undef), "\0") ; ok($t->_Character(0), "0") ; ok($t->_Character("1"), '1') ; eval {$t->_Character("10")} ; ok($@, qr/Can't convert/) ; #' ok($t->_String(undef), undef) ; ok($t->_String(0), "0") ; ok($t->_String("string"), 'string') ; my $str = "\r\n&&&\r\n\ntre gfd gf$$ b F D&a;t% R f &p;vf\r\r" ; ok($t->_String($str), $str) ; ok($t->_StringBuffer(undef), undef) ; ok($t->_StringBuffer(0), "0") ; ok($t->_StringBuffer("stringbuffer"), 'stringbuffer') ; # Test if scalars can pass as java.lang.Object. # They should be converted to strings. ok($t->_Object(undef), undef) ; ok($t->_Object(0), "0") ; ok($t->_Object(666) == 666) ; ok($t->_Object("object"), 'object') ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ class types2 { public types2(){ } public byte _byte(byte b){ return (byte)(b + (byte)1) ; } public Byte _Byte(Byte b){ return b ; } public short _short(short s){ return (short)(s + (short)1) ; } public Short _Short(Short s){ return s ; } public int _int(int i){ return i + 1 ; } public Integer _Integer(Integer i){ return i ; } public long _long(long l){ return l + 1 ; } public Long _Long(Long l){ return l ; } public float _float(float f){ return f + 1 ; } public Float _Float(Float f){ return f ; } public double _double(double d){ return d + 1 ; } public Double _Double(Double d){ return d ; } public Number _Number(Number n){ return n ; } public boolean _boolean(boolean b){ return b ; } public Boolean _Boolean(Boolean b){ return b ; } public char _char(char c){ return c ; } public Character _Character(Character c){ return c ; } public String _String(String s){ return s ; } public StringBuffer _StringBuffer(StringBuffer sb){ return sb ; } public Object _Object(Object o){ return o ; } } Inline-Java-0.58~dfsg/t/no_const.class0000644000000000000000000000034712436307565016436 0ustar rootrootÊþº¾-  iI()VCodeLineNumberTable SourceFile no_const.java   t/no_constjava/lang/Object! * *·*µ±    Inline-Java-0.58~dfsg/t/07_polymorph.t0000644000000000000000000000511012436307565016302 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', STUDY => ['java.util.HashMap', 'java.lang.String'], AUTOSTUDY => 1, ) ; use Inline::Java qw(cast coerce) ; BEGIN { plan(tests => 24) ; } my $t = new types7() ; { my $t1 = new t17() ; ok($t->func(5), "int") ; ok($t->func(coerce("char", 5)), "char") ; ok($t->func(55), "int") ; ok($t->func("str"), "string") ; ok($t->func(coerce("java.lang.StringBuffer", "str")), "stringbuffer") ; ok($t->f($t->{hm}), "hashmap") ; ok($t->f(cast("java.lang.Object", $t->{hm})), "object") ; ok($t->f(["a", "b", "c"]), "string[]") ; ok($t->f(["12.34", "45.67"]), "double[]") ; ok($t->f(coerce("java.lang.Object", ['a'], "[Ljava.lang.String;")), "object") ; eval {$t->func($t1)} ; ok($@, qr/Can't find any signature/) ; eval {$t->func(cast("int", $t1))} ; ok($@, qr/Can't cast (.*) to a int/) ; my $t2 = new t27() ; ok($t2->f($t2), "t1") ; ok($t1->f($t2), "t1") ; ok($t2->f($t1), "t2") ; ok($t2->f(cast("t17", $t2)), "t2") ; ok($t2->f($t1), "t2") ; # Here we should always get the more specific stuff ok($t2->{i}, 7) ; ok($t2->{j}, 3.1416) ; # So this should fail eval {$t2->{j} = "string"} ; ok($@, qr/Can't convert/) ; # Interfaces my $al = $t1->get_al() ; ok(0, $t1->count($al)) ; my $hm = new java::util::HashMap() ; $hm->put('key', 'value') ; my $a = $hm->entrySet()->toArray() ; foreach my $e (@{$a}){ ok(cast('java.util.Map$Entry', $e)->getKey(), 'key') ; } my $str = new java::lang::String('test') ; ok($str, 'test') ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ import java.util.* ; class t17 { public int i = 5 ; public String j = "toto" ; public t17(){ } public String f(t27 o){ return "t1" ; } public void n(){ } public ArrayList get_al(){ return new ArrayList() ; } public int count(Collection c){ return c.size() ; } } class t27 extends t17 { public int i = 7 ; public double j = 3.1416 ; public t27(){ } public String f(t17 o){ return "t2" ; } public void n(){ } } class types7 { public HashMap hm = new HashMap() ; public types7(){ } public String func(String o){ return "string" ; } public String func(StringBuffer o){ return "stringbuffer" ; } public String func(int o){ return "int" ; } public String func(char o){ return "char" ; } public String f(HashMap o){ return "hashmap" ; } public String f(Object o){ return "object" ; } public String f(String o[]){ return "string[]" ; } public String f(double o[]){ return "double[]" ; } } Inline-Java-0.58~dfsg/t/shared_jvm_server.pl0000644000000000000000000000043212436307565017625 0ustar rootrootuse strict ; use blib ; BEGIN { mkdir('./_Inline_test', 0777) unless -e './_Inline_test'; } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline( Java => 'STUDY', SHARED_JVM => 1, ) ; print "Shared JVM server started\n" ; while (1){ sleep(60) ; } Inline-Java-0.58~dfsg/t/03_objects.t0000644000000000000000000000470112436307565015703 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', ) ; BEGIN { plan(tests => 16) ; } # Create some objects my $t = new types3() ; { my $obj1 = new obj13() ; eval {my $obj2 = new obj23()} ; ok($@, qr/No public constructor/) ; my $obj11 = new obj113() ; ok($t->_obj1(undef), undef) ; ok($t->_obj1($obj1)->get_data(), "obj1") ; ok($t->_obj11($obj11)->get_data(), "obj11") ; ok($t->_obj1($obj11)->get_data(), "obj11") ; eval {$t->_int($obj1)} ; ok($@, qr/Can't convert (.*) to primitive int/) ; eval {$t->_obj11($obj1)} ; ok($@, qr/is not a kind of/) ; # Inner class my $in = new obj13::inner_obj13($obj1) ; ok($in->{data}, "inner") ; # Receive an unbound object and send it back my $unb = $t->get_unbound() ; ok($t->send_unbound($unb), "al_elem") ; # Unexisting method eval {$t->toto()} ; ok($@, qr/No public method/) ; # Method on unbound object eval {$unb->toto()} ; ok($@, qr/Can't call method/) ; # Incompatible prototype, 1 signature eval {$t->_obj1(5)} ; ok($@, qr/Can't convert/) ; # Incompatible prototype, >1 signature eval {$t->__obj1(5)} ; ok($@, qr/Can't find any signature/) ; # Return a scalar hidden in an object. ok($t->_olong(), 12345) ; # Pass a non-Java object, a hash ref. my $d = {} ; eval {$t->_Object($d)} ; ok($@, qr/Can't convert/) ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ import java.util.* ; class obj13 { String data = "obj1" ; public obj13() { } public String get_data(){ return data ; } public class inner_obj13 { public String data = "inner" ; public inner_obj13(){ } } } class obj113 extends obj13 { String data = "obj11" ; public obj113() { } public String get_data(){ return data ; } } class obj23 { String data = "obj2" ; obj23() { } public String get_data(){ return data ; } } class types3 { public types3(){ } public int _int(int i){ return i + 1 ; } public Object _Object(Object o){ return o ; } public obj13 _obj1(obj13 o){ return o ; } public obj13 __obj1(obj13 o, int i){ return o ; } public obj13 __obj1(obj13 o){ return o ; } public obj113 _obj11(obj113 o){ return o ; } public ArrayList get_unbound(){ ArrayList al = new ArrayList() ; al.add(0, "al_elem") ; return al ; } public String send_unbound(ArrayList al){ return (String)al.get(0) ; } public Object _olong(){ return new Long("12345") ; } } Inline-Java-0.58~dfsg/t/counter.java0000644000000000000000000000032312436307565016101 0ustar rootrootclass counter { static private int global_i = 0 ; private int i = 0 ; public counter(){ } static public int gincr(){ global_i++ ; return global_i ; } public int incr(){ i++ ; return i ; } } Inline-Java-0.58~dfsg/t/MOD_PERL.pm0000755000000000000000000000140512436307565015363 0ustar rootroot#!/usr/bin/perl package t::MOD_PERL ; use strict ; use CGI ; use Inline ( Java => '/home/patrickl/DEV/Inline-Java/t/counter.java', DIRECTORY => '/home/patrickl/DEV/Inline-Java/_Inline_web_test', NAME => 't::MOD_PERL', SHARED_JVM => 1, ) ; use Apache2::RequestRec ; use Apache2::RequestIO ; use Apache2::Const qw(:common) ; my $cnt = new t::MOD_PERL::counter() ; sub handler { my $r = shift ; $r->content_type('text/html') ; my $gnb = $cnt->gincr() ; my $nb = $cnt->incr() ; my $q = new CGI() ; print $q->start_html() . "Inline-Java " . $Inline::Java::VERSION . "

" . "Inline-Java says this page received $gnb hits!
" . "Inline-Java says this MOD_PERL ($$) served $nb of those hits." . $q->end_html() ; return OK ; } 1 ; Inline-Java-0.58~dfsg/t/t4.pl0000755000000000000000000000120212436307565014443 0ustar rootrootuse strict ; use blib ; BEGIN { mkdir('./_Inline_test', 0777) unless -e './_Inline_test'; } use Inline Config => DIRECTORY => './_Inline_test' ; my @tests = split(/;;;;;/,<<'ETESTS'); Inline->bind(Java => <<'JAVA', class a { public a(){ } public int get(){ return 5 ; } } JAVA NAME => "a" ) ; my $a = new a() ; print $a->get() . "\n" ; ;;;;; Inline->bind(Java => <<'JAVA', class b { public b(){ } public int get(){ return 6 ; } } JAVA NAME => "a" ) ; my $b = new b() ; print $b->get() . "\n" ; ETESTS foreach my $t (@tests){ # `rm -Rf ./_Inline_test/*` ; eval $t ; if ($@){ die $@ ; } } Inline-Java-0.58~dfsg/t/12_2_perl_objects.t0000755000000000000000000000653612436307565017161 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline ( Java => 'DATA', ) ; use Inline::Java qw(caught) ; use Data::Dumper ; BEGIN { my $cnt = 21 ; plan(tests => $cnt) ; } my $t = new t16() ; { eval { my $o = new O::b::j(name => 'toto') ; $t->set($o) ; ok($t->get(), $o) ; ok($t->get()->{name}, 'toto') ; check_count(1) ; # po ok($t->round_trip($o), $o) ; check_count(2) ; # po + 1 leaked object ok($t->method_call($o, 'get', ['name']), 'toto') ; check_count(2) ; # po + 1 leaked object ok($t->add_eval(5, 6), 11) ; check_count(2) ; # po + 1 leaked object eval {$t->method_call($o, 'bad', ['bad'])} ; ok($@, qr/Can't locate object method "bad" via package "O::b::j"/) ; check_count(3) ; # po + $o + 1 leaked object eval {$t->round_trip({})} ; ok($@, qr/^Can't convert (.*?) to object org.perl.inline.java.InlineJavaPerlObject/) ; eval {$t->error()} ; ok($@, qr/alone/) ; check_count(3) ; # po + 2 leaked objects $t->dispose($o) ; check_count(2) ; # 2 leaked objects my $jo = $t->create("O::b::j", ['name', 'titi']) ; ok($jo->get("name"), 'titi') ; $t->have_fun() ; ok($jo->get('shirt'), qr/lousy t-shirt/) ; check_count(3) ; # po + 2 leaked objects $t->dispose(undef) ; check_count(2) ; # 2 leaked objects } ; if ($@){ if (caught("java.lang.Throwable")){ $@->printStackTrace() ; die("Caught Java Exception") ; } else{ die $@ ; } } } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; check_count(2) ; # 2 leaked objects sub check_count { ok($_[0], Inline::Java::Callback::ObjectCount()) ; } sub debug_objects { map {print "$_\n"} %{Inline::Java::Callback::__GetObjects()} ; } package O::b::j ; sub new { my $class = shift ; return bless({@_}, $class) ; } sub get { my $this = shift ; my $attr = shift ; return $this->{$attr} ; } sub set { my $this = shift ; my $attr = shift ; my $val = shift ; $this->{$attr} = $val ; } package main ; __END__ __Java__ import org.perl.inline.java.* ; class t16 { InlineJavaPerlObject po = null ; public t16(){ } public void set(InlineJavaPerlObject o){ po = o ; } public InlineJavaPerlObject get(){ return po ; } public int add_eval(int a, int b) throws InlineJavaException, InlineJavaPerlException { Integer i = (Integer)po.eval(a + " + " + b, Integer.class) ; return i.intValue() ; } public String method_call(InlineJavaPerlObject o, String name, Object args[]) throws InlineJavaException, InlineJavaPerlException { String s = (String)o.InvokeMethod(name, args) ; o.Dispose() ; return s ; } public void error() throws InlineJavaException, InlineJavaPerlException { po.eval("die 'alone'") ; } public InlineJavaPerlObject round_trip(InlineJavaPerlObject o) throws InlineJavaException, InlineJavaPerlException { return o ; } public void dispose(InlineJavaPerlObject o) throws InlineJavaException, InlineJavaPerlException { if (o != null){ o.Dispose() ; } if (po != null){ po.Dispose() ; } } public InlineJavaPerlObject create(String pkg, Object args[]) throws InlineJavaException, InlineJavaPerlException { po = new InlineJavaPerlObject(pkg, args) ; return po ; } public void have_fun() throws InlineJavaException, InlineJavaPerlException { po.InvokeMethod("set", new Object [] {"shirt", "I've been to Java and all I got was this lousy t-shirt!"}) ; } } Inline-Java-0.58~dfsg/t/15_native_doubles.t0000755000000000000000000000104012436307565017254 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'DATA', NATIVE_DOUBLES => 2, ) ; BEGIN { plan(tests => 3) ; } my $t = new t15() ; { # Here it is hard to test for accuracy, but either it works or it doesn't... ok($t->_Double(0.056200000000000028) > 0.056) ; ok($t->_Double(0.056200000000000028) < 0.057) ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ class t15 { public t15(){ } public Double _Double(Double d){ return d ; } } Inline-Java-0.58~dfsg/t/10_5_shared_fork.t0000755000000000000000000000205512436307565016766 0ustar rootrootpackage t10 ; use strict ; use Test ; BEGIN { # Leave previous server enough time to die... sleep(1) ; require Inline::Java::Portable ; if ($ENV{PERL_INLINE_JAVA_JNI}){ plan(tests => 0) ; exit ; } elsif (! Inline::Java::Portable::portable('GOT_FORK')){ plan(tests => 0) ; exit ; } else{ $t10::nb = 5 ; plan(tests => $t10::nb + 3) ; } } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 't/shared.java', SHARED_JVM => 1, PORT => 17891, NAME => 't10', ) ; $t10::t10::i = 0 ; my $nb = $t10::nb ; my $sum = (($nb) * ($nb + 1)) / 2 ; for (my $i = 0 ; $i < $nb ; $i++){ if (! fork()){ do_child($i) ; } } # Wait for kids to finish for (my $i = 0 ; $i < $nb ; $i++){ wait() ; ok(1) ; } ok($t10::t10::i, $sum) ; # Bring down the JVM ok(! Inline::Java::i_am_JVM_owner()) ; Inline::Java::capture_JVM() ; ok(Inline::Java::i_am_JVM_owner()) ; sub do_child { my $i = shift ; Inline::Java::reconnect_JVM() ; my $t = new t10::t10() ; for (my $j = 0 ; $j <= $i ; $j++){ $t->incr() ; } exit ; } Inline-Java-0.58~dfsg/t/shared_jvm_test.pl0000644000000000000000000000201712436307565017277 0ustar rootrootpackage shared_jvm_test ; use strict ; use blib ; BEGIN { mkdir('./_Inline_test', 0777) unless -e './_Inline_test'; } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'DATA', NAME => "shared_jvm_test", SHARED_JVM => 1, ) ; $shared_jvm_test::t::i = 0 ; my $nb = 10 ; my $sum = (($nb) * ($nb + 1)) / 2 ; for (my $i = 0 ; $i < $nb ; $i++){ if (! fork()){ print STDERR "." ; shared_jvm_test::do_child($i) ; } } # Wait for kids to finish for (my $i = 0 ; $i < 5 ; $i++){ sleep(1) ; print STDERR "." ; } print STDERR "\n" ; if ($shared_jvm_test::t::i == $sum){ print STDERR "Test succeeded\n" ; } else{ print STDERR "Test failed ($shared_jvm_test::t::i != $sum)\n" ; } sub do_child { my $i = shift ; Inline::Java::reconnect_JVM() ; my $t = new shared_jvm_test::t() ; my $j = 0 ; for ( ; $j <= $i ; $j++){ $t->incr_i() ; } exit ; } __DATA__ __Java__ import java.util.* ; class t { static public int i = 0 ; public t(){ } public void incr_i(){ i++ ; } } Inline-Java-0.58~dfsg/t/swing_callback.pl0000644000000000000000000000315712436307565017067 0ustar rootroot#!/usr/bin/perl use strict; use warnings; use blib ; use Inline Java => "DATA" ; package EventHandler ; sub new { my $class = shift ; my $max = shift ; return bless({max => $max, nb => 0}, $class) ; } sub button_pressed { my $this = shift ; my $button = shift ; $this->{nb}++ ; print "Button Pressed $this->{nb} times (from perl)\n" ; if ($this->{nb} > $this->{max}){ $button->StopCallbackLoop() ; } return $this->{nb} ; } my $button = MyButton->new(new EventHandler(10)); $button->StartCallbackLoop() ; print "loop done\n" ; package main ; __DATA__ __Java__ import java.util.*; import org.perl.inline.java.*; import javax.swing.*; import java.awt.event.*; public class MyButton extends InlineJavaPerlCaller implements ActionListener { InlineJavaPerlObject po = null ; public MyButton(InlineJavaPerlObject _po) throws InlineJavaException { po = _po ; // create frame JFrame frame = new JFrame("MyButton"); frame.setSize(200,200); // create button JButton button = new JButton("Click Me!"); frame.getContentPane().add(button); // tell the button that when it's clicked, report it to // this class. button.addActionListener(this); // all done, everything added, just show it frame.show(); } public void actionPerformed(ActionEvent e) { try { String cnt = (String)CallPerlMethod(po, "button_pressed", new Object [] {this}); System.out.println("Button Pressed " + cnt + " times (from java)") ; } catch (InlineJavaPerlException pe) { } catch (InlineJavaException pe) { pe.printStackTrace() ;} } } Inline-Java-0.58~dfsg/t/13_handles.t0000755000000000000000000000412012436307565015667 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', ) ; use Inline::Java qw(caught) ; BEGIN { # Leave previous server enough time to die... sleep(1) ; plan(tests => 12) ; } my $t = new t13() ; { my $f = File::Spec->catfile("t", "t13.txt") ; my $o = t13->getWriter($f) ; my $h = new Inline::Java::Handle($o) ; for (my $i = 1 ; $i <= 10 ; $i++){ print $h "$i\n" ; } close($h) ; ok(1) ; $o = t13->getReader($f) ; $h = new Inline::Java::Handle($o) ; for (my $i = 1 ; $i <= 10 ; $i++){ my $l = <$h> ; ok($l, $i) ; } ok(! defined(<$h>)) ; } # It seems that filehandle destruction leaks on certain version # of Perl. We will change this test to a warning. if ($t->__get_private()->{proto}->ObjectCount() != 1){ warn "\nWARNING: Your Perl version ($]) seems to leak tied filehandles. Using\n" . "Inline::Java::Handle objects will result in memory leaks both in Perl\n" . "and in Java\n" ; } __END__ __Java__ import java.io.* ; class t13 { public t13(){ } public static Reader getReader(String file) throws FileNotFoundException { return new FileReader(file) ; } public static Reader getBufferedReader(String file) throws FileNotFoundException { return new BufferedReader(new FileReader(file)) ; } public static InputStream getInputStream(String file) throws FileNotFoundException { return new FileInputStream(file) ; } public static InputStream getBufferedInputStream(String file) throws FileNotFoundException { return new BufferedInputStream(new FileInputStream(file)) ; } public static Writer getWriter(String file) throws IOException { return new FileWriter(file) ; } public static Writer getBufferedWriter(String file) throws IOException { return new BufferedWriter(new FileWriter(file)) ; } public static OutputStream getOutputStream(String file) throws FileNotFoundException { return new FileOutputStream(file) ; } public static OutputStream getBufferedOutputStream(String file) throws FileNotFoundException { return new BufferedOutputStream(new FileOutputStream(file)) ; } } Inline-Java-0.58~dfsg/t/14_encoding.t0000755000000000000000000000205112436307565016041 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'DATA' ) ; BEGIN { plan(tests => 9) ; } my $t = new t14() ; { ok($t->_String("A"), "A") ; ok($t->_String("\x{41}"), "A") ; ok($t->_String("A"), "\x{41}") ; # This is E9 (233), which is e acute. Although the byte # E9 is invalid in UTF-8, the character 233 is valid and # all should work out. ok($t->_String("\x{E9}"), "\x{E9}") ; my $a = $t->toCharArray("\x{E9}") ; ok(ord($a->[0]) == 233) ; # Send a unicode escape sequence. ok($t->_String("\x{263A}"), "\x{263A}") ; # Generate some binary data my $bin = '' ; for (my $i = 0; $i < 256 ; $i++) { my $c = chr($i) ; $bin .= $c ; } ok($t->_String($bin), $bin) ; # Mix it up ok($t->_String("$bin\x{E9}\x{263A}"), "$bin\x{E9}\x{263A}") ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ class t14 { public t14(){ } public String _String(String s){ return s ; } public char [] toCharArray(String s){ return s.toCharArray() ; } } Inline-Java-0.58~dfsg/t/shared.java0000644000000000000000000000016212436307565015671 0ustar rootrootclass t10 { static public int i = 5 ; public t10(){ } static synchronized public void incr(){ i++ ; } } Inline-Java-0.58~dfsg/t/swing_gui_test.pl0000644000000000000000000000136712436307565017157 0ustar rootrootuse strict ; use blib ; BEGIN { # $ENV{PERL_INLINE_JAVA_JNI} = 0 ; mkdir('./_Inline_test', 0777) unless -e './_Inline_test'; } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'DATA', STUDY => [ 'javax.swing.JFrame', 'javax.swing.JPanel', ], ) ; my $f = HelloJava1->get_frame("HelloJava1") ; $f->setSize(140, 100) ; $f->getContentPane()->add(new HelloJava1()) ; $f->setVisible(1) ; ; __END__ __Java__ class HelloJava1 extends javax.swing.JComponent { public HelloJava1() { } public void paintComponent(java.awt.Graphics g) { g.drawString("Hello from Java!", 17, 40) ; } public static javax.swing.JFrame get_frame(String name) { return new javax.swing.JFrame(name) ; } } Inline-Java-0.58~dfsg/t/09_usages.t0000755000000000000000000000200012436307565015540 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; BEGIN { plan(tests => 6) ; } package t09::p1 ; use Inline( Java => qq | class t09p1 { public static String name = "p1" ; public t09p1(){ } public static String get_prop(int n){ return System.getProperty("prop" + n) ; } } |, NAME => 't09::p1', EXTRA_JAVA_ARGS => '-Dprop1="c:\program files" -Dprop3=42', ) ; package t09::p2 ; use Inline( Java => qq | class t09p2 { public static String name = "p2" ; } |, NAME => 't09::p2', ) ; package t09::p3 ; Inline->bind( Java => qq | class t09p3 { public static String name = "p3" ; } |, NAME => 't09::p3', ) ; package main ; my $t = new t09::p1::t09p1() ; { ok($t->{name}, "p1") ; ok($t->get_prop(1), 'c:\program files') ; ok($t->get_prop(3), 42) ; ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ; ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; Inline-Java-0.58~dfsg/t/no_const.java0000644000000000000000000000007512436307565016250 0ustar rootrootpackage t ; public class no_const { public int i = 5 ; } Inline-Java-0.58~dfsg/t/CGI.cgi0000755000000000000000000000124412436307565014653 0ustar rootroot#!/usr/bin/perl package t::CGI ; use strict ; use CGI ; use CGI::Carp qw(fatalsToBrowser) ; use Inline ( Java => '/home/patrickl/DEV/Inline-Java/t/counter.java', DIRECTORY => '/home/patrickl/DEV/Inline-Java/_Inline_web_test', SHARED_JVM => 1, NAME => 't::CGI', ) ; BEGIN { $t::CGI::cnt = new t::CGI::counter() ; } my $gnb = $t::CGI::cnt->gincr() ; my $nb = $t::CGI::cnt->incr() ; my $q = new CGI() ; print "Content-type: text/html\n\n" ; print $q->start_html() . "Inline-Java " . $Inline::Java::VERSION . "

" . "Inline-Java says this page received $gnb hits!
" . "Inline-Java says this CGI ($$) served $nb of those hits." . $q->end_html() ; 1 ; Inline-Java-0.58~dfsg/t/types.class0000644000000000000000000000075112436307565015757 0ustar rootrootÊþº¾-   ()VCodeLineNumberTablefunc()Ljava/lang/String;hm()Ljava/util/HashMap; SourceFile types.java studyjava/util/HashMapkeyvalue t/typesjava/lang/Objectput8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;!   !*·±  °   3»Y·L+¶W+° Inline-Java-0.58~dfsg/t/01_init.t0000644000000000000000000000171012436307565015210 0ustar rootrootuse strict ; use Test ; BEGIN { $main::cp = $ENV{CLASSPATH} || "" ; plan(tests => 1) ; mkdir('./_Inline_test', 0777) unless -e './_Inline_test' ; } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'DATA' ) ; my $ij = $types1::INLINE ; $ij = $types1::INLINE ; # Stupid warning... my $jdk = $ij->get_java_config("J2SDK") ; my $ver = types1->version() ; print STDERR "\nPerl version is $]\n" ; print STDERR "Inline version is $Inline::VERSION\n" ; print STDERR "Inline::Java version is $Inline::Java::VERSION\n" ; print STDERR "J2SDK version is $ver, from $jdk\n" ; print STDERR "CLASSPATH is $main::cp\n" ; if ($ENV{PERL_INLINE_JAVA_EMBEDDED_JNI}){ print STDERR "Using JNI extension (embedded).\n" ; } elsif ($ENV{PERL_INLINE_JAVA_JNI}){ print STDERR "Using JNI extension.\n" ; } ok(1) ; __END__ __Java__ class types1 { static public String version(){ return System.getProperty("java.version") ; } } Inline-Java-0.58~dfsg/t/12_1_callbacks.t0000755000000000000000000002074212436307565016417 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline ( Java => 'DATA', STUDY => ['org.perl.inline.java.InlineJavaPerlCaller'], STARTUP_DELAY => 20, ) ; use Inline::Java qw(caught) ; BEGIN { my $cnt = 37 ; plan(tests => $cnt) ; } my $mtc_cnt = 0 ; my $mtc_mode = 0 ; my $t = new t15() ; { eval { ok($t->add(5, 6), 11) ; ok($t->add_via_perl(5, 6), 11) ; my $a = $t->incr_via_perl([7, 6, 5]) ; ok($a->[1], 7) ; $a = $t->incr_via_perl_ctx($a) ; ok($a->[1], 8) ; ok($t->mul(5, 6), 30) ; ok($t->mul_via_perl(5, 6), 30) ; ok($t->silly_mul(3, 2), 6) ; ok($t->silly_mul_via_perl(3, 2), 6) ; ok(add_via_java(3, 4), 7) ; ok($t->add_via_perl_via_java(3, 4), 7) ; ok($t->silly_mul_via_perl_via_java(10, 9), 90) ; ok(t15->add_via_perl_via_java_t($t, 6, 9), 15) ; ok($t->cat_via_perl("Inline", "Java"), "InlineJava") ; ok($t->perl_static(), 'main->static') ; ok(twister(20, 0, 0), "return perl twister") ; ok($t->twister(20, 0, 0), "return java twister") ; eval {twister(20, 0, 1)} ; ok($@, qr/^throw perl twister/) ; my $msg = '' ; eval {$t->twister(20, 0, 1)} ; if ($@) { if (caught('t15$OwnException')){ $msg = $@->getMessage() ; } else{ die $@ ; } } ok($msg, "throw java twister") ; eval {$t->bug()} ; ok($@, qr/^bug/) ; ok($t->perlt()->add(5, 6), 11) ; eval {$t->perldummy()} ; ok($@, qr/Can't propagate non-/) ; #' $t->mtc_callbacks(20) ; $t->StartCallbackLoop() ; ok($mtc_cnt, 20) ; $mtc_cnt = -30 ; $t->mtc_callbacks2(50) ; $t->StartCallbackLoop() ; ok($mtc_cnt, 20) ; $mtc_cnt = 0 ; $mtc_mode = 1 ; $t->mtc_callbacks2(20) ; $t->StartCallbackLoop() ; ok($mtc_cnt, 20) ; $mtc_cnt = 0 ; $mtc_mode = 2 ; $t->mtc_callbacks2(20) ; $t->OpenCallbackStream() ; while (($mtc_cnt < 20)&&($t->WaitForCallback(-1) > 0)){ $t->ProcessNextCallback() ; } ok($mtc_cnt, 20) ; $mtc_cnt = 0 ; $mtc_mode = 2 ; $t->mtc_callbacks2(10) ; while ($t->WaitForCallback(3.1416) > 0){ ok($t->WaitForCallback(0) >= 1) ; $t->ProcessNextCallback() ; } ok($mtc_cnt, 10) ; # Unfortunately we can't test this because the Thread.run method doesn't allow us # to throw any exceptions... # $t->mtc_callbacks_error() ; } ; if ($@){ if (caught("java.lang.Throwable")){ $@->printStackTrace() ; die("Caught Java Exception") ; } else{ die $@ ; } } } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; sub add { my $i = shift ; my $j = shift ; return $i + $j ; } sub incr { my $ija = shift ; for (my $i = 0 ; $i < $ija->length() ; $i++){ $ija->[$i]++ ; } return wantarray ? @{$ija} : $ija ; } sub mul { my $i = shift ; my $j = shift ; return $i * $j ; } sub cat { my $i = shift ; my $j = shift ; return $i . $j ; } sub add_via_java { my $i = shift ; my $j = shift ; return $t->add($i, $j) ; } sub add_via_java_t { my $_t = shift ; my $i = shift ; my $j = shift ; return $_t->add($i, $j) ; } sub twister { my $max = shift ; my $cnt = shift ; my $explode = shift ; if ($cnt == $max){ if ($explode){ die("throw perl twister") ; } else{ return "return perl twister" ; } } else{ return $t->twister($max, $cnt+1, $explode) ; } } sub t { return $t ; } sub dummy { die(bless({}, "Inline::Java::dummy")) ; } sub mt_callback { my $pc = shift ; $mtc_cnt++ ; if ($mtc_cnt >= 20){ if ($mtc_mode == 0){ $pc->StopCallbackLoop() ; } elsif ($mtc_mode == 1){ my $o = new org::perl::inline::java::InlineJavaPerlCaller() ; $o->StopCallbackLoop() ; } } } sub static_method { my $class = shift ; return 'main->static' ; } __END__ __Java__ import java.io.* ; import org.perl.inline.java.* ; class t15 extends InlineJavaPerlCaller { class OwnException extends Exception { OwnException(String msg){ super(msg) ; } } class OwnThread extends Thread { InlineJavaPerlCaller pc = null ; boolean error = false ; OwnThread(InlineJavaPerlCaller _pc, int nb, boolean err){ super("CALLBACK-TEST-THREAD-#" + nb) ; pc = _pc ; error = err ; } public void run(){ try { if (! error){ pc.CallPerlSub("main::mt_callback", new Object [] {pc}) ; } else { new InlineJavaPerlCaller() ; } } catch (InlineJavaException ie){ ie.printStackTrace() ; } catch (InlineJavaPerlException ipe){ ipe.printStackTrace() ; } } } public t15() throws InlineJavaException { } public int add(int a, int b){ return a + b ; } public int mul(int a, int b){ return a * b ; } public int silly_mul(int a, int b){ int ret = 0 ; for (int i = 0 ; i < b ; i++){ ret = add(ret, a) ; } return a * b ; } public int silly_mul_via_perl(int a, int b) throws InlineJavaException, InlineJavaPerlException { int ret = 0 ; for (int i = 0 ; i < b ; i++){ ret = add_via_perl(ret, a) ; } return ret ; } public int add_via_perl(int a, int b) throws InlineJavaException, InlineJavaPerlException { String val = (String)CallPerlSub("main::add", new Object [] {new Integer(a), new Integer(b)}) ; return new Integer(val).intValue() ; } public int [] incr_via_perl(int a[]) throws InlineJavaException, InlineJavaPerlException { int [] r = (int [])CallPerlSub("main::incr", new Object [] {a}, a.getClass()) ; return r ; } public int [] incr_via_perl_ctx(int a[]) throws InlineJavaException, InlineJavaPerlException { int [] r = (int [])CallPerlSub("@main::incr", new Object [] {a}, a.getClass()) ; return r ; } public void death_via_perl() throws InlineJavaException, InlineJavaPerlException { InlineJavaPerlCaller c = new InlineJavaPerlCaller() ; c.CallPerlSub("main::death", null) ; } public void except() throws InlineJavaException, InlineJavaPerlException { throw new InlineJavaPerlException("test") ; } public int mul_via_perl(int a, int b) throws InlineJavaException, InlineJavaPerlException { String val = (String)CallPerlSub("main::mul", new Object [] {new Integer(a), new Integer(b)}) ; return new Integer(val).intValue() ; } public int add_via_perl_via_java(int a, int b) throws InlineJavaException, InlineJavaPerlException { String val = (String)CallPerlSub("main::add_via_java", new Object [] {new Integer(a), new Integer(b)}) ; return new Integer(val).intValue() ; } static public int add_via_perl_via_java_t(t15 t, int a, int b) throws InlineJavaException, InlineJavaPerlException { InlineJavaPerlCaller c = new InlineJavaPerlCaller() ; String val = (String)c.CallPerlSub("main::add_via_java_t", new Object [] {t, new Integer(a), new Integer(b)}) ; return new Integer(val).intValue() ; } public int silly_mul_via_perl_via_java(int a, int b) throws InlineJavaException, InlineJavaPerlException { int ret = 0 ; for (int i = 0 ; i < b ; i++){ String val = (String)CallPerlSub("add_via_java", new Object [] {new Integer(ret), new Integer(a)}) ; ret = new Integer(val).intValue() ; } return ret ; } public String cat_via_perl(String a, String b) throws InlineJavaException, InlineJavaPerlException { String val = (String)CallPerlSub("cat", new Object [] {a, b}) ; return val ; } public String twister(int max, int cnt, int explode) throws InlineJavaException, InlineJavaPerlException, OwnException { if (cnt == max){ if (explode > 0){ throw new OwnException("throw java twister") ; } else{ return "return java twister" ; } } else{ return (String)CallPerlSub("twister", new Object [] {new Integer(max), new Integer(cnt+1), new Integer(explode)}) ; } } public void bug() throws InlineJavaException { throw new InlineJavaException("bug") ; } public Object perlt() throws InlineJavaException, InlineJavaPerlException, OwnException { return CallPerlSub("t", null) ; } public Object perl_static() throws InlineJavaException, InlineJavaPerlException, OwnException { return CallPerlStaticMethod("main", "static_method", null) ; } public Object perldummy() throws InlineJavaException, InlineJavaPerlException, OwnException { return CallPerlSub("dummy", null) ; } public void mtc_callbacks(int n){ for (int i = 0 ; i < n ; i++){ OwnThread t = new OwnThread(this, i, false) ; t.start() ; } } public void mtc_callbacks2(int n) throws InlineJavaException, InlineJavaPerlException { for (int i = 0 ; i < n ; i++){ InlineJavaPerlCaller pc = new InlineJavaPerlCaller() ; OwnThread t = new OwnThread(pc, i, false) ; t.start() ; } } public void mtc_callbacks_error(){ OwnThread t = new OwnThread(this, 0, true) ; t.start() ; } } Inline-Java-0.58~dfsg/t/10_1_shared_alone.t0000755000000000000000000000074612436307565017124 0ustar rootrootuse strict ; use Test ; BEGIN { if ($ENV{PERL_INLINE_JAVA_JNI}){ plan(tests => 0) ; exit ; } else{ plan(tests => 4) ; } } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 't/shared.java', SHARED_JVM => 1, PORT => 17891 ) ; my $t = new t10() ; { ok($t->{i}, 5) ; ok(! Inline::Java::i_am_JVM_owner()) ; Inline::Java::capture_JVM() ; ok(Inline::Java::i_am_JVM_owner()) ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; Inline-Java-0.58~dfsg/t/t13.txt0000644000000000000000000000002512436307565014726 0ustar rootroot1 2 3 4 5 6 7 8 9 10 Inline-Java-0.58~dfsg/t/02_primitives_1_4.t0000755000000000000000000000165412436307565017116 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test' ; package t02_14 ; use Inline( Java => qq | class t02_14 { public static boolean got14(){ try { Class c = Class.forName("java.lang.CharSequence") ; } catch (ClassNotFoundException cnfe){ return false ; } return true ; } } |, NAME => 't02_14', ) ; package main ; BEGIN { my $got14 = t02_14::t02_14->got14() ; if (! $got14){ plan(tests => 0) ; exit(0) ; } plan(tests => 4) ; } use Inline( Java => 'DATA', ) ; my $t = new types2_1() ; { ok($t->_CharSequence(undef), undef) ; ok($t->_CharSequence(0), "0") ; ok($t->_CharSequence("charsequence"), "charsequence") ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ class types2_1 { public types2_1(){ } public CharSequence _CharSequence(CharSequence c){ return c ; } } Inline-Java-0.58~dfsg/t/08_study.t0000644000000000000000000000320712436307565015427 0ustar rootrootpackage study ; use strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', ) ; # There once was a bug with importing code twice. use Inline( Java => 'STUDY', AUTOSTUDY => 1, STUDY => ['t.types'], CLASSPATH => '.', ) ; use Inline( Java => 'STUDY', AUTOSTUDY => 1, STUDY => ['t.types'], CLASSPATH => '.', ) ; package toto ; use Inline( Java => 'STUDY', AUTOSTUDY => 1, STUDY => ['t.types'], CLASSPATH => '.', ) ; use Inline( Java => 'STUDY', AUTOSTUDY => 1, STUDY => ['t.types'], CLASSPATH => '.', PACKAGE => 'main', ) ; package study ; use Inline::Java qw(study_classes) ; BEGIN { plan(tests => 11) ; } study_classes([ 't.no_const' ]) ; my $t = new study::t::types() ; { ok($t->func(), "study") ; ok($t->hm()->get("key"), "value") ; my $nc = new study::t::no_const() ; ok($nc->{i}, 5) ; my $a = new study::study::a8() ; ok($a->{i}, 50) ; ok($a->truth()) ; ok($a->sa()->[1], 'titi') ; ok($a->sb()->[0]->get('toto'), 'titi') ; ok($a->sb()->[1]->get('error'), undef) ; my $toto_t = new toto::t::types() ; ok(1) ; my $main_t = new t::types() ; ok(1) ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __DATA__ __Java__ // Use a public class package study ; import java.util.* ; public class a8 { public int i = 50 ; public a8(){ } public boolean truth(){ return true ; } public String [] sa(){ String a[] = {"toto", "titi"} ; return a ; } public HashMap [] sb(){ HashMap h1 = new HashMap() ; HashMap h2 = new HashMap() ; h1.put("toto", "titi") ; h2.put("tata", "tete") ; HashMap a[] = {h1, h2} ; return a ; } } Inline-Java-0.58~dfsg/t/05_arrays.t0000644000000000000000000001242212436307565015554 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA' ) ; BEGIN { plan(tests => 55) ; } my $t = new types5() ; { ok(++($t->_byte([12, 34, 56])->[0]) == 124) ; ok(eq_array($t->_Byte([12, 34, 56]), [12, 34, 56])) ; ok(++($t->_short([12, 34, 56])->[0]) == 124) ; ok(eq_array($t->_Short([12, 34, 56]), [12, 34, 56])) ; ok(++($t->_int([12, 34, 56])->[0]) == 124) ; ok(eq_array($t->_Integer([12, 34, 56]), [12, 34, 56])) ; ok(++($t->_long([12, 34, 56])->[0]) == 124) ; ok(eq_array($t->_Long([12, 34, 56]), [12, 34, 56])) ; ok(++($t->_float([12.34, 5.6, 7])->[0]) == 124.456) ; ok(eq_array($t->_Float([12.34, 5.6, 7]), [12.34, 5.6, 7])) ; ok(++($t->_double([12.34, 5.6, 7])->[0]) == 124.456) ; ok(eq_array($t->_Double([12.34, 5.6, 7]), [12.34, 5.6, 7])) ; ok($t->_boolean([1, 0, "tree"])->[0]) ; ok($t->_Boolean([1, 0])->[0]) ; ok(! $t->_Boolean([1, 0])->[1]) ; ok($t->_char(['a', 'b', 'c'])->[0], "A") ; ok(eq_array($t->_Character(['a', 'b', 'c']), ['a', 'b', 'c'], 1)) ; my $a = $t->_String(["bla", "ble", "bli"]) ; ok($a->[0], "STRING") ; $a->[1] = "wazoo" ; ok($a->[1], "wazoo") ; ok($t->_StringBuffer(["bla", "ble", "bli"])->[0], "STRINGBUFFER") ; ok($t->_Object(undef), undef) ; $a = $t->_Object([1, "two", $t]) ; ok($a->[0], "1") ; ok($a->[1], "two") ; ok(UNIVERSAL::isa($a->[2], "main::types5")) ; ok($a->[2]->{data}->[1], "a") ; $a->[2]->{data} = ["1", "2"] ; ok($a->[2]->{data}->[1], 2) ; $a->[0]++ ; ok($a->[0], "2") ; $a->[1] = "three" ; ok($a->[1], "three") ; $a->[2] = "string" ; ok($a->[2], "string") ; $a->[0] = $t ; ok(UNIVERSAL::isa($a->[0], "main::types5")) ; # Try some multidimensional arrays. $a = $t->_StringString([ ["00", "01"], ["10", "11"] ]) ; # Try some incomplete multidimensional arrays. $a = $t->_StringString([ [undef, "01", "02"], [undef, "11"], undef, ]) ; ok($a->[1]->[0], undef) ; my $b = $a->[1] ; ok($t->_String($b)->[0], "STRING") ; # Arrays of other arrays $a = $t->_StringString([ $a->[0], ]) ; ok($a->[0]->[2], "02") ; # This is one of the things that won't work. # Try passing an array as an Object. eval {$t->_o(["a", "b", "c"])} ; ok($@, qr/Can't create Java array/) ; ok($t->_o(Inline::Java::coerce( "java.lang.Object", ["a", "b", "c"], "[Ljava.lang.String;"))->[0], "a") ; $t->{o} = Inline::Java::coerce( "java.lang.Object", ["a", "b", "c"], "[Ljava.lang.String;") ; ok($t->{o}->[0], "a") ; $t->{o} = $t->{i} ; ok($t->{o}->[0], "1") ; # Mixed types eval {$t->_int(["3", "3456", "cat"])} ; ok($@, qr/Can't convert/) ; ok($t->_Object(["3", "3456", "cat"])->[2], 'cat') ; # Badly constructed array eval {$t->_int(["3", [], "cat"])} ; ok($@, qr/Java array contains mixed types/) ; eval {$t->_StringString([["3"], "string"])} ; ok($@, qr/Java array contains mixed types/) ; # Invalid operations on arrays. eval {@{$b} = ()} ; ok($@, qr/Operation CLEAR/) ; eval {pop @{$b}} ; ok($@, qr/Operation POP/) ; eval {shift @{$b}} ; ok($@, qr/Operation SHIFT/) ; eval {splice(@{$b}, 0, 1)} ; ok($@, qr/Operation SPLICE/) ; eval {$b->[10] = 5} ; ok($@, qr/out of bounds/) ; # Cool stuff on arrays $a = $t->_byte([12, 34, 56]) ; ok(scalar(@{$a}), 3) ; foreach my $e (@{$a}){ ok($e =~ /^(123|34|56)$/) ; } # Zero length arrays $a = $t->_Byte([]) ; ok(scalar(@$a), 0) ; $a = $t->_StringString([[], []]) ; ok(scalar(@{$a}), 2) ; ok(scalar(@{$a->[0]}), 0) ; ok(scalar(@{$a->[1]}), 0) ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; sub eq_array { my $a1 = shift ; my $a2 = shift ; my $eq = shift || 0 ; if (scalar(@{$a1}) != scalar(@{$a2})){ return 0 ; } my $ok = 1 ; for (0..$#{$a1}){ if ($eq){ $ok = ($a1->[$_] eq $a2->[$_]) ; } else{ $ok = ($a1->[$_] == $a2->[$_]) ; } last unless $ok ; } return $ok ; } __END__ __Java__ class types5 { public Object o ; public int i[] = {1, 2, 3} ; public String data[] = {"d", "a", "t", "a"} ; public types5(){ } public byte[] _byte(byte b[]){ b[0] = (byte)123 ; return b ; } public Byte[] _Byte(Byte b[]){ return b ; } public short[] _short(short s[]){ s[0] = (short)123 ; return s ; } public Short[] _Short(Short s[]){ return s ; } public int[] _int(int i[]){ i[0] = 123 ; return i ; } public Integer[] _Integer(Integer i[]){ return i ; } public long[] _long(long l[]){ l[0] = 123 ; return l ; } public Long[] _Long(Long l[]){ return l ; } public float[] _float(float f[]){ f[0] = (float)123.456 ; return f ; } public Float[] _Float(Float f[]){ return f ; } public double[] _double(double d[]){ d[0] = 123.456 ; return d ; } public Double[] _Double(Double d[]){ return d ; } public boolean[] _boolean(boolean b[]){ b[0] = true ; return b ; } public Boolean[] _Boolean(Boolean b[]){ return b ; } public char[] _char(char c[]){ c[0] = 'A' ; return c ; } public Character[] _Character(Character c[]){ return c ; } public String[] _String(String s[]){ s[0] = "STRING" ; return s ; } public String[][] _StringString(String s[][]){ return s ; } public StringBuffer[] _StringBuffer(StringBuffer sb[]){ sb[0] = new StringBuffer("STRINGBUFFER") ; return sb ; } public Object[] _Object(Object o[]){ return o ; } public Object _o(Object o){ return o ; } } Inline-Java-0.58~dfsg/t/11_exceptions.t0000755000000000000000000000431212436307565016433 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', ) ; use Inline::Java qw(caught) ; BEGIN { # Leave previous server enough time to die... sleep(1) ; plan(tests => 8) ; } my $t = new t9(0) ; { my $msg = '' ; eval { $t->f() ; } ; if ($@){ if (caught("java.io.IOException")){ $msg = $@->getMessage() . "io" ; } elsif (caught("java.lang.Exception")){ $msg = $@->getMessage() ; } else { die $@ ; } } ; ok($msg, "from fio") ; $msg = '' ; eval { $t->f() ; } ; if ($@){ if (caught("java.lang.Throwable")){ $msg = $@->getMessage() ; } elsif (caught("java.io.IOException")){ $msg = $@->getMessage() . "io" ; } else { die $@ ; } } ok($msg, "from f") ; $msg = '' ; eval { die("not e\n") ; } ; if ($@){ if (caught("java.lang.Exception")){ $msg = $@->getMessage() ; } else { $msg = $@ ; } } ok($msg, "not e\n") ; my $e = $t->f2() ; ok($e->getMessage(), "from f2") ; $msg = '' ; eval { my $t2 = new t9(1) ; } ; if ($@){ if (caught("java.lang.Exception")){ $msg = $@->getMessage() ; } else{ die $@ ; } } ok($msg, "from const") ; # Undeclared exception, java.lang.NullPointerException $msg = '' ; eval { my $t2 = new t9(0) ; $t2->len(undef) ; } ; if ($@){ if (caught("java.lang.NullPointerException")){ $msg = "null" ; } else { die $@ ; } } ok($msg, "null") ; # Undeclared exception, java.lang.NullPointerException $msg = '' ; eval { my $t2 = new t9(0) ; $t2->len(undef) ; } ; if ($@){ if (caught("java.lang.IOException")){ $msg = "io" ; } elsif (caught("java.lang.Exception")){ $msg = "null" ; } else{ die $@ ; } } ok($msg, "null") ; # Make sure the last exception is not lying around... $@ = undef ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ import java.io.* ; class t9 { public t9(boolean t) throws Exception { if (t){ throw new Exception("from const") ; } } public String f() throws IOException { throw new IOException("from f") ; } public IOException f2() { return new IOException("from f2") ; } public int len(String s) { return s.length() ; } } Inline-Java-0.58~dfsg/t/t2.pl0000755000000000000000000000164412436307565014453 0ustar rootrootuse strict ; use blib ; use Inline Config => DIRECTORY => './_Inline_test', # PRINT_INFO => 1, ; BEGIN { $Inline::Java::DEBUG = 1 ; } package Foo ; use Inline ( Java => <<'END', class Foo { String data = "data" ; public Foo() { System.out.println("new Foo object being created") ; } public String get_data(){ return data ; } public void set_data(String d){ data = d ; } public class Fighters { public Fighters() { } } } END FORCE_BUILD => 1, NAME => "Foo") ; package Bar ; use Inline ( Java => <<'END', class Bar extends Foo { String data = "data" ; public Bar(Foo f) { System.out.println("new Bar object being created") ; } public String get_data(){ return data ; } public void set_data(String d){ data = d ; } } END FORCE_BUILD => 1, NAME => "Bar") ; my $f = new Foo::Foo() ; my $b = new Bar::Bar($f) ; Inline-Java-0.58~dfsg/t/04_members.t0000644000000000000000000000525212436307565015707 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', ) ; BEGIN { plan(tests => 28) ; } my $t = new types4() ; { $t->{_byte} = 123 ; ok($t->{_byte} == 123) ; $t->{_Byte} = 123 ; ok($t->{_Byte} == 123) ; $t->{_short} = 123 ; ok($t->{_short} == 123) ; $t->{_Short} = 123 ; ok($t->{_Short} == 123) ; $t->{_int} = 123 ; ok($t->{_int} == 123) ; $t->{_Integer} = 123 ; ok($t->{_Integer} == 123) ; $t->{_long} = 123 ; ok($t->{_long} == 123) ; $t->{_Long} = 123 ; ok($t->{_Long} == 123) ; $t->{_float} = 123.456 ; ok($t->{_float} == 123.456) ; $t->{_Float} = 123.456 ; ok($t->{_Float} == 123.456) ; $t->{_double} = 123.456 ; ok($t->{_double} == 123.456) ; $t->{_Double} = 123.456 ; ok($t->{_Double} == 123.456) ; $t->{_boolean} = 1 ; ok($t->{_boolean}) ; $t->{_Boolean} = 1 ; ok($t->{_Boolean}) ; $t->{_char} = "a" ; ok($t->{_char}, "a") ; $t->{_Character} = "a" ; ok($t->{_Character}, "a") ; $t->{_String} = "string" ; ok($t->{_String}, "string") ; $t->{_StringBuffer} = "stringbuffer" ; ok($t->{_StringBuffer}, "stringbuffer") ; my $obj1 = new obj14() ; $t->{_Object} = $obj1 ; ok($t->{_Object}->get_data(), "obj1") ; $t->{_Object} = "object" ; ok($t->{_Object}, "object") ; $t->{_Object} = undef ; ok($t->{_Object}, undef) ; $t->{_int} = undef ; ok($t->{_int} == 0) ; # Receive an unbound object and try to call a member my $unb = $t->get_unbound() ; eval {$unb->{toto} = 1} ; ok($@, qr/Can't set member/) ; eval {my $a = $unb->{toto}} ; ok($@, qr/Can't get member/) ; # Unexisting member eval {$t->{toto} = 1} ; ok($@, qr/No public member/) ; eval {my $a = $t->{toto}} ; ok($@, qr/No public member/) ; # Incompatible type eval {$t->{_long} = $obj1} ; ok($@, qr/Can't convert/) ; } ok($t->__get_private()->{proto}->ObjectCount(), 1) ; __END__ __Java__ import java.util.* ; class obj14 { String data = "obj1" ; public obj14() { } public String get_data(){ return data ; } } class types4 { public byte _byte ; public Byte _Byte ; public short _short ; public Short _Short ; public int _int ; public Integer _Integer ; public long _long ; public Long _Long ; public float _float ; public Float _Float ; public double _double ; public Double _Double ; public boolean _boolean ; public Boolean _Boolean ; public char _char ; public Character _Character ; public String _String ; public StringBuffer _StringBuffer ; public Object _Object ; public types4(){ } public ArrayList get_unbound(){ ArrayList al = new ArrayList() ; al.add(0, "al_elem") ; return al ; } public String send_unbound(ArrayList al){ return (String)al.get(0) ; } } Inline-Java-0.58~dfsg/t/99_end.t0000644000000000000000000000034412436307565015036 0ustar rootrootuse strict ; use Test ; BEGIN { plan(tests => 1) ; } use Inline Config => DIRECTORY => './_Inline_test' ; use Inline ( Java => 'STUDY', ) ; Inline::Java::capture_JVM() ; ok(Inline::Java::i_am_JVM_owner()) ; Inline-Java-0.58~dfsg/t/t3.pl0000755000000000000000000000102212436307565014442 0ustar rootrootuse strict ; use blib ; require "Inline/Java.pm" ; use Inline::Java::Array ; use Data::Dumper ; $Inline::Java::DEBUG = 1 ; my $obj = {} ; bless($obj, "Inline::Java::Object") ; my $a = new Inline::Java::Array("[[[I") ; my $ref = [ [ [1, 2, 3], [4, 5], ], [ [6, 7, 8], [9], ], ] ; $a->__init_from_array($ref) ; my $flat = $a->__flatten_array() ; my $b = new Inline::Java::Array("[[[I") ; $b->__init_from_flat(@{$flat}) ; my $aa = Dumper($a) ; my $bb = Dumper($b) ; if ($aa eq $bb){ die("Happy man!") ; } Inline-Java-0.58~dfsg/t/t1.pl0000755000000000000000000000062312436307565014446 0ustar rootrootuse strict ; use blib ; use Inline Java => <<'END_OF_JAVA_CODE' ; public class cache { public int i = 0 ; public cache(){ } public void m1(int j){ i++ ; } public void m2(int i){ } public void m3(int i){ } public void m4(int i){ } public void m5(int i){ } } END_OF_JAVA_CODE my $c = new cache() ; for (my $i = 0 ; $i < 10000 ; $i++){ $c->m1($i) ; } print $c->{i} . "\n" ; Inline-Java-0.58~dfsg/t/pod_test.pl0000644000000000000000000000262712436307565015746 0ustar rootrootuse strict ; use blib ; use Getopt::Long ; BEGIN { mkdir('./_Inline_test', 0777) unless -e './_Inline_test'; } use Inline Config => DIRECTORY => './_Inline_test'; require Inline::Java ; my %opts = () ; GetOptions (\%opts, "d", # debug "s=i", # skip to "o=i", # only ) ; my $skip_to = $opts{s} || 0 ; my $cnt = -1 ; foreach my $podf ('Java.pod', 'Java/Callback.pod', 'Java/PerlNatives/PerlNatives.pod'){ open(POD, "<$podf") or die("Can't open $podf file") ; my $pod = join("", ) ; close(POD) ; my $del = "\n=for comment\n" ; my @code_blocks = ($pod =~ m/$del(.*?)$del/gs) ; foreach my $code (@code_blocks){ $cnt++ ; if ((defined($opts{o}))&&($opts{o} != $cnt)){ print "skipped\n" ; next ; } if ($cnt < $skip_to){ print "skipped\n" ; next ; } print "-> Code Block $cnt ($podf)\n" ; $code =~ s/(\n)( )/$1/gs ; $code =~ s/(((END(_OF_JAVA_CODE)?)|STUDY)\')/$1, NAME => "main::main" / ; $code =~ s/(STUDY\')/$1, AUTOSTUDY => 1 / ; if (($code =~ /SHARED_JVM/)&&($opts{o} != $cnt)){ print "skipped\n" ; next ; } $code =~ s/print\((.*) \. \"\\n\"\) ; # prints (.*)/{ "print (((($1) eq ('$2')) ? \"ok\" : \"not ok ('$1' ne '$2')\") . \"\\n\") ;" ; }/ge ; my $Entry = '$Entry' ; debug($code) ; eval $code ; if ($@){ die $@ ; } } } sub debug { my $msg = shift ; if ($opts{d}){ print $msg ; } } Inline-Java-0.58~dfsg/t/10_6_shared_sim.t0000644000000000000000000000210012436307565016602 0ustar rootrootpackage t10 ; use strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; BEGIN { # Leave previous server enough time to die... sleep(1) ; if ($ENV{PERL_INLINE_JAVA_JNI}){ plan(tests => 0) ; exit ; } else{ plan(tests => 7) ; } } Inline->bind( Java => 't/shared.java', SHARED_JVM => 1, PORT => 17891, NAME => 't10', ) ; { my $t = new t10::t10() ; ok($t->{i}++, 5) ; ok(! Inline::Java::i_am_JVM_owner()) ; } my $JVM1 = Inline::Java::__get_JVM() ; $JVM1->{destroyed} = 1 ; Inline::Java::__clear_JVM() ; Inline->bind( Java => 't/shared.java', SHARED_JVM => 1, PORT => 17891, NAME => 't10', ) ; { my $t = new t10::t10() ; ok($t->{i}++, 6) ; ok(! Inline::Java::i_am_JVM_owner()) ; } my $JVM2 = Inline::Java::__get_JVM() ; $JVM2->{destroyed} = 1 ; Inline::Java::__clear_JVM() ; Inline->bind( Java => 't/shared.java', SHARED_JVM => 1, PORT => 17891, NAME => 't10', ) ; { my $t = new t10::t10() ; ok($t->{i}, 7) ; ok(! Inline::Java::i_am_JVM_owner()) ; Inline::Java::capture_JVM() ; ok(Inline::Java::i_am_JVM_owner()) ; } Inline-Java-0.58~dfsg/t/MOD_PERL.pl0000644000000000000000000000006012436307565015353 0ustar rootrootuse lib "/home/patrickl/DEV/Inline-Java" ; 1 ; Inline-Java-0.58~dfsg/t/t5.pl0000755000000000000000000000167712436307565014464 0ustar rootrootuse strict ; use blib ; BEGIN { mkdir('./_Inline_test', 0777) unless -e './_Inline_test'; } use Inline Config => DIRECTORY => './_Inline_test' ; my @tests = split(/;;;;;/,<<'ETESTS'); Inline->bind(Java => <<'JAVA', class a { public a(){ } public int get(){ return 5 ; } } JAVA NAME => "" ) ; my $a = new a() ; print $a->get() . "\n" ; ;;;;; Inline->bind(Java => <<'JAVA', class b { public b(){ } public int get(){ return 6 ; } } JAVA NAME => "" ) ; my $b = new b() ; print $b->get() . "\n" ; ETESTS my $nb = scalar(@tests) ; my $cp = "[PERL_INLINE_JAVA=" . join(", ", map{"Test$_"} (0..$nb-1)) . "]" ; $ENV{CLASSPATH} = $cp ; my $cnt = 0 ; foreach my $t (@tests){ # `rm -Rf ./_Inline_test/*` ; # Insert the package name and replace the macros my $pkg = "Test$cnt" ; $t = "package $pkg ;\n" . $t ; $t =~ s//$pkg$1/g ; eval $t ; if ($@){ die $@ ; } $cnt++ ; } Inline-Java-0.58~dfsg/t/06_static.t0000644000000000000000000000265512436307565015552 0ustar rootrootuse strict ; use Test ; use Inline Config => DIRECTORY => './_Inline_test'; use Inline( Java => 'DATA', ) ; BEGIN { plan(tests => 10) ; } # Methods ok(p06::types6->get("key"), undef) ; my $t = new p06::types6("key", "value") ; { ok($t->get("key"), "value") ; # Members ok($p06::types6::i == 5) ; $p06::types6::i = 7 ; ok($t->{i} == 7) ; my $t2 = new p06::types6("key2", "value2") ; my $hm = $p06::types6::hm ; $p06::types6::hm = undef ; ok(p06::types6->get($hm, "key2"), "value2") ; $p06::types6::hm = $hm ; ok($t2->get("key2"), "value2") ; # Calling an instance method without an object reference eval {p06::types6->set()} ; ok($@, qr/must be called from an object reference/) ; # Put in back like before... $p06::types6::i = 5 ; ok($p06::types6::i == 5) ; my $tt = new p06::types6("key", undef) ; ok($tt->get("key"), undef) ; } # Since $types::hm was returned to the Perl space, it was registered in the object # HashMap. ok($t->__get_private()->{proto}->ObjectCount(), 2) ; __END__ __Java__ // package test package p06 ; import java.util.* ; public class types6 { public static int i = 5 ; public static HashMap hm = new HashMap() ; public types6(String k, String v){ hm.put(k, v) ; } public static String get(String k){ return (String)hm.get(k) ; } public static String get(HashMap h, String k){ return (String)h.get(k) ; } public String set(){ return "set" ; } } Inline-Java-0.58~dfsg/t/types.java0000644000000000000000000000034012436307565015565 0ustar rootrootpackage t ; import java.util.* ; public class types { public types(){ } public String func(){ return "study" ; } public HashMap hm(){ HashMap hm = new HashMap() ; hm.put("key", "value") ; return hm ; } } Inline-Java-0.58~dfsg/TODO0000644000000000000000000000035012436307565014004 0ustar rootrootCODE: - Localize $@ where required - Finish PerlInterpreter test suite - Finish PerlHandle stuff and document DOCUMENTATION: - Document new Callback Interface - Document InlineJavaPerlObject when finished TEST: - Alpha - Cygwin Inline-Java-0.58~dfsg/Java.pm0000644000000000000000000006501712436307565014546 0ustar rootrootpackage Inline::Java; use strict; require 5.006; use base qw(Inline Exporter); # Export the cast function if wanted our @EXPORT_OK = qw(cast coerce study_classes caught jar j2sdk); our $VERSION = '0.58'; # DEBUG is set via the DEBUG config our $DEBUG = 0 unless defined $DEBUG; *DEBUG_STREAM = *STDERR; # Set DEBUG stream use Carp; use Config; use File::Copy; use File::Spec; use Cwd; use Data::Dumper; use Inline::Java::Portable; use Inline::Java::Class; use Inline::Java::Object; use Inline::Java::Array; use Inline::Java::Handle; use Inline::Java::Protocol; use Inline::Java::Callback; # Must be last. use Inline::Java::JVM; # Our default J2SK require Inline::Java->find_default_j2sdk(); # This is set when the script is over. my $DONE = 0; # This is set when at least one JVM is loaded. my $JVM = undef; # This list will store the $o objects... my @INLINES = (); my $report_version = "V2"; # This stuff is to control the termination of the Java Interpreter sub done { my $signal = shift; # To preserve the passed exit code... my $ec = $?; $DONE = 1; if (! $signal){ Inline::Java::debug(1, "killed by natural death."); } else{ Inline::Java::debug(1, "killed by signal SIG$signal."); } shutdown_JVM(); Inline::Java::debug(1, "exiting with $ec"); CORE::exit($ec); exit($ec); } END { if ($DONE < 1){ done(); } } # To export the cast function and others. sub import { my $class = shift; foreach my $a (@_){ if ($a eq 'jar'){ print Inline::Java::Portable::get_server_jar(); exit(); } elsif ($a eq 'j2sdk'){ print Inline::Java->find_default_j2sdk() . " says '" . Inline::Java::get_default_j2sdk() . "'\n"; exit(); } elsif ($a eq 'so_dirs'){ print Inline::Java::Portable::portable('SO_LIB_PATH_VAR') . "=" . join(Inline::Java::Portable::portable('ENV_VAR_PATH_SEP'), Inline::Java::get_default_j2sdk_so_dirs()); exit(); } } $class->export_to_level(1, $class, @_); } ######################## Inline interface ######################## # Register this module as an Inline language support module sub register { return { language => 'Java', aliases => ['JAVA', 'java'], type => 'interpreted', suffix => 'jdat', }; } # Here validate is overridden because some of the config options are needed # at load as well. sub validate { my $o = shift; # This might not print since debug is set further down... Inline::Java::debug(1, "Starting validate."); my $jdk = Inline::Java::get_default_j2sdk(); my $dbg = $Inline::Java::DEBUG; my %opts = @_; $o->set_option('DEBUG', $dbg, 'i', 1, \%opts); $o->set_option('J2SDK', $jdk, 's', 1, \%opts); $o->set_option('CLASSPATH', '', 's', 1, \%opts); $o->set_option('BIND', 'localhost', 's', 1, \%opts); $o->set_option('HOST', 'localhost', 's', 1, \%opts); $o->set_option('PORT', -1, 'i', 1, \%opts); $o->set_option('STARTUP_DELAY', 15, 'i', 1, \%opts); $o->set_option('SHARED_JVM', 0, 'b', 1, \%opts); $o->set_option('START_JVM', 1, 'b', 1, \%opts); $o->set_option('JNI', 0, 'b', 1, \%opts); $o->set_option('EMBEDDED_JNI', 0, 'b', 1, \%opts); $o->set_option('NATIVE_DOUBLES', 0, 'b', 1, \%opts); $o->set_option('WARN_METHOD_SELECT', 0, 'b', 1, \%opts); $o->set_option('STUDY', undef, 'a', 0, \%opts); $o->set_option('AUTOSTUDY', 0, 'b', 1, \%opts); $o->set_option('EXTRA_JAVA_ARGS', '', 's', 1, \%opts); $o->set_option('EXTRA_JAVAC_ARGS', '', 's', 1, \%opts); $o->set_option('DEBUGGER', 0, 'b', 1, \%opts); $o->set_option('PRIVATE', '', 'b', 1, \%opts); $o->set_option('PACKAGE', '', 's', 1, \%opts); my @left_overs = keys(%opts); if (scalar(@left_overs)){ croak "'$left_overs[0]' is not a valid configuration option for Inline::Java"; } # Now for the post processing $Inline::Java::DEBUG = $o->get_java_config('DEBUG'); # Embedded JNI turns on regular JNI if ($o->get_java_config('EMBEDDED_JNI')){ $o->set_java_config('JNI', 1); } if ($o->get_java_config('PORT') == -1){ if ($o->get_java_config('SHARED_JVM')){ $o->set_java_config('PORT', 7891); } else{ $o->set_java_config('PORT', -7890); } } if (($o->get_java_config('JNI'))&&($o->get_java_config('SHARED_JVM'))){ croak("You can't use the 'SHARED_JVM' option in 'JNI' mode"); } if (($o->get_java_config('JNI'))&&($o->get_java_config('DEBUGGER'))){ croak("You can't invoke the Java debugger ('DEBUGGER' option) in 'JNI' mode"); } if ((! $o->get_java_config('SHARED_JVM'))&&(! $o->get_java_config('START_JVM'))){ croak("Disabling the 'START_JVM' option only makes sense in 'SHARED_JVM' mode"); } if ($o->get_java_config('JNI')){ require Inline::Java::JNI; } if ($o->get_java_config('DEBUGGER')){ # Here we want to tweak a few settings to help debugging... Inline::Java::debug(1, "Debugger mode activated"); # Add the -g compile option $o->set_java_config('EXTRA_JAVAC_ARGS', $o->get_java_config('EXTRA_JAVAC_ARGS') . " -g "); # Add the -sourcepath runtime option $o->set_java_config('EXTRA_JAVA_ARGS', $o->get_java_config('EXTRA_JAVA_ARGS') . " -sourcepath " . $o->get_api('build_dir') . Inline::Java::Portable::portable("ENV_VAR_PATH_SEP_CP") . Inline::Java::Portable::get_source_dir() ); } my $study = $o->get_java_config('STUDY'); if ((defined($study))&&(ref($study) ne 'ARRAY')){ croak "Configuration option 'STUDY' must be an array of Java class names"; } Inline::Java::debug(1, "validate done."); } sub set_option { my $o = shift; my $name = shift; my $default = shift; my $type = shift; my $env_or = shift; my $opts = shift; my $desc = shift; if (! exists($o->{ILSM}->{$name})){ my $val = undef; if (($env_or)&&(exists($ENV{"PERL_INLINE_JAVA_$name"}))){ $val = $ENV{"PERL_INLINE_JAVA_$name"}; } elsif (exists($opts->{$name})){ $val = $opts->{$name}; } else{ $val = $default; } if ($type eq 'b'){ if (! defined($val)){ $val = 0; } $val = ($val ? 1 : 0); } elsif ($type eq 'i'){ if ((! defined($val))||($val !~ /\d/)){ $val = 0; } $val = int($val); } $o->set_java_config($name, $val); } delete $opts->{$name}; } sub get_java_config { my $o = shift; my $param = shift; return $o->{ILSM}->{$param}; } sub set_java_config { my $o = shift; my $param = shift; my $value = shift; return $o->{ILSM}->{$param} = $value; } # In theory we shouldn't need to use this, but it seems # it's not all accessible by the API yet. sub get_config { my $o = shift; my $param = shift; return $o->{CONFIG}->{$param}; } sub get_api { my $o = shift; my $param = shift; # Allows us to force a specific package... if (($param eq 'pkg')&&($o->get_config('PACKAGE'))){ return $o->get_config('PACKAGE'); } return $o->{API}->{$param}; } # Parse and compile Java code sub build { my $o = shift; if ($o->get_java_config('built')){ return; } Inline::Java::debug(1, "Starting build."); # Grab and untaint the current directory my $cwd = Cwd::cwd(); if ($o->get_config('UNTAINT')){ ($cwd) = $cwd =~ /(.*)/; } # We must grab this before we change to the build dir because # it could be relative... my $server_jar = Inline::Java::Portable::get_server_jar(); # We need to add all the previous install dirs to the classpath because # they can access each other. my @prev_install_dirs = (); foreach my $in (@INLINES){ push @prev_install_dirs, File::Spec->catdir($in->get_api('install_lib'), 'auto', $in->get_api('modpname')); } my $cp = $ENV{CLASSPATH} || ''; $ENV{CLASSPATH} = Inline::Java::Portable::make_classpath($server_jar, @prev_install_dirs, $o->get_java_config('CLASSPATH')); Inline::Java::debug(2, "classpath: $ENV{CLASSPATH}"); # Create the build dir and go there my $build_dir = $o->get_api('build_dir'); $o->mkpath($build_dir); chdir $build_dir; my $code = $o->get_api('code'); my $pcode = $code; my $study_only = ($code =~ /^(STUDY|SERVER)$/); my $source = ($study_only ? '' : $o->get_api('modfname') . ".java"); # Parse code to check for public class $pcode =~ s/\\\"//g; $pcode =~ s/\"(.*?)\"//g; $pcode =~ s/\/\*(.*?)\*\///gs; $pcode =~ s/\/\/(.*)$//gm; if ($pcode =~ /public\s+(abstract\s+)?class\s+(\w+)/){ $source = "$2.java"; } my $install_dir = File::Spec->catdir($o->get_api('install_lib'), 'auto', $o->get_api('modpname')); $o->mkpath($install_dir); if ($source){ # Dump the source code... open(Inline::Java::JAVA, ">$source") or croak "Can't open $source: $!"; print Inline::Java::JAVA $code; close(Inline::Java::JAVA); # ... and compile it. my $javac = File::Spec->catfile($o->get_java_config('J2SDK'), Inline::Java::Portable::portable("J2SDK_BIN"), "javac" . Inline::Java::Portable::portable("EXE_EXTENSION")); my $redir = Inline::Java::Portable::portable("IO_REDIR"); my $args = "-deprecation " . $o->get_java_config('EXTRA_JAVAC_ARGS'); my $pinstall_dir = Inline::Java::Portable::portable("SUB_FIX_JAVA_PATH", $install_dir); my $cmd = Inline::Java::Portable::portable("SUB_FIX_CMD_QUOTES", "\"$javac\" $args -d \"$pinstall_dir\" $source > cmd.out $redir"); if ($o->get_config('UNTAINT')){ ($cmd) = $cmd =~ /(.*)/; } Inline::Java::debug(2, "$cmd"); my $res = system($cmd); my $msg = $o->get_compile_error_msg(); if ($res){ croak $o->compile_error_msg($cmd, $msg); }; if ($msg){ warn("\n$msg\n"); } # When we run the commands, we quote them because in WIN32 you need it if # the programs are in directories which contain spaces. Unfortunately, in # WIN9x, when you quote a command, it masks it's exit value, and 0 is always # returned. Therefore a command failure is not detected. # We need to take care of checking whether there are actually files # to be copied, and if not will exit the script. if (Inline::Java::Portable::portable('COMMAND_COM')){ my @fl = Inline::Java::Portable::find_classes_in_dir($install_dir); if (! scalar(@fl)){ croak "No class files produced. Previous command failed under command.com?"; } foreach my $f (@fl){ if (! (-s $f->{file})){ croak "File $f->{file} has size zero. Previous command failed under command.com?"; } } } } $ENV{CLASSPATH} = $cp; Inline::Java::debug(2, "classpath: $ENV{CLASSPATH}"); # Touch the .jdat file. my $jdat = File::Spec->catfile($install_dir, $o->get_api('modfname') . '.' . $o->get_api('suffix')); if (! open(Inline::Java::TOUCH, ">$jdat")){ croak "Can't create file $jdat"; } close(Inline::Java::TOUCH); # Go back and clean up chdir $cwd; if (($o->get_api('cleanup'))&&(! $o->get_java_config('DEBUGGER'))){ $o->rmpath('', $build_dir); } $o->set_java_config('built', 1); Inline::Java::debug(1, "build done."); } sub get_compile_error_msg { my $o = shift; my $msg = ''; if (open(Inline::Java::CMD, "); close(Inline::Java::CMD); } return $msg; } sub compile_error_msg { my $o = shift; my $cmd = shift; my $error = shift; my $build_dir = $o->get_api('build_dir'); my $lang = $o->get_api('language'); return <get_java_config('loaded')){ return; } Inline::Java::debug(1, "Starting load."); my $install_dir = File::Spec->catdir($o->get_api('install_lib'), 'auto', $o->get_api('modpname')); # If the JVM is not running, we need to start it here. my $cp = $ENV{CLASSPATH} || ''; if (! $JVM){ $ENV{CLASSPATH} = Inline::Java::Portable::make_classpath( Inline::Java::Portable::get_server_jar()); Inline::Java::debug(2, "classpath: $ENV{CLASSPATH}"); $JVM = new Inline::Java::JVM($o); $ENV{CLASSPATH} = $cp; Inline::Java::debug(2, "classpath: $ENV{CLASSPATH}"); my $pc = new Inline::Java::Protocol(undef, $o); $pc->AddClassPath(Inline::Java::Portable::portable("SUB_FIX_JAVA_PATH", Inline::Java::Portable::get_user_jar())); my $st = $pc->ServerType(); if ((($st eq "shared")&&(! $o->get_java_config('SHARED_JVM')))|| (($st eq "private")&&($o->get_java_config('SHARED_JVM')))){ croak "JVM type mismatch on port " . $JVM->{port}; } } $ENV{CLASSPATH} = ''; my @cp = Inline::Java::Portable::make_classpath($install_dir, $o->get_java_config('CLASSPATH')); $ENV{CLASSPATH} = $cp; my $pc = new Inline::Java::Protocol(undef, $o); $pc->AddClassPath(@cp); # Add our Inline object to the list. push @INLINES, $o; $o->set_java_config('id', scalar(@INLINES) - 1); Inline::Java::debug(3, "Inline::Java object id is " . $o->get_java_config('id')); $o->study_module(); if ((defined($o->get_java_config('STUDY')))&&(scalar($o->get_java_config('STUDY')))){ $o->_study($o->get_java_config('STUDY')); } $o->set_java_config('loaded', 1); Inline::Java::debug(1, "load done."); } # This function 'studies' the classes generated by the inlined code. sub study_module { my $o = shift; my $install_dir = File::Spec->catdir($o->get_api('install_lib'), 'auto', $o->get_api('modpname')); my $cache = $o->get_api('modfname') . '.' . $o->get_api('suffix'); my $lines = []; if (! $o->get_java_config('built')){ # Since we didn't build the module, this means that # it was up to date. We can therefore use the data # from the cache. Inline::Java::debug(1, "using jdat cache"); my $p = File::Spec->catfile($install_dir, $cache); my $size = (-s $p) || 0; if ($size > 0){ if (open(Inline::Java::CACHE, "<$p")){ while (){ push @{$lines}, $_; } close(Inline::Java::CACHE); } else{ croak "Can't open $p for reading: $!"; } } } else{ # First thing to do is get the list of classes that comprise the module. # We need the classes that are in the directory or under... my @classes = (); my $cwd = Cwd::cwd(); if ($o->get_config('UNTAINT')){ ($cwd) = $cwd =~ /(.*)/; } # We chdir to the install dir, that makes it easier to figure out # the packages for the classes. chdir($install_dir); my @fl = Inline::Java::Portable::find_classes_in_dir('.'); chdir $cwd; foreach my $f (@fl){ push @classes, $f->{class}; } # Now we ask Java the info about those classes... $lines = $o->report(@classes); # and we update the cache with these results. Inline::Java::debug(1, "updating jdat cache"); my $p = File::Spec->catfile($install_dir, $cache); if (open(Inline::Java::CACHE, ">$p")){ foreach my $l (@{$lines}){ print Inline::Java::CACHE "$l\n"; } close(Inline::Java::CACHE); } else{ croak "Can't open $p file for writing"; } } # Now we read up the symbols and bind them to Perl. $o->bind_jdat($o->load_jdat($lines)); } # This function 'studies' the specified classes and binds them to # Perl. sub _study { my $o = shift; my $classes = shift; my @new_classes = (); foreach my $class (@{$classes}){ $class = Inline::Java::Class::ValidateClass($class); if (! Inline::Java::known_to_perl($o->get_api('pkg'), $class)){ push @new_classes, $class; } } if (! scalar(@new_classes)){ return; } my $lines = $o->report(@new_classes); # Now we read up the symbols and bind them to Perl. $o->bind_jdat($o->load_jdat($lines)); } sub report { my $o = shift; my @classes = @_; my @lines = (); if (scalar(@classes)){ my $pc = new Inline::Java::Protocol(undef, $o); my $resp = $pc->Report(join(" ", @classes)); @lines = split("\n", $resp); } return \@lines; } # Load the jdat code information file. sub load_jdat { my $o = shift; my $lines = shift; Inline::Java::debug_obj($lines); # We need an array here since the same object can have many # study sessions. if (! defined($o->{ILSM}->{data})){ $o->{ILSM}->{data} = []; } my $d = {}; my $data_idx = scalar(@{$o->{ILSM}->{data}}); push @{$o->{ILSM}->{data}}, $d; # The original regexp didn't match anymore under the debugger... # Very strange indeed... # my $re = '[\w.\$\[;]+'; my $re = '.+'; my $idx = 0; my $current_class = undef; if (scalar(@{$lines})){ my $vline = shift @{$lines}; chomp($vline); if ($vline ne $report_version){ croak("Report version mismatch ($vline != $report_version). Delete your '_Inline' and try again."); } } foreach my $line (@{$lines}){ chomp($line); if ($line =~ /^class ($re) ($re)$/){ # We found a class definition my $java_class = $1; my $parent_java_class = $2; $current_class = Inline::Java::java2perl($o->get_api('pkg'), $java_class); $d->{classes}->{$current_class} = {}; $d->{classes}->{$current_class}->{java_class} = $java_class; if ($parent_java_class ne "null"){ $d->{classes}->{$current_class}->{parent_java_class} = $parent_java_class; } $d->{classes}->{$current_class}->{constructors} = {}; $d->{classes}->{$current_class}->{methods} = {}; $d->{classes}->{$current_class}->{fields} = {}; } elsif ($line =~ /^constructor \((.*)\)$/){ my $signature = $1; $d->{classes}->{$current_class}->{constructors}->{$signature} = { SIGNATURE => [split(", ", $signature)], STATIC => 1, IDX => $idx, }; } elsif ($line =~ /^method (\w+) ($re) (\w+)\((.*)\)$/){ my $static = $1; my $declared_in = $2; my $method = $3; my $signature = $4; if (! defined($d->{classes}->{$current_class}->{methods}->{$method})){ $d->{classes}->{$current_class}->{methods}->{$method} = {}; } $d->{classes}->{$current_class}->{methods}->{$method}->{$signature} = { SIGNATURE => [split(", ", $signature)], STATIC => ($static eq "static" ? 1 : 0), IDX => $idx, }; } elsif ($line =~ /^field (\w+) ($re) (\w+) ($re)$/){ my $static = $1; my $declared_in = $2; my $field = $3; my $type = $4; if (! defined($d->{classes}->{$current_class}->{fields}->{$field})){ $d->{classes}->{$current_class}->{fields}->{$field} = {}; } $d->{classes}->{$current_class}->{fields}->{$field}->{$type} = { TYPE => $type, STATIC => ($static eq "static" ? 1 : 0), IDX => $idx, }; } $idx++; } Inline::Java::debug_obj($d); return ($d, $data_idx); } # Binds the classes and the methods to Perl sub bind_jdat { my $o = shift; my $d = shift; my $idx = shift; if (! defined($d->{classes})){ return; } my $inline_idx = $o->get_java_config('id'); my %classes = %{$d->{classes}}; foreach my $class (sort keys %classes) { my $class_name = $class; $class_name =~ s/^(.*):://; my $java_class = $d->{classes}->{$class}->{java_class}; # This parent stuff is needed for PerlNatives (so that you can call PerlNatives methods # from Perl...) my $parent_java_class = $d->{classes}->{$class}->{parent_java_class}; my $parent_module = ''; my $parent_module_declare = ''; if (defined($parent_java_class)){ $parent_module = java2perl($o->get_api('pkg'), $parent_java_class); $parent_module_declare = "\$$parent_module" . "::EXISTS_AS_PARENT = 1;"; $parent_module .= ' '; } if (Inline::Java::known_to_perl($o->get_api('pkg'), $java_class)){ next; } my $colon = ":"; my $dash = "-"; my $ijo = 'Inline::Java::Object'; my $code = <__new( \$JAVA_CLASS, \$INLINE, 0); use Carp; CODE while (my ($field, $types) = each %{$d->{classes}->{$class}->{fields}}){ while (my ($type, $sign) = each %{$types}){ if ($sign->{STATIC}){ $code .= <{classes}->{$class}->{constructors}})){ $code .= <{ILSM}->{data}->[$idx]; my \$signatures = \$d->{classes}->{'$class'}->{constructors}; my (\$proto, \$new_args, \$static) = \$class->__validate_prototype('new', [\@args], \$signatures, \$o); my \$ret = undef; eval { \$ret = \$class->__new(\$JAVA_CLASS, \$o, -1, \$proto, \$new_args); }; croak \$@ if \$@; return \$ret; } sub $class_name { return new(\@_); } CODE } while (my ($method, $sign) = each %{$d->{classes}->{$class}->{methods}}){ $code .= $o->bind_method($idx, $class, $method); } Inline::Java::debug_obj(\$code); # open (Inline::Java::CODE, ">>code") and print CODE $code and close(CODE); # Here it seems that for the eval below to resolve the @INLINES # list properly, it must be used in this function... my $dummy = scalar(@INLINES); eval $code; croak $@ if $@; } } sub bind_method { my $o = shift; my $idx = shift; my $class = shift; my $method = shift; my $static = shift; my $code = <{ILSM}->{data}->[$idx]; my \$signatures = \$d->{classes}->{'$class'}->{methods}->{'$method'}; my (\$proto, \$new_args, \$static) = \$this->__validate_prototype('$method', [\@args], \$signatures, \$o); if ((\$static)&&(! ref(\$this))){ \$this = \$DUMMY_OBJECT; } my \$ret = undef; eval { \$ret = \$this->__get_private()->{proto}->CallJavaMethod('$method', \$proto, \$new_args); }; croak \$@ if \$@; return \$ret; } CODE return $code; } sub get_fields { my $o = shift; my $class = shift; my $fields = {}; my $data_list = $o->{ILSM}->{data}; foreach my $d (@{$data_list}){ if (exists($d->{classes}->{$class})){ while (my ($field, $value) = each %{$d->{classes}->{$class}->{fields}}){ # Here $value is a hash that contains all the different # types available for the field $field $fields->{$field} = $value; } } } return $fields; } # Return a small report about the Java code. sub info { my $o = shift; if (! (($o->{INLINE}->{object_ready})||($o->get_java_config('built')))){ $o->build(); } if (! $o->get_java_config('loaded')){ $o->load(); } my $info = ''; my $data_list = $o->{ILSM}->{data}; foreach my $d (@{$data_list}){ if (! defined($d->{classes})){ next; } my %classes = %{$d->{classes}}; $info .= "The following Java classes have been bound to Perl:\n"; foreach my $class (sort keys %classes) { $info .= "\n class $class:\n"; $info .= " public methods:\n"; while (my ($k, $v) = each %{$d->{classes}->{$class}->{constructors}}){ my $name = $class; $name =~ s/^(.*):://; $info .= " $name($k)\n"; } while (my ($k, $v) = each %{$d->{classes}->{$class}->{methods}}){ while (my ($k2, $v2) = each %{$d->{classes}->{$class}->{methods}->{$k}}){ my $static = ($v2->{STATIC} ? "static " : ""); $info .= " $static$k($k2)\n"; } } $info .= " public member variables:\n"; while (my ($k, $v) = each %{$d->{classes}->{$class}->{fields}}){ while (my ($k2, $v2) = each %{$d->{classes}->{$class}->{fields}->{$k}}){ my $static = ($v2->{STATIC} ? "static " : ""); my $type = $v2->{TYPE}; $info .= " $static$type $k\n"; } } } } return $info; } ######################## General Functions ######################## sub __get_JVM { return $JVM; } # For testing purposes only... sub __clear_JVM { $JVM = undef; } sub shutdown_JVM { if ($JVM){ $JVM->shutdown(); $JVM = undef; } } sub reconnect_JVM { if ($JVM){ $JVM->reconnect(); } } sub capture_JVM { if ($JVM){ $JVM->capture(); } } sub i_am_JVM_owner { if ($JVM){ return $JVM->am_owner(); } } sub release_JVM { if ($JVM){ $JVM->release(); } } sub get_DEBUG { return $Inline::Java::DEBUG; } sub get_DONE { return $DONE; } sub set_DONE { $DONE = 1; } sub __get_INLINES { return \@INLINES; } sub java2perl { my $pkg = shift; my $jclass = shift; $jclass =~ s/[.\$]/::/g; if ((defined($pkg))&&($pkg)){ $jclass = $pkg . "::" . $jclass; } return $jclass; } sub known_to_perl { my $pkg = shift; my $jclass = shift; my $perl_class = java2perl($pkg, $jclass); no strict 'refs'; if (defined(${$perl_class . "::" . "EXISTS"})){ Inline::Java::debug(3, "perl knows about '$jclass' ('$perl_class')"); return 1; } else{ Inline::Java::debug(3, "perl doesn't know about '$jclass' ('$perl_class')"); } return 0; } sub debug { my $level = shift; if (($Inline::Java::DEBUG)&&($Inline::Java::DEBUG >= $level)){ my $x = " " x $level; my $str = join("\n$x", @_); while (chomp($str)) {} print DEBUG_STREAM sprintf("[perl][%s]$x%s\n", $level, $str); } } sub debug_obj { my $obj = shift; my $force = shift || 0; if (($Inline::Java::DEBUG >= 5)||($force)){ debug(5, "Dump:\n" . Dumper($obj)); if (UNIVERSAL::isa($obj, "Inline::Java::Object")){ # Print the guts as well... debug(5, "Private Dump:" . Dumper($obj->__get_private())); } } } sub dump_obj { my $obj = shift; return debug_obj($obj, 1); } ######################## Public Functions ######################## # If we are dealing with a Java object, we simply ask for a new "reference" # with the requested class. sub cast { my $type = shift; my $val = shift; if (! UNIVERSAL::isa($val, "Inline::Java::Object")){ croak("Type casting can only be used on Java objects. Use 'coerce' instead."); } return $val->__cast($type); } # coerce is used to force a specific prototype to be used. sub coerce { my $type = shift; my $val = shift; my $array_type = shift; if (UNIVERSAL::isa($val, "Inline::Java::Object")){ croak("Type coercing can't be used on Java objects. Use 'cast' instead."); } my $o = undef; eval { $o = new Inline::Java::Class::Coerce($type, $val, $array_type); }; croak $@ if $@; return $o; } sub study_classes { my $classes = shift; my $package = shift || caller(); my $o = undef; my %pkgs = (); foreach (@INLINES){ my $i = $_; my $pkg = $i->get_api('pkg') || 'main'; $pkgs{$pkg} = 1; if ($pkg eq $package){ $o = $i; last; } } if (defined($o)){ $o->_study($classes); } else { my $msg = "Can't place studied classes under package '$package' since Inline::Java was not used there. Valid packages are:\n"; foreach my $pkg (keys %pkgs){ $msg .= " $pkg\n"; } croak($msg); } } sub caught { my $class = shift; my $e = $@; $class = Inline::Java::Class::ValidateClass($class); my $ret = 0; if (($e)&&(UNIVERSAL::isa($e, "Inline::Java::Object"))){ my ($msg, $score) = $e->__isa($class); if ($msg){ $ret = 0; } else{ $ret = 1; } } $@ = $e; return $ret; } sub find_default_j2sdk { my $class = shift; return File::Spec->catfile('Inline', 'Java', 'default_j2sdk.pl'); } 1; Inline-Java-0.58~dfsg/README.JNI0000644000000000000000000001532712436307565014625 0ustar rootrootJNI (JAVA NATIVE INTERFACE) EXTENSION ------------------------------------- Inline::Java now provides a JNI extension that allows you to load the Java virtual machine as shared object instead of running it as a separate process. PLATFORM AVAILABILITY --------------------- The JNI extension is available on all supported platforms. The extension builds properly on all platform, but problems can occur when running it or tweaking maybe necessary on certain platforms. All help is welcome if anyone out there is a JNI expert. The reason why JNI is a bit complex under Linux/Solaris is because of threads. The Java Virtual Machine (libjvm.so) shared object uses native threads when embedded inside another program and that host program (in this case Perl) must link with the same threads library for everything to work properly. Starting with Perl 5.8, this works fine. With previous versions, you may get around rebuilding Perl by setting LD_PRELOAD. The only problems encountered where that when setting LD_PRELOAD before running the test suite, the LD_PRELOAD affects make as well and on Solaris some crashes were seen. Read more on this in the Solaris section below. Note: Make sure the directories listed at the end of the installation procedure are included in your LD_LIBRARY_PATH (PATH on Win32) environment variable. This JNI extension will not load properly the the Java shared objects cannot be located at runtime. OVERVIEW -------- +----------+------------+------------+ | JDK1.3.1 | J2SDK1.4.2 | J2SDK1.5.0 | +-------------+----------+------------+------------+ | Win32 | ok | ok | ok | +-------------+----------+------------+------------+ | cygwin | ok* | ok* | ok* | +-------------+----------+------------+------------+ | Linux RH7.3 | ok* | ok* | ? | +-------------+----------+------------+------------+ | Linux RH9.0 | ok* | ok* | ok | +-------------+----------+------------+------------+ | Soloris 2.8 | ok* | ? | ? | +-------------+----------+------------+------------+ * : Read below WIN32 ----- Java 2 SDK 1.3.1: The JNI extension runs without problems. Java 2 SDK 1.4.2: The JNI extension runs without problems. LINUX ----- Java 2 SDK 1.3.1: The JNI extension runs without problems with this Java 2 SDK, provided that you use Perl >= 5.8.0 or do one of the following: 1- Rebuild perl and add the libpthread library in front of all other libraries (see the 'BUILDING PERL' section below). You should also use your system's malloc (not perl's). This is the recommended solution. 2- Add the proper version of libpthread.so to your LD_PRELOAD environment variable. On my test system this was /lib/i686/libpthread.so.0. This solution seems viable but thread related crashes/hang-ups have been reported on some systems. If make crashes while running the test suite, try running it like this: % for i in `ls t/*.t` ; do perl -Mblib $i; done Also, make sure you use do not use 'classic' VM. This one should only be used with 'green threads', which don't seem to work with JNI. Use either the 'client' or the 'server' VMs. Java 2 SDK 1.4.2: The same as Java 2 SDK 1.3.1 applies. SOLARIS ------- Java 2 SDK 1.3.1: The JNI extension runs without problems with this Java 2 SDK, provided that you use Perl >= 5.8.0 or do one of the following: 1- Rebuild perl and add the libthread library in front of all other libraries (see the 'BUILDING PERL' section below). You should also use gcc and your system's malloc (not perl's). This is the recommended solution. 2- Add the proper version of libthread.so to your LD_PRELOAD environment variable. On my test system this was /lib/libthread.so. This solution seems viable but thread related crashes/hang-ups have been reported on some systems. If make crashes while running the test suite, try running it like this: % for i in `ls t/*.t` ; do perl -Mblib $i; done CYGWIN ------ Java 2 SDK 1.3.1: The JNI extension runs without problems. PerlInterpreter: Compiles but stand-alone (non-JNI initiated) Java interpreter locks up when attempting to load the DLL. This is a known issue with initialization of the cygwin1.dll from a non-cygwin DLL or EXE, which has been "broken" since at least Cygwin 1.5.13. A possible work around might be to build the PerlInterpreter against a native Win32 Perl distribution with '-mno-cygwin' GCC compile flag, although this means you would be using native Perl instead of Cygwin Perl when using PerlInterpreter. Java 2 SDK 1.4.2: The JNI extension runs without problems. PerlInterpreter: The same as Java 2 SDK 1.3.1 applies. PerlNatives: Compiles and runs fine in a JNI-initiated interpreter, but stand-alone (non-JNI initiated) Java interpreter locks up when attempting to load the DLL. This is a known issue with initialization of the cygwin1.dll from a non-cygwin DLL or EXE, which has been "broken" since at least Cygwin 1.5.13. Java 2 SDK 1.5.0: The same as Java 2 SDK 1.4.2 applies. BUILDING PERL ------------- Here's how to rebuild Perl (version < 5.8.0) to get the JNI extension to work properly: - Use all the defaults or whatever makes sense, but no threaded Perl and no interpreter threads, i.e.: Build a threading Perl? [n] n Build Perl for multiplicity? [n] n - When asked what libraries to use, type -lthread (Solaris) or -lpthread (Linux) and tack on whatever the default is at the end, i.e.: What libraries to use? -> [-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil] -lpthread -lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil (under Linux it's -lpthread, but for Solaris it's -lthread) - Make sure that you do not use perl's own malloc, i.e.: Do you wish to attempt to use the malloc that comes with perl5? -> [n] n RUNNING Inline::Java WITH THE JNI EXTENSION ------------------------------------------- To run Inline::Java with the JNI extension, do one of the following: - set the JNI configuration option to 1 - set the PERL_INLINE_JAVA_JNI environment variable to 1 To run the test suite (make test) with the JNI extension you must use the PERL_INLINE_JAVA_JNI environment variable USING THE 'SHARED_JVM' MODE --------------------------- Inline::Java 0.30 introduced a 'SHARED_JVM' mode that allows many clients to connect to the same Inline::Java Java server. The 'SHARED_JVM' mode is meant to be used with forking processes such as Apache with mod_perl. The 'SHARED_JVM' mode does NOT work along with the JNI mode. In fact the author was not able to successfully fork the Java Virtual Machine under any circumstances. Inline-Java-0.58~dfsg/bug/0000755000000000000000000000000012655115054014064 5ustar rootrootInline-Java-0.58~dfsg/bug/sg.pl0000644000000000000000000000032712436307565015043 0ustar rootrootuse Inline Java => 'bug/Foo.java' ; eval{ Foo->new->test_a(); Foo->new->test_b(); } ; if (Inline::Java::caught("javax.xml.parsers.FactoryConfigurationError")){ my $msg = $@->getMessage() ; die($msg) ; } Inline-Java-0.58~dfsg/bug/PKG2.pm0000644000000000000000000000021712436307565015134 0ustar rootrootpackage PKG2; use strict; use warnings; use PKG1 ; sub callpkg1 { print "allo1\n" ; print PKG1::PKG1->hello() ; print "allo2\n" ; } 1 ; Inline-Java-0.58~dfsg/bug/inline3.pl0000644000000000000000000000017312436307565015772 0ustar rootroot#!/usr/bin/perl -w use strict; use warnings; use Hi3; my $Higher1 = Hi3->new(5,10); print $Higher1->printValues(), "\n"; Inline-Java-0.58~dfsg/bug/Employee.pm0000644000000000000000000000152612436307565016214 0ustar rootrootpackage Employee; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(); use Person; @ISA = ("Person"); sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = $class->SUPER::new(); $self->{SALARY} = undef; $self->{ID} = undef; $self->{START_DATE} = undef; bless ($self, $class); # reconsecrate return $self; } sub salary { my $self = shift; if (@_) { $self->{SALARY} = shift } return $self->{SALARY}; } sub id_number { my $self = shift; if (@_) { $self->{ID} = shift } return $self->{ID}; } sub start_date { my $self = shift; if (@_) { $self->{START_DATE} = shift } return $self->{START_DATE}; } 1;Inline-Java-0.58~dfsg/bug/p3.pl0000755000000000000000000001015512436307565014757 0ustar rootrootuse blib ; use vars qw($JARS); BEGIN { $JARS = '/home/patrickl/perl/dev/Inline-Java/bug/piccolo-1.0/build' ; } use Inline Java => Config => CLASSPATH => "$JARS/piccolo.jar:$JARS/piccolox.jar:$JARS/examples.jar"; use Inline::Java qw(study_classes) ; study_classes(['java.awt.Color', 'edu.umd.cs.piccolo.nodes.PPath', 'edu.umd.cs.piccolo.nodes.PText', 'edu.umd.cs.piccolo.PCanvas', 'edu.umd.cs.piccolo.PLayer', 'java.awt.BasicStroke', ]); use Inline Java => 'DATA'; use Getopt::Long; my %OPTIONS; my $rc = GetOptions(\%OPTIONS, 'input=s', 'help', ); my $USAGE = <<"EOU"; usage: $0 [required params] [options] require params: --input=file : gaps file to process options: --help : this message EOU die "Bad option\n$USAGE" unless $rc; die "$USAGE" if exists $OPTIONS{help}; die "Must specify --input\n$USAGE" unless exists $OPTIONS{input}; # create the Java connection my $t = new Test(); # set up some useful constants my $UNIT = 10; my $STROKE = java::awt::BasicStroke->new($UNIT); # read in the file data open(IN,$OPTIONS{input}) or die "Couldn't open $OPTIONS{input} for reading"; while () { my ($ref_pos,$query_pos,$length) = m/^\s+(\d+)\s+(\d+)\s+(\d+)\s+/; push(@gaps,[$ref_pos,$query_pos,$length]); } my $max_ref = $gaps[-1]->[0] + $gaps[-1]->[2]; my $max_query = $gaps[-1]->[1] + $gaps[-1]->[2]; # get access to some picolo internal objects my $c = $t->getCanvas(); my $layer = $c->getLayer(); # create rectangles for the landmarks for (my $i=0;$i<$max_ref;$i+=10_000) { print "$i\n" ; my $r = edu::umd::cs::piccolo::nodes::PPath->createRectangle($i-$UNIT, $i-$UNIT, 2*$UNIT, 2*$UNIT); $r->setPaint($java::awt::Color::RED); $layer->addChild($r); # FIXME - this line causes the following error: # Method createPolyline for class edu.umd.cs.piccolo.nodes.PPath with signature ([F,[F) not found at (eval 10) line 1159 my $text = edu::umd::cs::piccolo::nodes::PText->new("$i"); $text->setOffset($i,$i); $layer->addChild($text); # FIXME - this line causes the following error: # Method createPolyline for class edu.umd.cs.piccolo.nodes.PPath with signature ([F,[F) not found at (eval 10) line 1159 # # unless you comment out the foreach loop for drawing lines my $text = $t->getText("$i"); $text->setOffset($i,$i); $layer->addChild($text); } my $tag = 0; my $i = 0 ; foreach my $gap (@gaps) { print "$i\n" ; $i++ ; my $l = edu::umd::cs::piccolo::nodes::PPath->createPolyline([$gap->[0],$gap->[0]+$gap->[2]], [$gap->[1],$gap->[1]+$gap->[2]], ); $l->setStroke($STROKE); if ($tag) { $l->setStrokePaint($java::awt::Color::BLUE); $tag = 0; } else { $l->setStrokePaint($java::awt::Color::GREEN); $tag = 1; } # FIXME - this line causes the following error: # Method createPolyline for class edu.umd.cs.piccolo.nodes.PPath with signature ([F,[F) not found at (eval 10) line 1159 $layer->addChild($l); # so instead I've created a bogus wrapper method to do the work # $t->addChild($l); } while (1) { sleep 5; } print "Finished\n"; __DATA__ __Java__ import java.awt.BasicStroke; import java.awt.Paint; // import java.awt.Color; // import java.awt.Graphics2D; // import edu.umd.cs.piccolo.activities.PActivity; // import edu.umd.cs.piccolo.util.PPaintContext; import edu.umd.cs.piccolo.PLayer; import edu.umd.cs.piccolo.PCanvas; import edu.umd.cs.piccolo.PNode; import edu.umd.cs.piccolox.PFrame; import edu.umd.cs.piccolo.nodes.PPath; import edu.umd.cs.piccolo.nodes.PText; class Test extends PFrame { public Test() { super(); } public void addChild(PNode aNode) { PLayer layer = getCanvas().getLayer(); layer.addChild(aNode); } public PText getText(String s) { return new PText(s); } public void initialize() { long currentTime = System.currentTimeMillis(); } } /* public class SemanticPath extends PPath { public void paint(PPaintContext aPaintContext) { double s = aPaintContext.getScale(); Graphics2D g2 = aPaintContext.getGraphics(); if (s < 1) { g2.setPaint(Color.blue); } else { g2.setPaint(Color.orange); } g2.fill(getBoundsReference()); } } */ Inline-Java-0.58~dfsg/bug/natives_hpux.txt0000644000000000000000000031702312436307565017357 0ustar rootroot ####### Individual t/12_2 test as asked by Mr. LeBoutillier ####### WITH JNI active # export PERL_INLINE_JAVA_JNI=1 # export PERL_INLINE_JAVA_DEBUG=4 # perl -Mblib t/12_2_perl_natives.t Using /opt/Inline-Java-0.45/blib Note: PerlNatives is still experimental and errors here can safely be ignored if you don't plan on using this feature. However, the author would appreciate if errors encountered here were reported to the mailing list (inline@perl.org) along with your hardware/OS detail. Thank you. [perl][1] validate done. [perl][1] Starting load. [perl][4] portable: ENV_VAR_PATH_SEP_CP for hpux is default ':' [perl][4] portable: SUB_FIX_CLASSPATH => /opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaServer.jar for hpux is default '/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaServer.jar' [perl][2] classpath: /opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaServer.jar [perl][1] starting JVM... [perl][1] JNI mode [perl][2] classpath: [perl][4] portable: SUB_FIX_CLASSPATH => /opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar for hpux is default '/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar' [perl][2] adding to classpath: '/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar' [perl][3] packet sent is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.98.108.105.98.47.108.105.98.47.73.110.108.105.110.101.47.74.97.118.97.47.73.110.108.105.110.101.74.97.118.97.85.115.101.114.46.106.97.114 [java][3] packet recv is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.98.108.105.98.47.108.105.98.47.73.110.108.105.110.101.47.74.97.118.97.47.73.110.108.105.110.101.74.97.118.97.85.115.101.114.46.106.97.114 [java][2] added file:/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar to classpath [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][3] getting server type [perl][3] packet sent is server_type [java][3] packet recv is server_type [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:112.114.105.118.97.116.101 [perl][3] packet recv is ok scalar:112.114.105.118.97.116.101 [perl][4] destroying Inline::Java::Protocol [perl][4] portable: ENV_VAR_PATH_SEP_CP for hpux is default ':' [perl][2] classpath candidate '' scraped [perl][4] portable: SUB_FIX_CLASSPATH => /opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54 for hpux is default '/opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54' [perl][2] adding to classpath: '/opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54' [perl][3] packet sent is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.95.73.110.108.105.110.101.95.116.101.115.116.47.108.105.98.47.97.117.116.111.47.95.49.50.95.50.95.112.101.114.108.95.110.97.116.105.118.101.115.95.116.95.57.101.53.52 [java][3] packet recv is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.95.73.110.108.105.110.101.95.116.101.115.116.47.108.105.98.47.97.117.116.111.47.95.49.50.95.50.95.112.101.114.108.95.110.97.116.105.118.101.115.95.116.95.57.101.53.52 [java][2] added file:/opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54/ to classpath [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][3] Inline::Java object id is 0 [perl][1] using jdat cache [perl][3] perl doesn't know about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] perl doesn't know about 't1212' ('main::t1212') [perl][2] creating object in java (main::t1212): [perl][1] load done. [perl][4] destroying Inline::Java::Protocol [perl][3] matching arguments to init() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(0).init() [perl][3] packet sent is call_method 0 t121 init () [java][3] packet recv is call_method 0 t121 init () [java][4] class t121 is reference [java][3] found a init method [java][3] () = ()? [java][3] has matching signature () [java][1] loading InlineJavaUserClassLink via InlineJavaUserClassLoader [java][2] loading shared library /opt/Inline-Java-0.45/blib/arch/auto/Inline/Java/Natives/Natives.sl [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: 1..5 [perl][3] matching arguments to init() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(0).init() [perl][3] packet sent is call_method 0 t121 init () [java][3] packet recv is call_method 0 t121 init () [java][4] class t121 is reference [java][3] method was cached [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][3] matching arguments to new() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] creating object new t121() [perl][3] packet sent is create_object t121 () [java][3] packet recv is create_object t121 () [java][4] class t121 is reference [java][3] found a t121 constructor [java][3] () = ()? [java][3] has matching signature () [java][3] registering natives for class t121 [java][3] registering native method array for class t121 [java][3] signature is ([I[Ljava/lang/String;)Ljava/lang/String; [java][3] format is LLL [java][3] registering native method types for class t121 [java][3] signature is (BSIJFDZCLjava/lang/String;)Ljava/lang/String; [java][3] format is LBSIJFDZCL [java][3] registering native method callback for class t121 [java][3] signature is ()Ljava/lang/String; [java][3] format is L [java][3] packet sent is ok object:0:1:t121 [perl][3] packet recv is ok object:0:1:t121 [perl][3] matching arguments to types_stub(byte, short, int, long, float, double, boolean, char, java.lang.String) [perl][4] min = -128, max = 127, val = 1 [perl][4] min = -32768, max = 32767, val = 2 [perl][4] min = -2147483648, max = 2147483647, val = 3 [perl][4] min = -2147483648, max = 2147483647, val = 4 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 5 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 6 [perl][3] match successful: score is 41 [perl][3] calling object(1).types_stub(1, 2, 3, 4, 5, 6, 1, 2, 1000) [perl][3] packet sent is call_method 1 t121 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][3] packet recv is call_method 1 t121 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][4] class t121 is reference [java][3] found a types_stub method [java][3] (byte,short,int,long,float,double,boolean,char,java.lang.String) = (byte,short,int,long,float,double,boolean,char,java.lang.String)? [java][3] has matching signature (byte,short,int,long,float,double,boolean,char,java.lang.String) [java][4] arg 0 of signature is byte [java][4] class byte is primitive numeric [java][4] args is scalar -> forcing to byte [java][4] result is 1 [java][4] arg 1 of signature is short [java][4] class short is primitive numeric [java][4] args is scalar -> forcing to short [java][4] result is 2 [java][4] arg 2 of signature is int [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 3 [java][4] arg 3 of signature is long [java][4] class long is primitive numeric [java][4] args is scalar -> forcing to long [java][4] result is 4 [java][4] arg 4 of signature is float [java][4] class float is primitive numeric [java][4] args is scalar -> forcing to float [java][4] result is 5.0 [java][4] arg 5 of signature is double [java][4] class double is primitive numeric [java][4] args is scalar -> forcing to double [java][4] result is 6.0 [java][4] arg 6 of signature is boolean [java][4] class boolean is primitive bool [java][4] args is scalar -> forcing to bool [java][4] result is true [java][4] arg 7 of signature is char [java][4] class char is primitive char [java][4] args is scalar -> forcing to char [java][4] result is 2 [java][4] arg 8 of signature is java.lang.String [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is 1000 [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t121@b162d5 [java][3] InvokePerlMethod argument 1 = 0 [java][3] InvokePerlMethod argument 2 = 0 [java][3] InvokePerlMethod argument 3 = 3 [java][3] InvokePerlMethod argument 4 = 4 [java][3] InvokePerlMethod argument 5 = 5.0 [java][3] InvokePerlMethod argument 6 = 6.0 [java][3] InvokePerlMethod argument 7 = false [java][3] InvokePerlMethod argument 8 = [java][3] InvokePerlMethod argument 9 = 1000 [java][3] exiting InvokePerlMethod [java][4] class java.lang.Byte is primitive numeric [java][4] class java.lang.Short is primitive numeric [java][4] class java.lang.Integer is primitive numeric [java][4] class java.lang.Long is primitive numeric [java][4] class java.lang.Float is primitive numeric [java][4] class java.lang.Double is primitive numeric [java][4] class java.lang.Boolean is primitive bool [java][4] class java.lang.Character is primitive char [java][4] class java.lang.String is primitive string [java][2] callback command: callback ::t121 types null object:0:2:t121 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [java][3] packet sent (callback) is callback ::t121 types null object:0:2:t121 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [perl][3] checking if stub is array... [perl][3] perl knows about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] returning stub... [perl][2] processing callback main::t121::types(t121=HASH(0x40681674), 0, 0, 3, 4, 5.0, 6.0, 0, , 1000) [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x408b6574) 2 (t121) [perl][3] packet sent is delete_object 2 [java][3] packet recv is delete_object 2 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [java][3] packet recv (callback) is callback false scalar:49.48.49.56 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:49.48.49.56 [perl][3] packet recv is ok scalar:49.48.49.56 not ok 1 # Test 1 got: '1018' (t/12_2_perl_natives.t at line 44) # Expected: '1024' [perl][3] matching arguments to array_stub([I, [Ljava.lang.String;) [perl][4] min = -2147483648, max = 2147483647, val = 34 [perl][4] min = -2147483648, max = 2147483647, val = 56 [perl][4] array is [2] [perl][4] array has 2 declared cells [perl][4] array should have 2 declared cells [perl][3] creating object new [I(34, 56) [perl][3] packet sent is create_object [I (2) scalar:51.52 scalar:53.54 [java][3] packet recv is create_object [I (2) scalar:51.52 scalar:53.54 [java][4] class [I is reference [java][4] class [I is array [java][4] array elements: int [java][4] array dimension: 2 [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 34 [java][4] setting array element 0 to 34 [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 56 [java][4] setting array element 1 to 56 [java][3] packet sent is ok object:0:3:[I [perl][3] packet recv is ok object:0:3:[I [perl][3] checking if [I is a [I [perl][3] packet sent is isa [I [I [java][3] packet recv is isa [I [I [java][4] checking if [I extends [I [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:48 [perl][3] packet recv is ok scalar:48 [perl][3] Inline::Java::Array=ARRAY(0x402b4c84) is a [I [perl][4] array is [2] [perl][4] array has 2 declared cells [perl][4] array should have 2 declared cells [perl][3] creating object new [Ljava.lang.String;(toto, 789) [perl][3] packet sent is create_object [Ljava.lang.String; (2) scalar:116.111.116.111 scalar:55.56.57 [java][3] packet recv is create_object [Ljava.lang.String; (2) scalar:116.111.116.111 scalar:55.56.57 [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is array [java][4] array elements: java.lang.String [java][4] array dimension: 2 [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is toto [java][4] setting array element 0 to toto [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is 789 [java][4] setting array element 1 to 789 [java][3] packet sent is ok object:0:4:[Ljava.lang.String; [perl][3] packet recv is ok object:0:4:[Ljava.lang.String; [perl][3] checking if [Ljava.lang.String; is a [Ljava.lang.String; [perl][3] packet sent is isa [Ljava.lang.String; [Ljava.lang.String; [java][3] packet recv is isa [Ljava.lang.String; [Ljava.lang.String; [java][4] checking if [Ljava.lang.String; extends [Ljava.lang.String; [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:48 [perl][3] packet recv is ok scalar:48 [perl][3] Inline::Java::Array=ARRAY(0x406fa728) is a [Ljava.lang.String; [perl][3] match successful: score is 15 [perl][3] calling object(1).array_stub(Inline::Java::Array=ARRAY(0x402b4c84), Inline::Java::Array=ARRAY(0x406fa728)) [perl][3] packet sent is call_method 1 t121 array_stub ([I,[Ljava.lang.String;) object:[I:3 object:[Ljava.lang.String;:4 [java][3] packet recv is call_method 1 t121 array_stub ([I,[Ljava.lang.String;) object:[I:3 object:[Ljava.lang.String;:4 [java][4] class t121 is reference [java][3] found a array_stub method [java][3] ([I,[Ljava.lang.String;) = ([I,[Ljava.lang.String;)? [java][3] has matching signature ([I,[Ljava.lang.String;) [java][4] arg 0 of signature is [I [java][4] class [I is reference [java][4] class [I is reference [java][4] checking if [I extends [I [java][4] [I is a kind of [I [java][4] arg 1 of signature is [Ljava.lang.String; [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is reference [java][4] checking if [Ljava.lang.String; extends [Ljava.lang.String; [java][4] [Ljava.lang.String; is a kind of [Ljava.lang.String; [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t121@b162d5 [java][3] InvokePerlMethod argument 1 = [I@186d4c1 [java][3] InvokePerlMethod argument 2 = [Ljava.lang.String;@f9f9d8 [java][3] exiting InvokePerlMethod [java][2] callback command: callback ::t121 array null object:0:5:t121 object:0:6:[I object:0:7:[Ljava.lang.String; [java][3] packet sent (callback) is callback ::t121 array null object:0:5:t121 object:0:6:[I object:0:7:[Ljava.lang.String; [perl][3] checking if stub is array... [perl][3] perl knows about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] returning stub... [perl][3] checking if stub is array... [perl][3] creating array object... [perl][2] creating object in java (Inline::Java::Object): [perl][3] array object created... [perl][3] returning stub... [perl][3] checking if stub is array... [perl][3] creating array object... [perl][2] creating object in java (Inline::Java::Object): [perl][3] array object created... [perl][3] returning stub... [perl][2] processing callback main::t121::array(t121=HASH(0x406fa80c), Inline::Java::Array=ARRAY(0x406fa83c), Inline::Java::Array=ARRAY(0x406f9bf4)) [perl][3] calling object(6).getLength() [perl][3] packet sent is call_method 6 [I getLength () [java][3] packet recv is call_method 6 [I getLength () [java][4] class [I is reference [java][4] class [I is array [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:50 [perl][3] packet recv is ok scalar:50 [perl][3] getting object(6)->{0} [perl][3] packet sent is get_member 6 [I 0 java.lang.Object undef: [java][3] packet recv is get_member 6 [I 0 java.lang.Object undef: [java][4] class [I is reference [java][4] class [I is array [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:51.52 [perl][3] packet recv is ok scalar:51.52 [perl][3] calling object(7).getLength() [perl][3] packet sent is call_method 7 [Ljava.lang.String; getLength () [java][3] packet recv is call_method 7 [Ljava.lang.String; getLength () [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is array [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:50 [perl][3] packet recv is ok scalar:50 [perl][3] getting object(7)->{1} [perl][3] packet sent is get_member 7 [Ljava.lang.String; 1 java.lang.Object undef: [java][3] packet recv is get_member 7 [Ljava.lang.String; 1 java.lang.Object undef: [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is array [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:55.56.57 [perl][3] packet recv is ok scalar:55.56.57 [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x406f6e94) 5 (t121) [perl][3] packet sent is delete_object 5 [java][3] packet recv is delete_object 5 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x406f9bb8) 7 ([Ljava.lang.String;) [perl][3] packet sent is delete_object 7 [java][3] packet recv is delete_object 7 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x406f9c6c) 6 ([I) [perl][3] packet sent is delete_object 6 [java][3] packet recv is delete_object 6 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [java][3] packet recv (callback) is callback false scalar:56.50.51 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:56.50.51 [perl][3] packet recv is ok scalar:56.50.51 ok 2 [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x406fab4c) 4 ([Ljava.lang.String;) [perl][3] packet sent is delete_object 4 [java][3] packet recv is delete_object 4 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x408b65ec) 3 ([I) [perl][3] packet sent is delete_object 3 [java][3] packet recv is delete_object 3 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][3] matching arguments to new() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] creating object new t1212() [perl][3] packet sent is create_object t1212 () [java][3] packet recv is create_object t1212 () [java][4] class t1212 is reference [java][3] found a t1212 constructor [java][3] () = ()? [java][3] has matching signature () [java][3] registering natives for class t1212 [java][3] packet sent is ok object:0:8:t1212 [perl][3] packet recv is ok object:0:8:t1212 [perl][3] matching arguments to types_stub(byte, short, int, long, float, double, boolean, char, java.lang.String) [perl][4] min = -128, max = 127, val = 1 [perl][4] min = -32768, max = 32767, val = 2 [perl][4] min = -2147483648, max = 2147483647, val = 3 [perl][4] min = -2147483648, max = 2147483647, val = 4 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 5 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 6 [perl][3] match successful: score is 41 [perl][3] calling object(8).types_stub(1, 2, 3, 4, 5, 6, 1, 2, 1000) [perl][3] packet sent is call_method 8 t1212 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][3] packet recv is call_method 8 t1212 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][4] class t1212 is reference [java][3] found a types_stub method [java][3] (byte,short,int,long,float,double,boolean,char,java.lang.String) = (byte,short,int,long,float,double,boolean,char,java.lang.String)? [java][3] has matching signature (byte,short,int,long,float,double,boolean,char,java.lang.String) [java][4] arg 0 of signature is byte [java][4] class byte is primitive numeric [java][4] args is scalar -> forcing to byte [java][4] result is 1 [java][4] arg 1 of signature is short [java][4] class short is primitive numeric [java][4] args is scalar -> forcing to short [java][4] result is 2 [java][4] arg 2 of signature is int [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 3 [java][4] arg 3 of signature is long [java][4] class long is primitive numeric [java][4] args is scalar -> forcing to long [java][4] result is 4 [java][4] arg 4 of signature is float [java][4] class float is primitive numeric [java][4] args is scalar -> forcing to float [java][4] result is 5.0 [java][4] arg 5 of signature is double [java][4] class double is primitive numeric [java][4] args is scalar -> forcing to double [java][4] result is 6.0 [java][4] arg 6 of signature is boolean [java][4] class boolean is primitive bool [java][4] args is scalar -> forcing to bool [java][4] result is true [java][4] arg 7 of signature is char [java][4] class char is primitive char [java][4] args is scalar -> forcing to char [java][4] result is 2 [java][4] arg 8 of signature is java.lang.String [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is 1000 [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t1212@7ffe01 [java][3] InvokePerlMethod argument 1 = 0 [java][3] InvokePerlMethod argument 2 = 0 [java][3] InvokePerlMethod argument 3 = 3 [java][3] InvokePerlMethod argument 4 = 4 [java][3] InvokePerlMethod argument 5 = 5.0 [java][3] InvokePerlMethod argument 6 = 6.0 [java][3] InvokePerlMethod argument 7 = false [java][3] InvokePerlMethod argument 8 = [java][3] InvokePerlMethod argument 9 = 1000 [java][3] exiting InvokePerlMethod [java][4] class java.lang.Byte is primitive numeric [java][4] class java.lang.Short is primitive numeric [java][4] class java.lang.Integer is primitive numeric [java][4] class java.lang.Long is primitive numeric [java][4] class java.lang.Float is primitive numeric [java][4] class java.lang.Double is primitive numeric [java][4] class java.lang.Boolean is primitive bool [java][4] class java.lang.Character is primitive char [java][4] class java.lang.String is primitive string [java][2] callback command: callback ::t121 types null object:0:9:t1212 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [java][3] packet sent (callback) is callback ::t121 types null object:0:9:t1212 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [perl][3] checking if stub is array... [perl][3] perl knows about 't1212' ('main::t1212') [perl][2] creating object in java (main::t1212): [perl][3] returning stub... [perl][2] processing callback main::t121::types(main::t1212=HASH(0x406fa728), 0, 0, 3, 4, 5.0, 6.0, 0, , 1000) [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t1212): [perl][3] deleting object main::t1212=HASH(0x406fa7ac) 9 (t1212) [perl][3] packet sent is delete_object 9 [java][3] packet recv is delete_object 9 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [java][3] packet recv (callback) is callback false scalar:49.48.49.56 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:49.48.49.56 [perl][3] packet recv is ok scalar:49.48.49.56 not ok 3 # Test 3 got: '1018' (t/12_2_perl_natives.t at line 48) # Expected: '1024' [perl][3] matching arguments to callback_stub() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(1).callback_stub() [perl][3] packet sent is call_method 1 t121 callback_stub () [java][3] packet recv is call_method 1 t121 callback_stub () [java][4] class t121 is reference [java][3] found a callback_stub method [java][3] () = ()? [java][3] has matching signature () [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t121@b162d5 [java][3] exiting InvokePerlMethod [java][2] callback command: callback ::t121 callback null object:0:10:t121 [java][3] packet sent (callback) is callback ::t121 callback null object:0:10:t121 [perl][3] checking if stub is array... [perl][3] perl knows about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] returning stub... [perl][2] processing callback main::t121::callback(t121=HASH(0x406f9ae0)) [perl][3] matching arguments to get_name() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(10).get_name() [perl][3] packet sent is call_method 10 t121 get_name () [java][3] packet recv is call_method 10 t121 get_name () [java][4] class t121 is reference [java][3] found a get_name method [java][3] () = ()? [java][3] has matching signature () [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:116.111.116.111 [perl][3] packet recv is ok scalar:116.111.116.111 [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x406f9b58) 10 (t121) [perl][3] packet sent is delete_object 10 [java][3] packet recv is delete_object 10 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [java][3] packet recv (callback) is callback false scalar:116.111.116.111 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:116.111.116.111 [perl][3] packet recv is ok scalar:116.111.116.111 ok 4 [perl][3] getting object count [perl][3] packet sent is obj_cnt [java][3] packet recv is obj_cnt [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:50 [perl][3] packet recv is ok scalar:50 ok 5 [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x40678628) 1 (t121) [perl][3] packet sent is delete_object 1 [java][3] packet recv is delete_object 1 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t1212): [perl][3] deleting object main::t1212=HASH(0x40681608) 8 (t1212) [perl][3] packet sent is delete_object 8 [java][3] packet recv is delete_object 8 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object::Private [perl][1] killed by natural death. [perl][1] JVM owner exiting... [perl][1] exiting with 0 [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java ###### Now make test without JNI active # unset PERL_INLINE_JAVA_DEBUG # unset PERL_INLINE_JAVA_JNI # unset LD_PRELOAD # make test PERL_DL_NONLAZY=1 /usr/local/bin/perl -Iblib/arch -Iblib/lib -I/opt/perl/lib/5.6.1/PA-RISC1.1-thread-multi -I/opt/perl/lib/5.6.1 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t t/01_init...........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: Perl version is 5.006001 Inline version is 0.44 Inline::Java version is 0.45 J2SDK version is 1.4.2.01, from /opt/java1.4 CLASSPATH is t/01_init...........ok 1/1 t/01_init...........ok t/02_primitives.....Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/02_primitives.....ok 1/99 t/02_primitives.....ok 2/99 t/02_primitives.....ok 3/99 t/02_primitives.....ok 4/99 t/02_primitives.....ok 5/99 t/02_primitives.....ok 6/99 t/02_primitives.....ok 7/99 t/02_primitives.....ok 8/99 t/02_primitives.....ok 9/99 t/02_primitives.....ok 10/99 t/02_primitives.....ok 11/99 t/02_primitives.....ok 12/99 t/02_primitives.....ok 13/99 t/02_primitives.....ok 14/99 t/02_primitives.....ok 15/99 t/02_primitives.....ok 16/99 t/02_primitives.....ok 17/99 t/02_primitives.....ok 18/99 t/02_primitives.....ok 19/99 t/02_primitives.....ok 20/99 t/02_primitives.....ok 21/99 t/02_primitives.....ok 22/99 t/02_primitives.....ok 23/99 t/02_primitives.....ok 24/99 t/02_primitives.....ok 25/99 t/02_primitives.....ok 26/99 t/02_primitives.....ok 27/99 t/02_primitives.....ok 28/99 t/02_primitives.....ok 29/99 t/02_primitives.....ok 30/99 t/02_primitives.....ok 31/99 t/02_primitives.....ok 32/99 t/02_primitives.....ok 33/99 t/02_primitives.....ok 34/99 t/02_primitives.....ok 35/99 t/02_primitives.....ok 36/99 t/02_primitives.....ok 37/99 t/02_primitives.....ok 38/99 t/02_primitives.....ok 39/99 t/02_primitives.....ok 40/99 t/02_primitives.....ok 41/99 t/02_primitives.....ok 42/99 t/02_primitives.....ok 43/99 t/02_primitives.....ok 44/99 t/02_primitives.....ok 45/99 t/02_primitives.....ok 46/99 t/02_primitives.....ok 47/99 t/02_primitives.....ok 48/99 t/02_primitives.....ok 49/99 t/02_primitives.....ok 50/99 t/02_primitives.....ok 51/99 t/02_primitives.....ok 52/99 t/02_primitives.....ok 53/99 t/02_primitives.....ok 54/99 t/02_primitives.....ok 55/99 t/02_primitives.....ok 56/99 t/02_primitives.....ok 57/99 t/02_primitives.....ok 58/99 t/02_primitives.....ok 59/99 t/02_primitives.....ok 60/99 t/02_primitives.....ok 61/99 t/02_primitives.....ok 62/99 t/02_primitives.....ok 63/99 t/02_primitives.....ok 64/99 t/02_primitives.....ok 65/99 t/02_primitives.....ok 66/99 t/02_primitives.....ok 67/99 t/02_primitives.....ok 68/99 t/02_primitives.....ok 69/99 t/02_primitives.....ok 70/99 t/02_primitives.....ok 71/99 t/02_primitives.....ok 72/99 t/02_primitives.....ok 73/99 t/02_primitives.....ok 74/99 t/02_primitives.....ok 75/99 t/02_primitives.....ok 76/99 t/02_primitives.....ok 77/99 t/02_primitives.....ok 78/99 t/02_primitives.....ok 79/99 t/02_primitives.....ok 80/99 t/02_primitives.....ok 81/99 t/02_primitives.....ok 82/99 t/02_primitives.....ok 83/99 t/02_primitives.....ok 84/99 t/02_primitives.....ok 85/99 t/02_primitives.....ok 86/99 t/02_primitives.....ok 87/99 t/02_primitives.....ok 88/99 t/02_primitives.....ok 89/99 t/02_primitives.....ok 90/99 t/02_primitives.....ok 91/99 t/02_primitives.....ok 92/99 t/02_primitives.....ok 93/99 t/02_primitives.....ok 94/99 t/02_primitives.....ok 95/99 t/02_primitives.....ok 96/99 t/02_primitives.....ok 97/99 t/02_primitives.....ok 98/99 t/02_primitives.....ok 99/99 t/02_primitives.....ok t/03_objects........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/03_objects........ok 1/16 t/03_objects........ok 2/16 t/03_objects........ok 3/16 t/03_objects........ok 4/16 t/03_objects........ok 5/16 t/03_objects........ok 6/16 t/03_objects........ok 7/16 t/03_objects........ok 8/16 t/03_objects........ok 9/16 t/03_objects........ok 10/16 t/03_objects........ok 11/16 t/03_objects........ok 12/16 t/03_objects........ok 13/16 t/03_objects........ok 14/16 t/03_objects........ok 15/16 t/03_objects........ok 16/16 t/03_objects........ok t/04_members........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/04_members........ok 1/28 t/04_members........ok 2/28 t/04_members........ok 3/28 t/04_members........ok 4/28 t/04_members........ok 5/28 t/04_members........ok 6/28 t/04_members........ok 7/28 t/04_members........ok 8/28 t/04_members........ok 9/28 t/04_members........ok 10/28 t/04_members........ok 11/28 t/04_members........ok 12/28 t/04_members........ok 13/28 t/04_members........ok 14/28 t/04_members........ok 15/28 t/04_members........ok 16/28 t/04_members........ok 17/28 t/04_members........ok 18/28 t/04_members........ok 19/28 t/04_members........ok 20/28 t/04_members........ok 21/28 t/04_members........ok 22/28 t/04_members........ok 23/28 t/04_members........ok 24/28 t/04_members........ok 25/28 t/04_members........ok 26/28 t/04_members........ok 27/28 t/04_members........ok 28/28 t/04_members........ok t/05_arrays.........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/05_arrays.........ok 1/55 t/05_arrays.........ok 2/55 t/05_arrays.........ok 3/55 t/05_arrays.........ok 4/55 t/05_arrays.........ok 5/55 t/05_arrays.........ok 6/55 t/05_arrays.........ok 7/55 t/05_arrays.........ok 8/55 t/05_arrays.........ok 9/55 t/05_arrays.........ok 10/55 t/05_arrays.........ok 11/55 t/05_arrays.........ok 12/55 t/05_arrays.........ok 13/55 t/05_arrays.........ok 14/55 t/05_arrays.........ok 15/55 t/05_arrays.........ok 16/55 t/05_arrays.........ok 17/55 t/05_arrays.........ok 18/55 t/05_arrays.........ok 19/55 t/05_arrays.........ok 20/55 t/05_arrays.........ok 21/55 t/05_arrays.........ok 22/55 t/05_arrays.........ok 23/55 t/05_arrays.........ok 24/55 t/05_arrays.........ok 25/55 t/05_arrays.........ok 26/55 t/05_arrays.........ok 27/55 t/05_arrays.........ok 28/55 t/05_arrays.........ok 29/55 t/05_arrays.........ok 30/55 t/05_arrays.........ok 31/55 t/05_arrays.........ok 32/55 t/05_arrays.........ok 33/55 t/05_arrays.........ok 34/55 t/05_arrays.........ok 35/55 t/05_arrays.........ok 36/55 t/05_arrays.........ok 37/55 t/05_arrays.........ok 38/55 t/05_arrays.........ok 39/55 t/05_arrays.........ok 40/55 t/05_arrays.........ok 41/55 t/05_arrays.........ok 42/55 t/05_arrays.........ok 43/55 t/05_arrays.........ok 44/55 t/05_arrays.........ok 45/55 t/05_arrays.........ok 46/55 t/05_arrays.........ok 47/55 t/05_arrays.........ok 48/55 t/05_arrays.........ok 49/55 t/05_arrays.........ok 50/55 t/05_arrays.........ok 51/55 t/05_arrays.........ok 52/55 t/05_arrays.........ok 53/55 t/05_arrays.........ok 54/55 t/05_arrays.........ok 55/55 t/05_arrays.........ok t/06_static.........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/06_static.........ok 1/10 t/06_static.........ok 2/10 t/06_static.........ok 3/10 t/06_static.........ok 4/10 t/06_static.........ok 5/10 t/06_static.........ok 6/10 t/06_static.........ok 7/10 t/06_static.........ok 8/10 t/06_static.........ok 9/10 t/06_static.........ok 10/10 t/06_static.........ok t/07_polymorph......Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/07_polymorph......ok 1/22 t/07_polymorph......ok 2/22 t/07_polymorph......ok 3/22 t/07_polymorph......ok 4/22 t/07_polymorph......ok 5/22 t/07_polymorph......ok 6/22 t/07_polymorph......ok 7/22 t/07_polymorph......ok 8/22 t/07_polymorph......ok 9/22 t/07_polymorph......ok 10/22 t/07_polymorph......ok 11/22 t/07_polymorph......ok 12/22 t/07_polymorph......ok 13/22 t/07_polymorph......ok 14/22 t/07_polymorph......ok 15/22 t/07_polymorph......ok 16/22 t/07_polymorph......ok 17/22 t/07_polymorph......ok 18/22 t/07_polymorph......ok 19/22 t/07_polymorph......ok 20/22 t/07_polymorph......ok 21/22 t/07_polymorph......ok 22/22 t/07_polymorph......ok t/08_study..........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/08_study..........ok 1/9 t/08_study..........ok 2/9 t/08_study..........ok 3/9 t/08_study..........ok 4/9 t/08_study..........ok 5/9 t/08_study..........ok 6/9 t/08_study..........ok 7/9 t/08_study..........ok 8/9 t/08_study..........ok 9/9 t/08_study..........ok t/09_usages.........Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/09_usages.........ok 1/4 t/09_usages.........ok 2/4 t/09_usages.........ok 3/4 t/09_usages.........ok 4/4 t/09_usages.........ok t/10_1_shared_alone. t/10_1_shared_alone.ok 1/4 t/10_1_shared_alone.ok 2/4 t/10_1_shared_alone.ok 3/4 t/10_1_shared_alone.ok 4/4 t/10_1_shared_alone.ok t/10_2_shared_start. t/10_2_shared_start.ok 1/3 t/10_2_shared_start.ok 2/3 t/10_2_shared_start.ok 3/3 t/10_2_shared_start.ok t/10_3_shared_use... t/10_3_shared_use...ok 1/3 t/10_3_shared_use...ok 2/3 t/10_3_shared_use...ok 3/3 t/10_3_shared_use...ok t/10_4_shared_stop.. t/10_4_shared_stop..ok 1/4 t/10_4_shared_stop..ok 2/4 t/10_4_shared_stop..ok 3/4 t/10_4_shared_stop..ok 4/4 t/10_4_shared_stop..ok t/10_5_shared_fork.. t/10_5_shared_fork..ok 1/8 t/10_5_shared_fork..ok 2/8 t/10_5_shared_fork..ok 3/8 t/10_5_shared_fork..ok 4/8 t/10_5_shared_fork..ok 5/8 t/10_5_shared_fork..ok 6/8 t/10_5_shared_fork..ok 7/8 t/10_5_shared_fork..ok 8/8 t/10_5_shared_fork..ok t/10_6_shared_sim... t/10_6_shared_sim...ok 1/7 t/10_6_shared_sim...ok 2/7 t/10_6_shared_sim...ok 3/7 t/10_6_shared_sim...ok 4/7 t/10_6_shared_sim...ok 5/7 t/10_6_shared_sim...ok 6/7 t/10_6_shared_sim...ok 7/7 t/10_6_shared_sim...ok t/11_exceptions.....Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/11_exceptions.....ok 1/8 t/11_exceptions.....ok 2/8 t/11_exceptions.....ok 3/8 t/11_exceptions.....ok 4/8 t/11_exceptions.....ok 5/8 t/11_exceptions.....ok 6/8 t/11_exceptions.....ok 7/8 t/11_exceptions.....ok 8/8 t/11_exceptions.....ok t/12_1_callbacks.... t/12_1_callbacks....ok 1/23 t/12_1_callbacks....ok 2/23 t/12_1_callbacks....ok 3/23 t/12_1_callbacks....ok 4/23 t/12_1_callbacks....ok 5/23 t/12_1_callbacks....ok 6/23 t/12_1_callbacks....ok 7/23 t/12_1_callbacks....ok 8/23 t/12_1_callbacks....ok 9/23 t/12_1_callbacks....ok 10/23 t/12_1_callbacks....ok 11/23 t/12_1_callbacks....ok 12/23 t/12_1_callbacks....ok 13/23 t/12_1_callbacks....ok 14/23 t/12_1_callbacks....ok 15/23 t/12_1_callbacks....ok 16/23 t/12_1_callbacks....ok 17/23 t/12_1_callbacks....ok 18/23 t/12_1_callbacks....ok 19/23 t/12_1_callbacks....ok 20/23 t/12_1_callbacks....ok 21/23 t/12_1_callbacks....ok 22/23 t/12_1_callbacks....ok 23/23 t/12_1_callbacks....ok t/12_2_perl_natives. Note: PerlNatives is still experimental and errors here can safely be ignored if you don't plan on using this feature. However, the author would appreciate if errors encountered here were reported to the mailing list (inline@perl.org) along with your hardware/OS detail. Thank you. Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: Argument "" isn't numeric in addition (+) at t/12_2_perl_natives.t line 71, line 7. t/12_2_perl_natives.NOK 1 t/12_2_perl_natives.ok 2/5 Argument "" isn't numeric in addition (+) at t/12_2_perl_natives.t line 71, line 26. t/12_2_perl_natives.NOK 3 t/12_2_perl_natives.ok 4/5 t/12_2_perl_natives.ok 5/5 t/12_2_perl_natives.FAILED tests 1, 3 Failed 2/5 tests, 60.00% okay t/13_end............Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: t/13_end............ok 1/1 t/13_end............ok Failed Test Status Wstat Total Fail Failed List of Failed -------------------------------------------------------------------------------- t/12_2_perl_natives.t 5 2 40.00% 1, 3 Failed 1/19 test scripts, 94.74% okay. 2/310 subtests failed, 99.35% okay. *** Error exit code 255 Stop. ####### Individual t/12_2 test as asked by Mr. LeBoutillier ####### WITHOUT JNI active # export PERL_INLINE_JAVA_DEBUG=4 # perl -Mblib t/12_2_perl_natives.t Using /opt/Inline-Java-0.45/blib Note: PerlNatives is still experimental and errors here can safely be ignored if you don't plan on using this feature. However, the author would appreciate if errors encountered here were reported to the mailing list (inline@perl.org) along with your hardware/OS detail. Thank you. [perl][1] validate done. [perl][1] Starting load. [perl][4] portable: ENV_VAR_PATH_SEP_CP for hpux is default ':' [perl][4] portable: SUB_FIX_CLASSPATH => /opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaServer.jar for hpux is default '/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaServer.jar' [perl][2] classpath: /opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaServer.jar [perl][1] starting JVM... [perl][1] client/server mode [perl][4] portable: GOT_NEXT_FREE_PORT for hpux is default '1' Could not get next available port number, using port 7890 instead. Use the PORT configuration option to suppress this warning. Error: [perl][4] portable: EXE_EXTENSION for hpux is default '' [perl][4] portable: SUB_FIX_CMD_QUOTES => "/opt/java1.4/bin/java" org.perl.inline.java.InlineJavaServer 4 7890 false false for hpux is default '"/opt/java1.4/bin/java" org.perl.inline.java.InlineJavaServer 4 7890 false false' [perl][2] "/opt/java1.4/bin/java" org.perl.inline.java.InlineJavaServer 4 7890 false false [perl][4] portable: DEV_NULL for hpux is default '/dev/null' [perl][4] portable: GOT_ALARM for hpux is default 'define' [perl][2] classpath: [perl][4] portable: SUB_FIX_CLASSPATH => /opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar for hpux is default '/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar' [perl][2] adding to classpath: '/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar' [perl][3] packet sent is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.98.108.105.98.47.108.105.98.47.73.110.108.105.110.101.47.74.97.118.97.47.73.110.108.105.110.101.74.97.118.97.85.115.101.114.46.106.97.114 [java][3] packet recv is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.98.108.105.98.47.108.105.98.47.73.110.108.105.110.101.47.74.97.118.97.47.73.110.108.105.110.101.74.97.118.97.85.115.101.114.46.106.97.114 [java][2] added file:/opt/Inline-Java-0.45/blib/lib/Inline/Java/InlineJavaUser.jar to classpath [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][3] getting server type [perl][3] packet sent is server_type [java][3] packet recv is server_type [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:112.114.105.118.97.116.101 [perl][3] packet recv is ok scalar:112.114.105.118.97.116.101 [perl][4] destroying Inline::Java::Protocol [perl][4] portable: ENV_VAR_PATH_SEP_CP for hpux is default ':' [perl][2] classpath candidate '' scraped [perl][4] portable: SUB_FIX_CLASSPATH => /opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54 for hpux is default '/opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54' [perl][2] adding to classpath: '/opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54' [perl][3] packet sent is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.95.73.110.108.105.110.101.95.116.101.115.116.47.108.105.98.47.97.117.116.111.47.95.49.50.95.50.95.112.101.114.108.95.110.97.116.105.118.101.115.95.116.95.57.101.53.52 [java][3] packet recv is add_classpath 47.111.112.116.47.73.110.108.105.110.101.45.74.97.118.97.45.48.46.52.53.47.95.73.110.108.105.110.101.95.116.101.115.116.47.108.105.98.47.97.117.116.111.47.95.49.50.95.50.95.112.101.114.108.95.110.97.116.105.118.101.115.95.116.95.57.101.53.52 [java][2] added file:/opt/Inline-Java-0.45/_Inline_test/lib/auto/_12_2_perl_natives_t_9e54/ to classpath [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][3] Inline::Java object id is 0 [perl][1] using jdat cache [perl][3] perl doesn't know about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] perl doesn't know about 't1212' ('main::t1212') [perl][2] creating object in java (main::t1212): [perl][1] load done. [perl][4] destroying Inline::Java::Protocol [perl][3] matching arguments to init() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(0).init() [perl][3] packet sent is call_method 0 t121 init () [java][3] packet recv is call_method 0 t121 init () [java][4] class t121 is reference [java][3] found a init method [java][3] () = ()? [java][3] has matching signature () [java][1] loading InlineJavaUserClassLink via InlineJavaUserClassLoader [java][2] loading shared library /opt/Inline-Java-0.45/blib/arch/auto/Inline/Java/Natives/Natives.sl [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: 1..5 [perl][3] matching arguments to init() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(0).init() [perl][3] packet sent is call_method 0 t121 init () [java][3] packet recv is call_method 0 t121 init () [java][4] class t121 is reference [java][3] method was cached [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][3] matching arguments to new() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] creating object new t121() [perl][3] packet sent is create_object t121 () [java][3] packet recv is create_object t121 () [java][4] class t121 is reference [java][3] found a t121 constructor [java][3] () = ()? [java][3] has matching signature () [java][3] registering natives for class t121 [java][3] registering native method array for class t121 [java][3] signature is ([I[Ljava/lang/String;)Ljava/lang/String; [java][3] format is LLL [java][3] registering native method types for class t121 [java][3] signature is (BSIJFDZCLjava/lang/String;)Ljava/lang/String; [java][3] format is LBSIJFDZCL [java][3] registering native method callback for class t121 [java][3] signature is ()Ljava/lang/String; [java][3] format is L [java][3] packet sent is ok object:0:1:t121 [perl][3] packet recv is ok object:0:1:t121 [perl][3] matching arguments to types_stub(byte, short, int, long, float, double, boolean, char, java.lang.String) [perl][4] min = -128, max = 127, val = 1 [perl][4] min = -32768, max = 32767, val = 2 [perl][4] min = -2147483648, max = 2147483647, val = 3 [perl][4] min = -2147483648, max = 2147483647, val = 4 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 5 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 6 [perl][3] match successful: score is 41 [perl][3] calling object(1).types_stub(1, 2, 3, 4, 5, 6, 1, 2, 1000) [perl][3] packet sent is call_method 1 t121 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][3] packet recv is call_method 1 t121 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][4] class t121 is reference [java][3] found a types_stub method [java][3] (byte,short,int,long,float,double,boolean,char,java.lang.String) = (byte,short,int,long,float,double,boolean,char,java.lang.String)? [java][3] has matching signature (byte,short,int,long,float,double,boolean,char,java.lang.String) [java][4] arg 0 of signature is byte [java][4] class byte is primitive numeric [java][4] args is scalar -> forcing to byte [java][4] result is 1 [java][4] arg 1 of signature is short [java][4] class short is primitive numeric [java][4] args is scalar -> forcing to short [java][4] result is 2 [java][4] arg 2 of signature is int [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 3 [java][4] arg 3 of signature is long [java][4] class long is primitive numeric [java][4] args is scalar -> forcing to long [java][4] result is 4 [java][4] arg 4 of signature is float [java][4] class float is primitive numeric [java][4] args is scalar -> forcing to float [java][4] result is 5.0 [java][4] arg 5 of signature is double [java][4] class double is primitive numeric [java][4] args is scalar -> forcing to double [java][4] result is 6.0 [java][4] arg 6 of signature is boolean [java][4] class boolean is primitive bool [java][4] args is scalar -> forcing to bool [java][4] result is true [java][4] arg 7 of signature is char [java][4] class char is primitive char [java][4] args is scalar -> forcing to char [java][4] result is 2 [java][4] arg 8 of signature is java.lang.String [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is 1000 [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t121@117a8bd [java][3] InvokePerlMethod argument 1 = 0 [java][3] InvokePerlMethod argument 2 = 0 [java][3] InvokePerlMethod argument 3 = 3 [java][3] InvokePerlMethod argument 4 = 4 [java][3] InvokePerlMethod argument 5 = 5.0 [java][3] InvokePerlMethod argument 6 = 6.0 [java][3] InvokePerlMethod argument 7 = false [java][3] InvokePerlMethod argument 8 = [java][3] InvokePerlMethod argument 9 = 1000 [java][3] exiting InvokePerlMethod [java][4] class java.lang.Byte is primitive numeric [java][4] class java.lang.Short is primitive numeric [java][4] class java.lang.Integer is primitive numeric [java][4] class java.lang.Long is primitive numeric [java][4] class java.lang.Float is primitive numeric [java][4] class java.lang.Double is primitive numeric [java][4] class java.lang.Boolean is primitive bool [java][4] class java.lang.Character is primitive char [java][4] class java.lang.String is primitive string [java][2] callback command: callback ::t121 types null object:0:2:t121 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [java][3] packet sent (callback) is callback ::t121 types null object:0:2:t121 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [perl][3] packet recv is callback ::t121 types null object:0:2:t121 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [perl][3] checking if stub is array... [perl][3] perl knows about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] returning stub... [perl][2] processing callback main::t121::types(t121=HASH(0x4053f8e0), 0, 0, 3, 4, 5.0, 6.0, 0, , 1000) [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x4056abf8) 2 (t121) [perl][3] packet sent is delete_object 2 [java][3] packet recv (callback) is delete_object 2 [java][3] packet is not callback response: delete_object 2 [java][3] packet recv is delete_object 2 [java][3] packet sent is ok undef: [java][3] packet sent (callback) is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [perl][3] packet sent is callback false scalar:49.48.49.56 [java][3] packet recv (callback) is callback false scalar:49.48.49.56 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:49.48.49.56 [perl][3] packet recv is ok scalar:49.48.49.56 not ok 1 # Test 1 got: '1018' (t/12_2_perl_natives.t at line 44) # Expected: '1024' [perl][3] matching arguments to array_stub([I, [Ljava.lang.String;) [perl][4] min = -2147483648, max = 2147483647, val = 34 [perl][4] min = -2147483648, max = 2147483647, val = 56 [perl][4] array is [2] [perl][4] array has 2 declared cells [perl][4] array should have 2 declared cells [perl][3] creating object new [I(34, 56) [perl][3] packet sent is create_object [I (2) scalar:51.52 scalar:53.54 [java][3] packet recv is create_object [I (2) scalar:51.52 scalar:53.54 [java][4] class [I is reference [java][4] class [I is array [java][4] array elements: int [java][4] array dimension: 2 [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 34 [java][4] setting array element 0 to 34 [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 56 [java][4] setting array element 1 to 56 [java][3] packet sent is ok object:0:3:[I [perl][3] packet recv is ok object:0:3:[I [perl][3] checking if [I is a [I [perl][3] packet sent is isa [I [I [java][3] packet recv is isa [I [I [java][4] checking if [I extends [I [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:48 [perl][3] packet recv is ok scalar:48 [perl][3] Inline::Java::Array=ARRAY(0x40147504) is a [I [perl][4] array is [2] [perl][4] array has 2 declared cells [perl][4] array should have 2 declared cells [perl][3] creating object new [Ljava.lang.String;(toto, 789) [perl][3] packet sent is create_object [Ljava.lang.String; (2) scalar:116.111.116.111 scalar:55.56.57 [java][3] packet recv is create_object [Ljava.lang.String; (2) scalar:116.111.116.111 scalar:55.56.57 [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is array [java][4] array elements: java.lang.String [java][4] array dimension: 2 [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is toto [java][4] setting array element 0 to toto [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is 789 [java][4] setting array element 1 to 789 [java][3] packet sent is ok object:0:4:[Ljava.lang.String; [perl][3] packet recv is ok object:0:4:[Ljava.lang.String; [perl][3] checking if [Ljava.lang.String; is a [Ljava.lang.String; [perl][3] packet sent is isa [Ljava.lang.String; [Ljava.lang.String; [java][3] packet recv is isa [Ljava.lang.String; [Ljava.lang.String; [java][4] checking if [Ljava.lang.String; extends [Ljava.lang.String; [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:48 [perl][3] packet recv is ok scalar:48 [perl][3] Inline::Java::Array=ARRAY(0x405b203c) is a [Ljava.lang.String; [perl][3] match successful: score is 15 [perl][3] calling object(1).array_stub(Inline::Java::Array=ARRAY(0x40147504), Inline::Java::Array=ARRAY(0x405b203c)) [perl][3] packet sent is call_method 1 t121 array_stub ([I,[Ljava.lang.String;) object:[I:3 object:[Ljava.lang.String;:4 [java][3] packet recv is call_method 1 t121 array_stub ([I,[Ljava.lang.String;) object:[I:3 object:[Ljava.lang.String;:4 [java][4] class t121 is reference [java][3] found a array_stub method [java][3] ([I,[Ljava.lang.String;) = ([I,[Ljava.lang.String;)? [java][3] has matching signature ([I,[Ljava.lang.String;) [java][4] arg 0 of signature is [I [java][4] class [I is reference [java][4] class [I is reference [java][4] checking if [I extends [I [java][4] [I is a kind of [I [java][4] arg 1 of signature is [Ljava.lang.String; [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is reference [java][4] checking if [Ljava.lang.String; extends [Ljava.lang.String; [java][4] [Ljava.lang.String; is a kind of [Ljava.lang.String; [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t121@117a8bd [java][3] InvokePerlMethod argument 1 = [I@10ef90c [java][3] InvokePerlMethod argument 2 = [Ljava.lang.String;@a32b [java][3] exiting InvokePerlMethod [java][2] callback command: callback ::t121 array null object:0:5:t121 object:0:6:[I object:0:7:[Ljava.lang.String; [java][3] packet sent (callback) is callback ::t121 array null object:0:5:t121 object:0:6:[I object:0:7:[Ljava.lang.String; [perl][3] packet recv is callback ::t121 array null object:0:5:t121 object:0:6:[I object:0:7:[Ljava.lang.String; [perl][3] checking if stub is array... [perl][3] perl knows about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] returning stub... [perl][3] checking if stub is array... [perl][3] creating array object... [perl][2] creating object in java (Inline::Java::Object): [perl][3] array object created... [perl][3] returning stub... [perl][3] checking if stub is array... [perl][3] creating array object... [perl][2] creating object in java (Inline::Java::Object): [perl][3] array object created... [perl][3] returning stub... [perl][2] processing callback main::t121::array(t121=HASH(0x405b2120), Inline::Java::Array=ARRAY(0x405b2150), Inline::Java::Array=ARRAY(0x4056b554)) [perl][3] calling object(6).getLength() [perl][3] packet sent is call_method 6 [I getLength () [java][3] packet recv (callback) is call_method 6 [I getLength () [java][3] packet is not callback response: call_method 6 [I getLength () [java][3] packet recv is call_method 6 [I getLength () [java][4] class [I is reference [java][4] class [I is array [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:50 [java][3] packet sent (callback) is ok scalar:50 [perl][3] packet recv is ok scalar:50 [perl][3] getting object(6)->{0} [perl][3] packet sent is get_member 6 [I 0 java.lang.Object undef: [java][3] packet recv (callback) is get_member 6 [I 0 java.lang.Object undef: [java][3] packet is not callback response: get_member 6 [I 0 java.lang.Object undef: [java][3] packet recv is get_member 6 [I 0 java.lang.Object undef: [java][4] class [I is reference [java][4] class [I is array [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:51.52 [java][3] packet sent (callback) is ok scalar:51.52 [perl][3] packet recv is ok scalar:51.52 [perl][3] calling object(7).getLength() [perl][3] packet sent is call_method 7 [Ljava.lang.String; getLength () [java][3] packet recv (callback) is call_method 7 [Ljava.lang.String; getLength () [java][3] packet is not callback response: call_method 7 [Ljava.lang.String; getLength () [java][3] packet recv is call_method 7 [Ljava.lang.String; getLength () [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is array [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:50 [java][3] packet sent (callback) is ok scalar:50 [perl][3] packet recv is ok scalar:50 [perl][3] getting object(7)->{1} [perl][3] packet sent is get_member 7 [Ljava.lang.String; 1 java.lang.Object undef: [java][3] packet recv (callback) is get_member 7 [Ljava.lang.String; 1 java.lang.Object undef: [java][3] packet is not callback response: get_member 7 [Ljava.lang.String; 1 java.lang.Object undef: [java][3] packet recv is get_member 7 [Ljava.lang.String; 1 java.lang.Object undef: [java][4] class [Ljava.lang.String; is reference [java][4] class [Ljava.lang.String; is array [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:55.56.57 [java][3] packet sent (callback) is ok scalar:55.56.57 [perl][3] packet recv is ok scalar:55.56.57 [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x405b2ca0) 5 (t121) [perl][3] packet sent is delete_object 5 [java][3] packet recv (callback) is delete_object 5 [java][3] packet is not callback response: delete_object 5 [java][3] packet recv is delete_object 5 [java][3] packet sent is ok undef: [java][3] packet sent (callback) is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x4056b518) 7 ([Ljava.lang.String;) [perl][3] packet sent is delete_object 7 [java][3] packet recv (callback) is delete_object 7 [java][3] packet is not callback response: delete_object 7 [java][3] packet recv is delete_object 7 [java][3] packet sent is ok undef: [java][3] packet sent (callback) is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x4056b5cc) 6 ([I) [perl][3] packet sent is delete_object 6 [java][3] packet recv (callback) is delete_object 6 [java][3] packet is not callback response: delete_object 6 [java][3] packet recv is delete_object 6 [java][3] packet sent is ok undef: [java][3] packet sent (callback) is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [perl][3] packet sent is callback false scalar:56.50.51 [java][3] packet recv (callback) is callback false scalar:56.50.51 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:56.50.51 [perl][3] packet recv is ok scalar:56.50.51 ok 2 [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x405b2da8) 4 ([Ljava.lang.String;) [perl][3] packet sent is delete_object 4 [java][3] packet recv is delete_object 4 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Array [perl][4] destroying Inline::Java::Array::Tie [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (Inline::Java::Object): [perl][3] deleting object Inline::Java::Object=HASH(0x405ab600) 3 ([I) [perl][3] packet sent is delete_object 3 [java][3] packet recv is delete_object 3 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][3] matching arguments to new() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] creating object new t1212() [perl][3] packet sent is create_object t1212 () [java][3] packet recv is create_object t1212 () [java][4] class t1212 is reference [java][3] found a t1212 constructor [java][3] () = ()? [java][3] has matching signature () [java][3] registering natives for class t1212 [java][3] packet sent is ok object:0:8:t1212 [perl][3] packet recv is ok object:0:8:t1212 [perl][3] matching arguments to types_stub(byte, short, int, long, float, double, boolean, char, java.lang.String) [perl][4] min = -128, max = 127, val = 1 [perl][4] min = -32768, max = 32767, val = 2 [perl][4] min = -2147483648, max = 2147483647, val = 3 [perl][4] min = -2147483648, max = 2147483647, val = 4 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 5 [perl][4] min = -3.4028235e+38, max = 3.4028235e+38, val = 6 [perl][3] match successful: score is 41 [perl][3] calling object(8).types_stub(1, 2, 3, 4, 5, 6, 1, 2, 1000) [perl][3] packet sent is call_method 8 t1212 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][3] packet recv is call_method 8 t1212 types_stub (byte,short,int,long,float,double,boolean,char,java.lang.String) scalar:49 scalar:50 scalar:51 scalar:52 scalar:53 scalar:54 scalar:49 scalar:50 scalar:49.48.48.48 [java][4] class t1212 is reference [java][3] found a types_stub method [java][3] (byte,short,int,long,float,double,boolean,char,java.lang.String) = (byte,short,int,long,float,double,boolean,char,java.lang.String)? [java][3] has matching signature (byte,short,int,long,float,double,boolean,char,java.lang.String) [java][4] arg 0 of signature is byte [java][4] class byte is primitive numeric [java][4] args is scalar -> forcing to byte [java][4] result is 1 [java][4] arg 1 of signature is short [java][4] class short is primitive numeric [java][4] args is scalar -> forcing to short [java][4] result is 2 [java][4] arg 2 of signature is int [java][4] class int is primitive numeric [java][4] args is scalar -> forcing to int [java][4] result is 3 [java][4] arg 3 of signature is long [java][4] class long is primitive numeric [java][4] args is scalar -> forcing to long [java][4] result is 4 [java][4] arg 4 of signature is float [java][4] class float is primitive numeric [java][4] args is scalar -> forcing to float [java][4] result is 5.0 [java][4] arg 5 of signature is double [java][4] class double is primitive numeric [java][4] args is scalar -> forcing to double [java][4] result is 6.0 [java][4] arg 6 of signature is boolean [java][4] class boolean is primitive bool [java][4] args is scalar -> forcing to bool [java][4] result is true [java][4] arg 7 of signature is char [java][4] class char is primitive char [java][4] args is scalar -> forcing to char [java][4] result is 2 [java][4] arg 8 of signature is java.lang.String [java][4] class java.lang.String is primitive string [java][4] args is scalar -> forcing to java.lang.String [java][4] result is 1000 [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t1212@12152e6 [java][3] InvokePerlMethod argument 1 = 0 [java][3] InvokePerlMethod argument 2 = 0 [java][3] InvokePerlMethod argument 3 = 3 [java][3] InvokePerlMethod argument 4 = 4 [java][3] InvokePerlMethod argument 5 = 5.0 [java][3] InvokePerlMethod argument 6 = 6.0 [java][3] InvokePerlMethod argument 7 = false [java][3] InvokePerlMethod argument 8 = [java][3] InvokePerlMethod argument 9 = 1000 [java][3] exiting InvokePerlMethod [java][4] class java.lang.Byte is primitive numeric [java][4] class java.lang.Short is primitive numeric [java][4] class java.lang.Integer is primitive numeric [java][4] class java.lang.Long is primitive numeric [java][4] class java.lang.Float is primitive numeric [java][4] class java.lang.Double is primitive numeric [java][4] class java.lang.Boolean is primitive bool [java][4] class java.lang.Character is primitive char [java][4] class java.lang.String is primitive string [java][2] callback command: callback ::t121 types null object:0:9:t1212 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [java][3] packet sent (callback) is callback ::t121 types null object:0:9:t1212 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [perl][3] packet recv is callback ::t121 types null object:0:9:t1212 scalar:48 scalar:48 scalar:51 scalar:52 scalar:53.46.48 scalar:54.46.48 scalar:48 scalar:0 scalar:49.48.48.48 [perl][3] checking if stub is array... [perl][3] perl knows about 't1212' ('main::t1212') [perl][2] creating object in java (main::t1212): [perl][3] returning stub... [perl][2] processing callback main::t121::types(main::t1212=HASH(0x405b203c), 0, 0, 3, 4, 5.0, 6.0, 0, , 1000) [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t1212): [perl][3] deleting object main::t1212=HASH(0x40541d68) 9 (t1212) [perl][3] packet sent is delete_object 9 [java][3] packet recv (callback) is delete_object 9 [java][3] packet is not callback response: delete_object 9 [java][3] packet recv is delete_object 9 [java][3] packet sent is ok undef: [java][3] packet sent (callback) is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [perl][3] packet sent is callback false scalar:49.48.49.56 [java][3] packet recv (callback) is callback false scalar:49.48.49.56 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:49.48.49.56 [perl][3] packet recv is ok scalar:49.48.49.56 not ok 3 # Test 3 got: '1018' (t/12_2_perl_natives.t at line 48) # Expected: '1024' [perl][3] matching arguments to callback_stub() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(1).callback_stub() [perl][3] packet sent is call_method 1 t121 callback_stub () [java][3] packet recv is call_method 1 t121 callback_stub () [java][4] class t121 is reference [java][3] found a callback_stub method [java][3] () = ()? [java][3] has matching signature () [java][3] entering LookupMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] exiting LookupMethod [java][3] entering InvokePerlMethod [java][3] entering GetNativeCaller [java][3] exiting GetNativeCaller [java][3] InvokePerlMethod argument 0 = t121@117a8bd [java][3] exiting InvokePerlMethod [java][2] callback command: callback ::t121 callback null object:0:10:t121 [java][3] packet sent (callback) is callback ::t121 callback null object:0:10:t121 [perl][3] packet recv is callback ::t121 callback null object:0:10:t121 [perl][3] checking if stub is array... [perl][3] perl knows about 't121' ('main::t121') [perl][2] creating object in java (main::t121): [perl][3] returning stub... [perl][2] processing callback main::t121::callback(t121=HASH(0x4056b434)) [perl][3] matching arguments to get_name() [perl][3] match successful: score is 0 [perl][3] perfect match found, aborting search [perl][3] calling object(10).get_name() [perl][3] packet sent is call_method 10 t121 get_name () [java][3] packet recv (callback) is call_method 10 t121 get_name () [java][3] packet is not callback response: call_method 10 t121 get_name () [java][3] packet recv is call_method 10 t121 get_name () [java][4] class t121 is reference [java][3] found a get_name method [java][3] () = ()? [java][3] has matching signature () [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:116.111.116.111 [java][3] packet sent (callback) is ok scalar:116.111.116.111 [perl][3] packet recv is ok scalar:116.111.116.111 [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x4056b548) 10 (t121) [perl][3] packet sent is delete_object 10 [java][3] packet recv (callback) is delete_object 10 [java][3] packet is not callback response: delete_object 10 [java][3] packet recv is delete_object 10 [java][3] packet sent is ok undef: [java][3] packet sent (callback) is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Protocol [perl][3] packet sent is callback false scalar:116.111.116.111 [java][3] packet recv (callback) is callback false scalar:116.111.116.111 [java][4] class java.lang.Object is reference [java][4] class java.lang.String is primitive string [java][3] packet sent is ok scalar:116.111.116.111 [perl][3] packet recv is ok scalar:116.111.116.111 ok 4 [perl][3] getting object count [perl][3] packet sent is obj_cnt [java][3] packet recv is obj_cnt [java][4] class java.lang.Integer is primitive numeric [java][3] packet sent is ok scalar:50 [perl][3] packet recv is ok scalar:50 ok 5 [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t121): [perl][3] deleting object t121=HASH(0x4053f964) 1 (t121) [perl][3] packet sent is delete_object 1 [java][3] packet recv is delete_object 1 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object [perl][4] destroying Inline::Java::Object::Tie [perl][2] destroying object in java (main::t1212): [perl][3] deleting object main::t1212=HASH(0x4055a518) 8 (t1212) [perl][3] packet sent is delete_object 8 [java][3] packet recv is delete_object 8 [java][3] packet sent is ok undef: [perl][3] packet recv is ok undef: [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object::Private [perl][1] killed by natural death. [perl][1] JVM owner exiting... [perl][1] Sending 'die' message to JVM... [perl][4] portable: GOT_SAFE_SIGNALS for hpux is default '1' [perl][1] Sending 15 signal to JVM... [perl][1] Sending 9 signal to JVM... [perl][1] exiting with 0 [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java [perl][4] destroying Inline::Java::Protocol [perl][4] destroying Inline::Java::Object::Private [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java [perl][4] destroying Inline::Java::Object::Tie [perl][4] script marked as DONE, object destruction not propagated to Java # [java][3] packet recv is die [java][1] received a request to die... # # Inline-Java-0.58~dfsg/bug/Higher.class0000644000000000000000000000113712436307565016332 0ustar rootrootÊþº¾.,       ! "#$bI(II)VCodeLineNumberTablegetHigherValues()I printValues()Ljava/lang/String; SourceFile Higher.java % java/lang/StringBuffer &a = '( ) '* b = +HigherLower(I)V()Vappend,(Ljava/lang/String;)Ljava/lang/StringBuffer;a(I)Ljava/lang/StringBuffer;toString!  + *·*µ± *´¬;#»Y·¶*´¶ ¶*´¶¶ °Inline-Java-0.58~dfsg/bug/test.pl0000644000000000000000000000020112436307565015400 0ustar rootroot#!/usr/bin/perl use strict; use warnings; use lib "bug" ; use PKG1; print PKG1->hello() ; # use PKG2 ; # PKG2::callpkg1() ; Inline-Java-0.58~dfsg/bug/XDB.class0000644000000000000000000000322212436307565015536 0ustar rootrootÊþº¾.a - ./0 12 34 56 1789 -: ;<=> ? @ABC -D E F GHI JKLpi0Lorg/perl/inline/java/InlineJavaPerlInterpreter;xdb+Lorg/perl/inline/java/InlineJavaPerlObject;K(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)VCodeLineNumberTable Exceptionsfinalize()V SourceFileXDB_TestHarness.java #)M NOCreating Perl interpreter...P QRS TU  OK VRCreating XDB instance...java/util/HashMapUser WXPasswordHost finalizing !"Y Z),org/perl/inline/java/InlineJavaPerlExceptionjava/lang/StringBufferPerlException: [\ ]^ _^(org/perl/inline/java/InlineJavaExceptionJavaException: `^XDBjava/lang/Objectjava/lang/SystemoutLjava/io/PrintStream;java/io/PrintStreamprint(Ljava/lang/String;)V.org/perl/inline/java/InlineJavaPerlInterpretercreate2()Lorg/perl/inline/java/InlineJavaPerlInterpreter;printlnput8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;)org/perl/inline/java/InlineJavaPerlObjectDisposeappend,(Ljava/lang/String;)Ljava/lang/StringBuffer; GetString()Ljava/lang/String;toString getMessage   !"#$%O*·²¶¸³²¶² ¶» Y· : +¶ W,¶ W-¶ W²¶±&. :; <?A"C+D4E=FFZN['()%—O²¶²¶§@L²»Y·¶+¶¶¶¶§ L²»Y·¶+¶¶¶¶±1&& _bkdf.k1h2jNl*)%% ³³±& 56+,Inline-Java-0.58~dfsg/bug/Higher.java0000644000000000000000000000056512436307565016152 0ustar rootrootclass Lower { int a; public Lower(int p) { a= p; } public String outPrintValues() { return ("a = "+ this.a); } } public class Higher extends Lower { private int b; public Higher(int p, int q) { super(p); this.b = q; } public int getHigherValues() { return this.b; } public String printValues() { return "a = "+ this.a + "\nb = " + b; } } Inline-Java-0.58~dfsg/bug/roger.pl0000644000000000000000000000201412436307565015543 0ustar rootrootuse warnings; use Inline ( Java => 'DATA', DEBUG => 0, ) ; package UPPER_MODULE::LOWER_MODULE; use Exporter; @ISA = ('Exporter'); @EXPORT_OK = (); use strict; sub new{ my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; bless($self,$class); return($self); }; package main ; my $obj = JavaTestClass->new(); $obj->test(); __DATA__ __Java__ import org.perl.inline.java.* ; class JavaTestClass extends InlineJavaPerlCaller { public JavaTestClass() throws InlineJavaException { System.out.println("JavaTestClass::Constructor"); try { // require("UPPER_MODULE::LOWER_MODULE"); InlineJavaPerlObject po = new InlineJavaPerlObject("UPPER_MODULE::LOWER_MODULE", new Object [] {} ); System.out.println("created InlineJavaPerlObject"); } catch (InlineJavaPerlException pe) { pe.printStackTrace();} catch (InlineJavaException e) { e.printStackTrace(); } } public void test() throws InlineJavaPerlException { System.out.println("JavaTestClass::test"); } } Inline-Java-0.58~dfsg/bug/XDB_TestHarness.class0000644000000000000000000000300212436307565020055 0ustar rootrootÊþº¾.N % &'( )*+,- ./0 %1 2 3 456 78 9 :;<=>pi0Lorg/perl/inline/java/InlineJavaPerlInterpreter;()VCodeLineNumberTable Exceptionsmain([Ljava/lang/String;)V SourceFileXDB_TestHarness.java ? @A(Test Harness for XDB Java <> Perl BridgeB CDPUsage $java XDB_TestHarness dbUserName dbPassword dbHost xdbDbDefinitionFilePathInstantiating XDB...XDB E,org/perl/inline/java/InlineJavaPerlExceptionjava/lang/StringBufferPerlException: FG HI JI(org/perl/inline/java/InlineJavaExceptionJavaException: KIXDB object created. L MDone.XDB_TestHarness)org/perl/inline/java/InlineJavaPerlCallerjava/lang/SystemoutLjava/io/PrintStream;java/io/PrintStreamprintln(Ljava/lang/String;)VK(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Vappend,(Ljava/lang/String;)Ljava/lang/StringBuffer; GetString()Ljava/lang/String;toString getMessage.org/perl/inline/java/InlineJavaPerlInterpreterdestroy! !*·±    !œ²¶*¾Ÿ ²¶±*2L*2M*2N*2::²¶»Y+,-·:§D:²» Y·  ¶ ¶¶ ¶¶§":²» Y· ¶ ¶¶ ¶¶²¶²¶²¶±3AD 3AfV#(+3 A)D"F$c)f&h(…+-“/›0 "³±#$Inline-Java-0.58~dfsg/bug/Higher.jar0000644000000000000000000000240412436307565015777 0ustar rootrootPKÊ#ð¨ MŒ$Ä ÆÄe‘ Ö`!µèO¹ÐD!ÑÄð£Œç¶êâ¢3Ó¹çœ;§ýüzûPGM…†õ¢È„‘U!#§ /xC˜›Bo…Q c›uéi1„ö-Ûr‚F«U¾`zœ!Þ¶l~6¹írçÜì…3àî©5¸æÎ…9œð;Ù(Ó„èØ±l÷×Kåöyo6†¦=ht\:4ÔÎhâ\ñKLŠúcê¢NC;–cHÍ7Mú}] f ö`h(#&T…b«]Ï®"EËøƒÉm o' J2Çcn÷jÆbÄÅÔþå”™ Yô…âŽ|EúàýIìDJ&Ç2á ½UÉ—‰£•ì ¬’{…ôì•ë„1ïHG ¨H’›ðP4æ‰q°òéñ¯%ä™iÂU¤~J›t‡pKï/gèÁ)BÔžBÑ#¾–HO¡>Í Ê¦‰%¬}PK(³I‹{_PK{NAME} = undef; $self->{AGE} = undef; $self->{PEERS} = []; bless($self); # but see below return $self; } ############################################## ## methods to access per-object data ## ## ## ## With args, they set the value. Without ## ## any, they only retrieve it/them. ## ############################################## sub name { my $self = shift; if (@_) { $self->{NAME} = shift } return $self->{NAME}; } sub age { my $self = shift; if (@_) { $self->{AGE} = shift } return $self->{AGE}; } sub peers { my $self = shift; if (@_) { @{ $self->{PEERS} } = @_ } return @{ $self->{PEERS} }; } 1;Inline-Java-0.58~dfsg/bug/test.gaps0000755000000000000000000000374012436307565015735 0ustar rootroot 1 1 466 none - - 468 468 589 none 1 1 1058 1058 919 none 1 1 1978 1978 369 none 1 1 2348 2348 184 none 1 1 2533 2533 1218 none 1 1 3752 3752 261 none 1 1 4014 4014 466 none 1 1 4481 4481 1271 none 1 1 5753 5753 653 none 1 1 6407 6407 39 none 1 1 6447 6447 915 none 1 1 7363 7363 222 none 1 1 7586 7586 699 none 1 1 8286 8286 455 none 1 1 8742 8742 401 none 1 1 9144 9144 73 none 1 1 9218 9218 86 none 1 1 9305 9305 1422 none 1 1 10728 10728 1151 none 1 1 11880 11880 1317 none 1 1 13198 13198 36 none 1 1 13234 13235 225 -5 0 1 13460 13461 940 none 1 1 14401 14402 383 none 1 1 14785 14786 331 none 1 1 15117 15118 2739 none 1 1 17857 17858 3937 none 1 1 21795 21796 23 none 1 1 21819 21820 444 none 1 1 22264 22265 909 none 1 1 23174 23175 539 none 1 1 23714 23715 579 none 1 1 24294 24295 239 none 1 1 24534 24535 144 none 1 1 24679 24680 41 none 1 1 24720 24739 41 -22 0 18 24762 24781 525 none 1 1 25288 25307 746 none 1 1 26035 26054 905 none 1 1 26941 26960 509 none 1 1 27451 27470 1467 none 1 1 Inline-Java-0.58~dfsg/bug/StudyTest.pl0000644000000000000000000000616412436307565016407 0ustar rootroot# Detta är en fil som använder Javaklasser fast med Inline. use strict; use FindBin ; use lib $FindBin::Bin ; use Time::HiRes; #För prestandatest! my $Tstart = [Time::HiRes::gettimeofday]; use Inline ( Java => 'DATA', SHARED_JVM => 1, JNI => 0 ); Inline::Java::reconnect_JVM() ; # Börja programmet! use Person; my $him = new Person; $him->name('Nisse'); print ($him->name . "\n"); for(my $i; $i<1000;$i++) { my $javaVariable = new Program; # Skapa "javakontakt" $javaVariable->work; # Kör skriptet # print ($him->name . "\n"); # print ("Hans polare är: ", join(", ", $him->peers), "\n"); } # Programmet slut! my $Tend = [Time::HiRes::gettimeofday]; my $tot = Time::HiRes::tv_interval($Tstart,$Tend); print('Detta program tog: ' . $tot . ' sekunder att köra.' . "\n"); # Metod som används av Java! sub perlMethods($$@) { # Kör perlmetoder på uppdrag av Java! my($objectName, $methodName,@inParam) = @_; return eval($objectName)->$methodName(@inParam); } __END__ __Java__ import org.perl.inline.java.*; class Program { // Grundvärden PerlObject him = new PerlObject("$him"); // Konstruktor public Program() throws InlineJavaException { } // Metod som gör något... public void work () { // Här skrivs skriptet i Java! String T = (String)him.method("name"); if (T.equals("Nisse") ) //him.method("name","Knut-Göran"); him.method("name", new Object[] {"Knut-Göran" } ); else him.method("name","Kurt-Arne"); him.method("peers", new Object[] {"Tuve", "Bernt-Arne", "Nyman"} ); // Här slutar skriptet som skrivits i Java! } } ; // Metodklass som används av Java! class PerlObject extends InlineJavaPerlCaller { String perlName; // Konstruktor public PerlObject(String perlName) throws InlineJavaException { this.perlName = perlName; } // Metod för att kalla på Perlobjektens egna metoder. public Object method (String methodName) { try { Object ret = CallPerl( "main", "perlMethods", new Object[] {perlName, methodName} ); return ret == null ? new Integer(1) : ret; } catch (Exception e) { return new Integer(-1); } } public Object method (String methodName, Object arg) { try { Object ret = CallPerl( "main", "perlMethods", new Object[] {perlName, methodName, arg} ); return ret == null ? new Integer(1) : ret; } catch (Exception e) { return new Integer(-1); } } public Object method (String methodName, Object arg[]) { try { Object[] perlArg = new Object [arg.length+2]; perlArg[0] = perlName; perlArg[1] = methodName; for (int i = 0; i < arg.length; i++) { perlArg[i+2] = arg[i]; } Object ret = CallPerl( "main", "perlMethods", perlArg ); return ret == null ? new Integer(1) : ret; } catch (Exception e) { return new Integer(-1); } } } ; Inline-Java-0.58~dfsg/bug/toto.pl0000755000000000000000000000033712436307565015423 0ustar rootrootuse Inline ( Java => 'DATA', STUDY => ['java.util.HashMap'], AUTOSTUDY => 1, ) ; my $o = test->f() ; print $o->[0] ; __END__ __Java__ class test { static public Object f(){ return new String [] {"allo"} ; } } Inline-Java-0.58~dfsg/bug/Program.java0000644000000000000000000000120712436307565016345 0ustar rootrootimport org.perl.inline.java.*; public class Program { // Grundvärden PerlObject him = new PerlObject("$him"); // Konstruktor public Program() throws InlineJavaException { } // Metod som gör något... public void work () { // Här skrivs skriptet i Java! String T = (String)him.method("name"); if (T.equals("Nisse") ) //him.method("name","Knut-Göran"); him.method("name", new Object[] {"Knut-Göran" } ); else him.method("name","Kurt-Arne"); him.method("peers", new Object[] {"Tuve", "Bernt-Arne", "Nyman"} ); // Här slutar skriptet som skrivits i Java! } } Inline-Java-0.58~dfsg/bug/Hi3.pm0000644000000000000000000000042512436307565015055 0ustar rootrootpackage Hi3; use strict; use warnings; BEGIN { $ENV{CLASSPATH} .= "./Higher.jar"; } use Inline Java => 'STUDY', STUDY => ['Higher']; sub new { my $class = shift; # print "class name is $class \n"; my $a = shift; my $b = shift; return Hi3::Higher->Higher($a, $b); } 1; Inline-Java-0.58~dfsg/bug/Lower.class0000644000000000000000000000076612436307565016223 0ustar rootrootÊþº¾.#      aI(I)VCodeLineNumberTableoutPrintValues()Ljava/lang/String; SourceFile Higher.java  java/lang/StringBuffera =  ! "Lowerjava/lang/Object()Vappend,(Ljava/lang/String;)Ljava/lang/StringBuffer;(I)Ljava/lang/StringBuffer;toString   * *·*µ± /»Y·¶*´¶¶° Inline-Java-0.58~dfsg/bug/PerlObject.java0000644000000000000000000000257412436307565016777 0ustar rootrootimport org.perl.inline.java.*; // Metodklass som används av Java! public class PerlObject extends InlineJavaPerlCaller { String perlName; // Konstruktor public PerlObject(String perlName) throws InlineJavaException { this.perlName = perlName; } // Metod för att kalla på Perlobjektens egna metoder. public Object method (String methodName) { try { Object ret = CallPerl( "main", "perlMethods", new Object[] {perlName, methodName} ); return ret == null ? new Integer(1) : ret; } catch (Exception e) { return new Integer(-1); } } public Object method (String methodName, Object arg) { try { Object ret = CallPerl( "main", "perlMethods", new Object[] {perlName, methodName, arg} ); return ret == null ? new Integer(1) : ret; } catch (Exception e) { return new Integer(-1); } } public Object method (String methodName, Object arg[]) { try { Object[] perlArg = new Object [arg.length+2]; perlArg[0] = perlName; perlArg[1] = methodName; for (int i = 0; i < arg.length; i++) { perlArg[i+2] = arg[i]; } Object ret = CallPerl( "main", "perlMethods", perlArg ); return ret == null ? new Integer(1) : ret; } catch (Exception e) { return new Integer(-1); } } } Inline-Java-0.58~dfsg/bug/Foo.java0000644000000000000000000000166312436307565015467 0ustar rootrootimport javax.xml.parsers.*; import org.apache.xerces.jaxp.SAXParserFactoryImpl; public class Foo { // This method works! public void test_a() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException { javax.xml.parsers.SAXParserFactory si = org.apache.xerces.jaxp.SAXParserFactoryImpl.newInstance() ; SAXParser y = si.newSAXParser() ; } public void test_b() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException { System.out.println("!!!" + getClass().getClassLoader() + "!!!") ; System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl"); SAXParser x = javax.xml.parsers.SAXParserFactory.newInstance().newSAXParser(); } static public void main(String args[]){ try { Foo f = new Foo() ; f.test_a() ; f.test_b() ; } catch (java.lang.Exception e){ e.printStackTrace() ; } } } Inline-Java-0.58~dfsg/bug/gcj_test.java0000644000000000000000000000221012436307565016533 0ustar rootrootimport java.lang.reflect.* ; public class gcj_test { public static void main(String[] args){ try { obj o = new obj() ; Class c = Class.forName("obj") ; Method methods[] = c.getMethods() ; Field fields[] = c.getFields() ; Method m = null ; Field f = null ; for (int i = 0 ; i < methods.length ; i++){ if (methods[i].getName().equals("f")){ m = methods[i] ; break ; } } for (int i = 0 ; i < fields.length ; i++){ if (fields[i].getName().equals("s")){ f = fields[i] ; break ; } } Object a[] = {"test"} ; m.invoke(o, a) ; f.set(o, "test") ; System.out.println("s set to 'test'") ; System.out.println("s = " + (String)f.get(o)) ; a[0] = null ; m.invoke(o, a) ; f.set(o, null) ; System.out.println("s set to null") ; System.out.println("s = " + (String)f.get(o)) ; f.get(o) ; } catch (Exception e){ System.err.println(e.getClass().getName() + ": " + e.getMessage()) ; System.exit(1) ; } System.out.println("Done") ; } } class obj { public String s = null ; public void f(String s){ System.out.println("f invoked with param " + s) ; } }Inline-Java-0.58~dfsg/bug/croak_bug.pl0000644000000000000000000002635212436307565016374 0ustar rootroot#!/usr/local/perl56/bin/perl -w use strict ; package class ; @class::ISA = qw(Inline::Java::Object) ; use Carp ; $SIG{__DIE__} = sub { $Inline::Java::DONE = 1 ; die @_ ; } ; sub new { my $class = shift ; my @args = @_ ; my $o = $Inline::Java::INLINE->{'$modfname'} ; my $ret = undef ; eval { $ret = $class->__new() ; } ; croak $@ if $@ ; return $ret ; } package Inline::Java::Object ; @Inline::Java::Object::ISA = qw(Inline::Java::Object::Tie) ; use strict ; $Inline::Java::Object::VERSION = '0.10' ; use Carp ; # Here we store as keys the knots and as values our blessed private objects my $PRIVATES = {} ; # Bogus constructor. We fall here if no public constructor is defined # in the Java class. sub new { my $class = shift ; croak "No public constructor defined for class $class" ; } # Constructor. Here we create a new object that will be linked # to a real Java object. sub __new { my $class = shift ; my $java_class = shift ; my $inline = shift ; my $objid = shift ; my $proto = shift ; my $args = shift ; my %this = () ; my $knot = tie %this, $class ; my $this = bless(\%this, $class) ; my $priv = Inline::Java::Object::Private->new($java_class, $inline) ; $PRIVATES->{$knot} = $priv ; croak "frog" ; } sub __get_private { my $this = shift ; my $knot = tied(%{$this}) || $this ; my $priv = $PRIVATES->{$knot} ; if (! defined($priv)){ croak "Unknown Java object reference" ; } return $priv ; } # Here an object in destroyed. this function seems to be called twice # for each object. I think it's because the $this reference is both blessed # and tied to the same package. sub DESTROY { my $this = shift ; print STDERR "DESTROY\n" ; if (! $Inline::Java::DONE){ if (! $this->__get_private()->{deleted}){ $this->__get_private()->{deleted} = 1 ; eval { $this->__get_private()->{proto}->DeleteJavaObject($this) ; } ; croak "In method DESTROY of class $this->__get_private()->{class}: $@" if $@ ; } else{ # Inline::Java::debug("Object destructor called more than once for $this !") ; } } untie %{$this} ; } ######################## Hash Methods ######################## package Inline::Java::Object::Tie ; @Inline::Java::Object::Tie::ISA = qw(Tie::StdHash) ; use Tie::Hash ; use Carp ; sub TIEHASH { my $class = shift ; return $class->SUPER::TIEHASH(@_) ; } sub STORE { my $this = shift ; my $key = shift ; my $value = shift ; return $this->__set_member($key, $value) ; } sub FETCH { my $this = shift ; my $key = shift ; return $this->__get_member($key) ; } sub FIRSTKEY { my $this = shift ; return $this->SUPER::FIRSTKEY() ; } sub NEXTKEY { my $this = shift ; return $this->SUPER::NEXTKEY() ; } sub EXISTS { my $this = shift ; my $key = shift ; my $inline = $Inline::Java::INLINE->{$this->__get_private()->{module}} ; my $fields = $inline->get_fields($this->__get_private()->{java_class}) ; if ($fields->{$key}){ return 1 ; } return 0 ; } sub DELETE { my $this = shift ; my $key = shift ; croak "Operation DELETE not supported on Java object" ; } sub CLEAR { my $this = shift ; croak "Operation CLEAR not supported on Java object" ; } sub DESTROY { my $this = shift ; $PRIVATES->{$this} = undef ; } ######################## Private Object ######################## package Inline::Java::Object::Private ; sub new { my $class = shift ; my $java_class = shift ; my $inline = shift ; my $this = {} ; $this->{class} = $class ; $this->{java_class} = $java_class ; $this->{module} = $inline->{modfname} ; $this->{known_to_perl} = 1 ; $this->{proto} = new Inline::Java::Protocol($this, $inline) ; bless($this, $class) ; return $this ; } package Inline::Java::Protocol ; use strict ; $Inline::Java::Protocol::VERSION = '0.10' ; use Carp ; sub new { my $class = shift ; my $obj = shift ; my $inline = shift ; my $this = {} ; $this->{obj_priv} = $obj || {} ; $this->{module} = $inline->{modfname} ; bless($this, $class) ; return $this ; } sub ISA { my $this = shift ; my $proto = shift ; Inline::Java::debug("checking if $this is a $proto") ; my $id = $this->{obj_priv}->{id} ; my $class = $this->{obj_priv}->{java_class} ; my $data = join(" ", "isa", $id, Inline::Java::Class::ValidateClass($class), Inline::Java::Class::ValidateClass($proto), ) ; Inline::Java::debug(" packet sent is $data") ; return $this->Send($data, 1) ; } # Called to create a Java object sub CreateJavaObject { my $this = shift ; my $class = shift ; my $proto = shift ; my $args = shift ; Inline::Java::debug("creating object new $class" . $this->CreateSignature($args)) ; my $data = join(" ", "create_object", Inline::Java::Class::ValidateClass($class), $this->CreateSignature($proto, ","), $this->ValidateArgs($args), ) ; Inline::Java::debug(" packet sent is $data") ; return $this->Send($data, 1) ; } # Called to call a static Java method sub CallStaticJavaMethod { my $this = shift ; my $class = shift ; my $method = shift ; my $proto = shift ; my $args = shift ; Inline::Java::debug("calling $class.$method" . $this->CreateSignature($args)) ; my $data = join(" ", "call_static_method", Inline::Java::Class::ValidateClass($class), $this->ValidateMethod($method), $this->CreateSignature($proto, ","), $this->ValidateArgs($args), ) ; Inline::Java::debug(" packet sent is $data") ; return $this->Send($data) ; } # Calls a regular Java method. sub CallJavaMethod { my $this = shift ; my $method = shift ; my $proto = shift ; my $args = shift ; my $id = $this->{obj_priv}->{id} ; my $class = $this->{obj_priv}->{java_class} ; Inline::Java::debug("calling object($id).$method" . $this->CreateSignature($args)) ; my $data = join(" ", "call_method", $id, Inline::Java::Class::ValidateClass($class), $this->ValidateMethod($method), $this->CreateSignature($proto, ","), $this->ValidateArgs($args), ) ; Inline::Java::debug(" packet sent is $data") ; return $this->Send($data) ; } # Sets a member variable. sub SetJavaMember { my $this = shift ; my $member = shift ; my $proto = shift ; my $arg = shift ; my $id = $this->{obj_priv}->{id} ; my $class = $this->{obj_priv}->{java_class} ; Inline::Java::debug("setting object($id)->{$member} = $arg->[0]") ; my $data = join(" ", "set_member", $id, Inline::Java::Class::ValidateClass($class), $this->ValidateMember($member), Inline::Java::Class::ValidateClass($proto->[0]), $this->ValidateArgs($arg), ) ; Inline::Java::debug(" packet sent is $data") ; return $this->Send($data) ; } # Gets a member variable. sub GetJavaMember { my $this = shift ; my $member = shift ; my $proto = shift ; my $id = $this->{obj_priv}->{id} ; my $class = $this->{obj_priv}->{java_class} ; Inline::Java::debug("getting object($id)->{$member}") ; my $data = join(" ", "get_member", $id, Inline::Java::Class::ValidateClass($class), $this->ValidateMember($member), Inline::Java::Class::ValidateClass($proto->[0]), "undef:", ) ; Inline::Java::debug(" packet sent is $data") ; return $this->Send($data) ; } # Deletes a Java object sub DeleteJavaObject { my $this = shift ; my $obj = shift ; if (defined($this->{obj_priv}->{id})){ my $id = $this->{obj_priv}->{id} ; my $class = $this->{obj_priv}->{java_class} ; Inline::Java::debug("deleting object $obj $id ($class)") ; my $data = join(" ", "delete_object", $id, ) ; Inline::Java::debug(" packet sent is $data") ; $this->Send($data) ; } } # This method makes sure that the method we are asking for # has the correct form for a Java method. sub ValidateMethod { my $this = shift ; my $method = shift ; if ($method !~ /^(\w+)$/){ croak "Invalid Java method name $method" ; } return $method ; } # This method makes sure that the member we are asking for # has the correct form for a Java member. sub ValidateMember { my $this = shift ; my $member = shift ; if ($member !~ /^(\w+)$/){ croak "Invalid Java member name $member" ; } return $member ; } # Validates the arguments to be used in a method call. sub ValidateArgs { my $this = shift ; my $args = shift ; my @ret = () ; foreach my $arg (@{$args}){ if (! defined($arg)){ push @ret, "undef:" ; } elsif (ref($arg)){ if ((! UNIVERSAL::isa($arg, "Inline::Java::Object"))&&(! UNIVERSAL::isa($arg, "Inline::Java::Array"))){ croak "A Java method or member can only have Java objects, Java arrays or scalars as arguments" ; } if (UNIVERSAL::isa($arg, "Inline::Java::Array")){ $arg = $arg->__get_object() ; } my $class = $arg->__get_private()->{java_class} ; my $id = $arg->__get_private()->{id} ; push @ret, "object:$class:$id" ; } else{ push @ret, "scalar:" . join(".", unpack("C*", $arg)) ; } } return @ret ; } sub CreateSignature { my $this = shift ; my $proto = shift ; my $del = shift || ", " ; return "(" . join($del, @{$proto}) . ")" ; } # This actually sends the request to the Java program. It also takes # care of registering the returned object (if any) sub Send { my $this = shift ; my $data = shift ; my $const = shift ; my $resp = undef ; my $inline = $Inline::Java::INLINE->{$this->{module}} ; if (! $inline->{Java}->{JNI}){ my $sock = $inline->{Java}->{socket} ; print $sock $data . "\n" or croak "Can't send packet over socket: $!" ; $resp = <$sock> ; } else{ $resp = $inline->{Java}->{JNI}->process_command($data) ; } Inline::Java::debug(" packet recv is $resp") ; if (! $resp){ croak "Can't receive packet over socket: $!" ; } elsif ($resp =~ /^error scalar:([\d.]*)$/){ my $msg = pack("C*", split(/\./, $1)) ; Inline::Java::debug(" packet recv error: $msg") ; croak $msg ; } elsif ($resp =~ /^ok scalar:([\d.]*)$/){ return pack("C*", split(/\./, $1)) ; } elsif ($resp =~ /^ok undef:$/){ return undef ; } elsif ($resp =~ /^ok object:(\d+):(.*)$/){ # Create the Perl object wrapper and return it. my $id = $1 ; my $class = $2 ; if ($const){ $this->{obj_priv}->{java_class} = $class ; $this->{obj_priv}->{id} = $id ; return undef ; } else{ my $perl_class = $class ; $perl_class =~ s/[.\$]/::/g ; my $pkg = $inline->{pkg} ; $perl_class = $pkg . "::" . $perl_class ; Inline::Java::debug($perl_class) ; my $known = 0 ; { no strict 'refs' ; if (defined(${$perl_class . "::" . "EXISTS"})){ Inline::Java::debug(" returned class exists!") ; $known = 1 ; } else{ Inline::Java::debug(" returned class doesn't exist!") ; } } my $obj = undef ; if ($known){ Inline::Java::debug("creating stub for known object...") ; $obj = $perl_class->__new($class, $inline, $id) ; Inline::Java::debug("stub created ($obj)...") ; } else{ Inline::Java::debug("creating stub for unknown object...") ; $obj = Inline::Java::Object->__new($class, $inline, $id) ; Inline::Java::debug("stub created ($obj)...") ; $obj->__get_private()->{known_to_perl} = 0 ; } Inline::Java::debug("checking if stub is array...") ; if (Inline::Java::Class::ClassIsArray($class)){ Inline::Java::debug("creating array object...") ; $obj = new Inline::Java::Array($obj) ; Inline::Java::debug("array object created...") ; } Inline::Java::debug("returning stub...") ; return $obj ; } } } package main ; my $o = new class() ; Inline-Java-0.58~dfsg/bug/PKG1.pm0000644000000000000000000000042312436307565015132 0ustar rootrootpackage PKG1; use strict; use warnings; use Inline Java => "DATA"; sub new { my $class = shift; return PKG1::PKG1->new(@_); } 1; __DATA__ __Java__ import java.util.*; import java.io.*; public class PKG1 { public static String hello(){ return "hello" ; } } Inline-Java-0.58~dfsg/bug/roger2.pl0000644000000000000000000000174412436307565015636 0ustar rootroot#!/usr/bin/perl -w use warnings; use Inline ( Java => 'DATA', DEBUG => 0, ) ; my $obj = JavaTestClass->new(); $obj->test(); #------------------------------------------------------------------------ package MODULE; use Exporter; @ISA = ('Exporter'); @EXPORT_OK = (); use strict; sub new{ my $proto = shift; my $class = ref($proto) || $proto; my $self = {}; bless($self,$class); return($self); }; 1; package main ; __DATA__ __Java__ import org.perl.inline.java.* ; class JavaTestClass extends InlineJavaPerlCaller { public JavaTestClass() throws InlineJavaException { System.out.println("JavaTestClass::Constructor"); } public void test() throws InlineJavaPerlException { System.out.println("JavaTestClass::test"); try { // require("MODULE"); InlineJavaPerlObject po = new InlineJavaPerlObject("MODULE", null ); System.out.println("created InlineJavaPerlObject"); } catch (InlineJavaException e) { e.printStackTrace(); } } } Inline-Java-0.58~dfsg/bug/XDB_TestHarness.java0000644000000000000000000001024012436307565017673 0ustar rootrootimport java.util.*; import org.perl.inline.java.*; public class XDB_TestHarness extends InlineJavaPerlCaller { static private InlineJavaPerlInterpreter pi = null; public XDB_TestHarness() throws InlineJavaException { } public static void main(String argv[]) throws InlineJavaPerlException, InlineJavaException { System.out.println("Test Harness for XDB Java <> Perl Bridge"); if(argv.length != 4) { System.out.println("Usage\n$java XDB_TestHarness dbUserName dbPassword dbHost xdbDbDefinitionFilePath"); return; } String sDbUser = argv[0]; String sDbPassword = argv[1]; String sDbHost = argv[2]; String sDbDefinitionFilePath = argv[3]; XDB xdb = null; System.out.println("Instantiating XDB..."); try { xdb = new XDB(sDbUser, sDbPassword, sDbHost, sDbDefinitionFilePath); } catch(InlineJavaPerlException pe) { System.out.println("PerlException: " + pe.GetString()); } catch(InlineJavaException je) { System.out.println("JavaException: " + je.getMessage()); } System.out.println("XDB object created."); pi.destroy(); System.out.println("Done."); } }; class XDB { static private InlineJavaPerlInterpreter pi = null; static private InlineJavaPerlObject xdb = null; public XDB(String sDbUser, String sDbPassword, String sDbHost, String sDbDefinitionFilePath) throws InlineJavaPerlException, InlineJavaException { System.out.print("Creating Perl interpreter..."); pi = InlineJavaPerlInterpreter.create(); // this bit won't work unless you've got a module called "XDB" installed in @INC somewhere // pi.require_module("XDB"); System.out.println("OK"); System.out.print("Creating XDB instance..."); HashMap hshDbConnection = new HashMap(); hshDbConnection.put("User", sDbUser); hshDbConnection.put("Password", sDbPassword); hshDbConnection.put("Host", sDbHost); /* // this bit won't work unless you've got a module called "XDB" installed in @INC somewhere xdb = (InlineJavaPerlObject) pi.CallPerlSub("XDB::new", new Object [] {"XDB", hshDbConnection }, InlineJavaPerlObject.class); System.out.println("OK"); System.out.print("Initializing XDB instance..."); Integer ok = (Integer) xdb.InvokeMethod("DataDefinition", new Object [] { sDbDefinitionFilePath }, Integer.class); if(ok.intValue() == 0) { String sError = (String) xdb.InvokeMethod("LastError", new Object [] { sDbDefinitionFilePath }, String.class); throw new InlineJavaPerlException("Error setting DataDefinition property: " + sError); } */ System.out.println("OK"); } protected void finalize() { System.out.println("finalizing"); try { xdb.Dispose(); } catch(InlineJavaPerlException pe) { System.out.println("PerlException: " + pe.GetString()); } catch(InlineJavaException je) { System.out.println("JavaException: " + je.getMessage()); } } }; Inline-Java-0.58~dfsg/bug/nadim.pl0000755000000000000000000000234712436307565015531 0ustar rootroot#!/usr/bin/perl package PBS ; use Data::Dumper ; sub GetConfig { print "do GetConfig(@_)\n" ; return 1 ; } sub AddRule { print "do AddRule( " . Dumper(\@_) . ")\n" ; } package PBS::Java ; my $java_code = <bind( Java => <run() ; Inline-Java-0.58~dfsg/bug/toto.java0000644000000000000000000000041512436307565015723 0ustar rootrootimport java.util.* ; class toto { static public void main(String args[]){ HashMap h = new HashMap() ; h.put("key", "value") ; Object valArr[] = h.entrySet().toArray() ; for (int i = 0 ; i < valArr.length ; i++){ System.out.println(valArr[i]) ; } } } Inline-Java-0.58~dfsg/README0000644000000000000000000000610712436307565014202 0ustar rootrootINTRODUCTION: Inline::Java - Write Perl classes in Java. Inline::Java lets you write Perl classes in Java. Example: use Inline Java => <<'END'; class JAxH { public JAxH(String x){ System.out.println("Just Another " + x + " Hacker") ; } } END new JAxH('Inline') ; When run, this complete program prints: Just Another Inline Hacker ------------------------------------------------------------------------------- JNI (JAVA NATIVE INTERFACE) EXTENSION: Inline::Java now provides a JNI extension that allows you to load the Java virtual machine as shared object instead of running it as a separate process. See README.JNI for more information on building the JNI extension. ------------------------------------------------------------------------------- INSTALLATION: - This module requires Inline version 0.44 or higher to be installed. - It also requires a version of the Java SDK 1.2 or higher to be installed. You can get the latest Java SDK from Sun Microsystems at http://java.sun.com. Follow the provided instructions in order to install the Java SDK properly. To install Inline::Java do this: % perl Makefile.PL J2SDK=/your/java/dir (see Note 1) % make (see Note 2) % make test (see Note 3, 4) % make install You have to 'make install' before you can run it successfully. Note 1: Under Win95/98/Me, you may need to do 'cd ..' to get back to the your original directory after the command has completed. Also, you may set either the JAVA_HOME or the PERL_INLINE_JAVA_J2SDK environment variable to /your/java/dir instead of using the J2SDK Makefile.PL parameter. Note 2: Use nmake on Win32. Note 3: If you have built the JNI extension and want the test suite to use it, you will need to set the PERL_INLINE_JAVA_JNI environment variable to 1 BEFORE running 'make test'. Note 4: When testing Inline::Java, it's always a good idea to run 'make test' twice. The first time you test the building and loading of a module, the second time you test loading of an already built module. ------------------------------------------------------------------------------- FEATURES FOR THIS VERSION: Inline::Java version 0.52 is a minor upgrade that includes: - Fixed JNI on cygwin (many thanks to Eric Rybski for the patch) - Improved installation. 'make java' is now performed automatically. - Fixed problems with disappearing exceptions by localizing $@. - Other minor bug fixes. See CHANGES for a full change list. ------------------------------------------------------------------------------- INFORMATION: = For more information on Inline::Java, see 'perldoc Inline::Java'. = For information about Inline, see 'perldoc Inline'. = For information on using Java, visit http://java.sun.org. Inline::Java's mailing list is inline@perl.org. To subscribe, send an email to inline-subscribe@perl.org. Please send questions and comments to Patrick LeBoutillier . Copyright (c) 2001-2005, Patrick LeBoutillier. All Rights Reserved. Inline-Java-0.58~dfsg/Java.pod0000644000000000000000000007546712436307565014726 0ustar rootroot=head1 NAME Inline::Java - Write Perl classes in Java. =head1 SYNOPSIS =for comment use Inline Java => <<'END_OF_JAVA_CODE' ; class Pod_alu { public Pod_alu(){ } public int add(int i, int j){ return i + j ; } public int subtract(int i, int j){ return i - j ; } } END_OF_JAVA_CODE my $alu = new Pod_alu() ; print($alu->add(9, 16) . "\n") ; # prints 25 print($alu->subtract(9, 16) . "\n") ; # prints -7 =for comment =head1 DESCRIPTION The C module allows you to put Java source code directly "inline" in a Perl script or module. A Java compiler is launched and the Java code is compiled. Then Perl asks the Java classes what public methods have been defined. These classes and methods are available to the Perl program as if they had been written in Perl. The process of interrogating the Java classes for public methods occurs the first time you run your Java code. The namespace is cached, and subsequent calls use the cached version. Z<> =head1 USING THE Inline::Java MODULE C is driven by fundamentally the same idea as other C language modules, like C or C. Because Java is both compiled and interpreted, the method of getting your code is different, but overall, using C is very similar to any other C language module. This section will explain the different ways to C Inline::Java. For more details on C, see 'perldoc Inline'. B The most basic form for using C is: use Inline Java => 'Java source code' ; Of course, you can use Perl's "here document" style of quoting to make the code slightly easier to read: use Inline Java => <<'END'; Java source code goes here. END The source code can also be specified as a filename, a subroutine reference (the subroutine should return source code), or an array reference (the array contains lines of source code). This information is detailed in 'perldoc Inline'. In order for C to function properly, it needs to know where to find a Java 2 SDK on your machine. This is done using one of the following techniques: =over 4 =item 1 Set the J2SDK configuration option to the correct directory =item 2 Set the PERL_INLINE_JAVA_J2SDK environment variable to the correct directory =back If none of these are specified, C will use the Java 2 SDK that was specified at install time (see below). =head1 DEFAULT JAVA 2 SDK When C was installed, the path to the Java 2 SDK that was used was stored in a file called default_j2sdk.pl that resides within the C module. You can obtain this path by using the following command: % perl -MInline::Java=j2sdk If you wish to permanently change the default Java 2 SDK that is used by C, edit this file and change the value found there. If you wish use a different Java 2 SDK temporarily, see the J2SDK configuration option described below. Additionally, you can use the following command to get the list of directories that you should put in you shared library path when using the JNI extension: % perl -MInline::Java=so_dirs =head1 CONFIGURATION OPTIONS There are a number of configuration options that dictate the behavior of C: =over 4 =item j2sdk Specifies the path to your Java 2 SDK. Ex: j2sdk => '/my/java/2/sdk/path' Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item port Specifies the port number for the server. Default is -1 (next available port number), default for SHARED_JVM mode is 7891. Ex: port => 4567 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item host Specifies the host on which the JVM server is running. This option really only makes sense in SHARED_JVM mode when START_JVM is disabled. Ex: host => 'jvm.server.com' Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item bind Specifies the IP address on which the JVM server will be listening. By default the JVM server listens for connections on 'localhost' only. Ex: bind => '192.168.1.1' Ex: bind => '0.0.0.0' Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item startup_delay Specifies the maximum number of seconds that the Perl script will try to connect to the Java server. In other words this is the delay that Perl gives to the Java server to start. Default is 15 seconds. Ex: startup_delay => 20 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item classpath Adds the specified CLASSPATH. This CLASSPATH will only be available through the user classloader. To set the CLASSPATH globally (which is most probably what you want to do anyways), use the CLASSPATH environment variable. Ex: classpath => '/my/other/java/classses' =item jni Toggles the execution mode. The default is to use the client/server mode. To use the JNI extension (you must have built it at install time though; see README and README.JNI for more information), set JNI to 1. Ex: jni => 1 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item extra_java_args, extra_javac_args Specify extra command line parameters to be passed to, respectively, the JVM and the Java compiler. Use with caution as some options may alter normal C behavior. Ex: extra_java_args => '-Xmx96m' Note: extra_java_args only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item embedded_jni Same as jni, except C expects the JVM to already be loaded and to have loaded the Perl interpreter that is running the script. This is an advanced feature that should only be need in very specific circumstances. Ex: embedded_jni => 1 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. Also, the embedded_jni option automatically sets the JNI option. =item shared_jvm This mode enables multiple processes to share the same JVM. It was created mainly in order to be able to use C under mod_perl. Ex: shared_jvm => 1 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item start_jvm When used with shared_jvm, tells C whether to start a new JVM (this is the default) or to expect that one is already running. This option is useful in combination with the command line interface described in the BUGS AND DEFICIENCIES section. Default is 1. Ex: start_jvm => 0 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item private In shared_jvm mode, makes every connection to the JVM use a different classloader so that each connection is isolated from the others. Ex: private => 1 Note: This configuration option only has an effect on the first 'use Inline Java' call inside a Perl script, since all other calls make use of the same JVM. =item debug Enables debugging info. Debugging now uses levels (1 through 5) that (loosely) follow these definitions: 1 = Major program steps 2 = Object creation/destruction 3 = Method/member accesses + packet dumps 4 = Everything else 5 = Data structure dumps Ex: debug => 2 =item debugger Starts jdb (the Java debugger) instead of the regular Java JVM. This option will also cause the Java code to be compiled using the '-g' switch for extra debugging information. EXTRA_JAVA_ARGS can be used use to pass extra options to the debugger. Ex: debugger => 1 =item warn_method_select Throws a warning when C has to 'choose' between different method signatures. The warning states the possible choices and the signature chosen. Ex: warn_method_select => 1 =item study Takes an array of Java classes that you wish to have C learn about so that you can use them inside Perl. Ex: study => ['java.lang.HashMap', 'my.class'] =item autostudy Makes C automatically study unknown classes when it encounters them. Ex: autostudy => 1 =item package Forces C to bind the Java code under the specified package instead of under the current (caller) package. Ex: package => 'main' =item native_doubles Normally, C stringifies floating point numbers when passing them between Perl and Java. In certain cases, this can lead to loss of precision. When native_doubles is set, C will send the actual double bytes in order to preserve precision. Note: This applies only to doubles, not floats. Note: This option may not be portable and may not work properly on some platforms. Ex: native_doubles => 1 =back =head1 ENVIRONMENT VARIABLES Every configuration option listed above, with the exception of STUDY, can be specified using an environment variable named using the following convention: PERL_INLINE_JAVA_