[libinline-java-perl] 339/398: ok

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.55
in repository libinline-java-perl.

commit a5400b6d5022ef6aaffe46049c142909678b00e8
Author: patrick_leb <>
Date:   Sat Feb 19 01:47:40 2005 +0000

    ok
---
 CHANGES                                            |  4 ++
 Java.pm                                            |  5 +-
 Java/Array.pm                                      |  2 +-
 Java/Callback.pm                                   |  2 +-
 Java/Class.pm                                      | 22 +++----
 Java/JNI.pm                                        |  2 +-
 Java/JVM.pm                                        |  2 +-
 Java/Makefile.PL                                   |  4 +-
 Java/Object.pm                                     |  2 +-
 Java/PerlNatives/PerlNatives.pm                    |  2 +-
 Java/Portable.pm                                   |  4 +-
 Java/Protocol.pm                                   |  2 +-
 Java/Server.pm                                     |  2 +-
 .../inline/java/InlineJavaUserClassLoader.java     |  4 +-
 t/02_primitives.t                                  | 72 +++++++++++++---------
 15 files changed, 78 insertions(+), 53 deletions(-)

diff --git a/CHANGES b/CHANGES
index e131179..dc4b030 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,10 @@ Revision history for Perl extension Inline::Java
 0.50  Mon Jan 31 20:14:43 EST 2005
     - Added HOST configuration option to access JVM server remotely
     - Fixed bug with paths in Cygwin
+    - Fixed bug with regexp that was badly interpreted under the debugger
+    - Extended InlineJavaClassLoader from current thread ClassLoader to enable it to work
+      properly under Tomcat
+    - Fixed bug with longs over 32 bits in length
     - Other minor bug fixes
 
 0.49  
diff --git a/Java.pm b/Java.pm
index 36e0efe..2527f2b 100644
--- a/Java.pm
+++ b/Java.pm
@@ -8,7 +8,7 @@ package Inline::Java ;
 use strict ;
 require 5.006 ;
 
-$Inline::Java::VERSION = '0.50' ;
+$Inline::Java::VERSION = '0.49_90' ;
 
 
 # DEBUG is set via the DEBUG config
@@ -633,7 +633,8 @@ sub load_jdat {
 	my $data_idx = scalar(@{$o->{ILSM}->{data}}) ;
 	push @{$o->{ILSM}->{data}}, $d ;
 	
-	my $re = '[\w.\$\[;]+' ;
+	# my $re = '[\w.\$\[;]+' ;
+	my $re = '.+' ;
 
 	my $idx = 0 ;
 	my $current_class = undef ;
diff --git a/Java/Array.pm b/Java/Array.pm
index 32c458b..d374fc8 100644
--- a/Java/Array.pm
+++ b/Java/Array.pm
@@ -4,7 +4,7 @@ package Inline::Java::Array ;
 use strict ;
 use Carp ;
 
-$Inline::Java::Array::VERSION = '0.50' ;
+$Inline::Java::Array::VERSION = '0.49_90' ;
 
 # Here we store as keys the knots and as values our blessed objects
 my $OBJECTS = {} ;
diff --git a/Java/Callback.pm b/Java/Callback.pm
index b96e1d9..48febb7 100644
--- a/Java/Callback.pm
+++ b/Java/Callback.pm
@@ -3,7 +3,7 @@ package Inline::Java::Callback ;
 use strict ;
 use Carp ;
 
-$Inline::Java::Callback::VERSION = '0.50' ;
+$Inline::Java::Callback::VERSION = '0.49_90' ;
 
 $Inline::Java::Callback::OBJECT_HOOK = undef ;
 
diff --git a/Java/Class.pm b/Java/Class.pm
index e3ad4eb..c667d5c 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -3,10 +3,12 @@ package Inline::Java::Class ;
 use strict ;
 use Carp ;
 
-$Inline::Java::Class::VERSION = '0.50' ;
+$Inline::Java::Class::VERSION = '0.49_90' ;
 
 $Inline::Java::Class::MAX_SCORE = 10 ;
 
+# There is no use supporting exponent notation for integer types since
+# Jave does not support it without casting.
 my $INT_RE = '^[+-]?\d+$' ;
 my $FLOAT_RE = '^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$' ;
 
@@ -28,10 +30,8 @@ my $RANGE = {
 	},
 	'java.lang.Long' => {
 		REGEXP => $INT_RE,
-		MAX => 2147483647,
-		MIN => -2147483648,
-		# MAX => 9223372036854775807,
-		# MIN => -9223372036854775808,
+		MAX => 9223372036854775807,
+		MIN => -9223372036854775808,
 	},
 	'java.lang.Float' => {
 		REGEXP => $FLOAT_RE,
@@ -42,17 +42,15 @@ my $RANGE = {
 	},
 	'java.lang.Double' => {
 		REGEXP => $FLOAT_RE,
-		MAX => 3.4028235e38,
-		MIN => -3.4028235e38,
-		# MAX => 1.7976931348623157e308,
-		# MIN => -1.7976931348623157e308,
+		MAX => 1.7976931348623157e308,
+		MIN => -1.7976931348623157e308,
 		POS_MIN => 4.9e-324,
 		NEG_MAX => -4.9e-324,
 	},
 } ;
 $RANGE->{byte} = $RANGE->{'java.lang.Byte'} ;
 $RANGE->{short} = $RANGE->{'java.lang.Short'} ;
-$RANGE->{int} = $RANGE->{'java.lang.Integer'} ;
+$RANGE->{'int'} = $RANGE->{'java.lang.Integer'} ;
 $RANGE->{long} = $RANGE->{'java.lang.Long'} ;
 $RANGE->{float} = $RANGE->{'java.lang.Float'} ;
 $RANGE->{double} = $RANGE->{'java.lang.Double'} ;
@@ -163,7 +161,7 @@ sub CastArgument {
 						croak "Can't convert $arg to object $proto" ;
 					}
 				}
-				else{
+				else {
 					# Here we got a scalar
 					# Here we allow scalars to be passed in place of java.lang.Object
 					# They will wrapped on the Java side.
@@ -195,6 +193,8 @@ sub CastArgument {
 				}
 				croak "$arg out of range for type $proto" ;
 			}
+			elsif ($arg =~ /$FLOAT_RE/){
+			}
 			croak "Can't convert $arg to $proto" ;
 		}
 		elsif (ClassIsChar($proto)){
diff --git a/Java/JNI.pm b/Java/JNI.pm
index be6cc7f..7f8abc1 100644
--- a/Java/JNI.pm
+++ b/Java/JNI.pm
@@ -4,7 +4,7 @@ package Inline::Java::JNI ;
 
 use strict ;
 
-$Inline::Java::JNI::VERSION = '0.50' ;
+$Inline::Java::JNI::VERSION = '0.49_90' ;
 
 use DynaLoader ;
 use Carp ;
diff --git a/Java/JVM.pm b/Java/JVM.pm
index bd731e7..161ff67 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -8,7 +8,7 @@ use IPC::Open3 ;
 use IO::Socket ;
 use Inline::Java::Portable ;
 
-$Inline::Java::JVM::VERSION = '0.50' ;
+$Inline::Java::JVM::VERSION = '0.49_90' ;
 
 my %SIGS = () ;
 
diff --git a/Java/Makefile.PL b/Java/Makefile.PL
index 43e3161..1983415 100644
--- a/Java/Makefile.PL
+++ b/Java/Makefile.PL
@@ -60,7 +60,9 @@ print
 	"Note: You must build the extension if you wish to use PerlNatives or\n" .
 	"      PerlInterpreter.\n" ;
 
-if (($build_jni || AskYN("Do you wish to build the JNI extension?", 'y'))){
+my $build_jni_by_dflt = Inline::Java::Portable::portable("BUILD_JNI_BY_DFLT") ;
+if (($build_jni || AskYN("Do you wish to build the JNI extension?", 
+	($build_jni_by_dflt ? 'y' : 'n')))){
 	print "\nBuilding JNI extension.\n\n" ;
 
 	$jdk_dir = Inline::Java::get_default_j2sdk() ;
diff --git a/Java/Object.pm b/Java/Object.pm
index fa7d683..e2a46c0 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -5,7 +5,7 @@ use strict ;
 use Inline::Java::Protocol ;
 use Carp ;
 
-$Inline::Java::Object::VERSION = '0.50' ;
+$Inline::Java::Object::VERSION = '0.49_90' ;
 
 # Here we store as keys the knots and as values our blessed private objects
 my $PRIVATES = {} ;
diff --git a/Java/PerlNatives/PerlNatives.pm b/Java/PerlNatives/PerlNatives.pm
index c9d56e7..885890b 100644
--- a/Java/PerlNatives/PerlNatives.pm
+++ b/Java/PerlNatives/PerlNatives.pm
@@ -2,6 +2,6 @@ package Inline::Java::PerlNatives ;
 
 use strict ;
 
-$Inline::Java::PerlNatives::VERSION = '0.50' ;
+$Inline::Java::PerlNatives::VERSION = '0.49_90' ;
 
 1 ;
diff --git a/Java/Portable.pm b/Java/Portable.pm
index be6da16..7e26ff7 100644
--- a/Java/Portable.pm
+++ b/Java/Portable.pm
@@ -9,7 +9,7 @@ use Config ;
 use File::Find ;
 use File::Spec ;
 
-$Inline::Java::Portable::VERSION = '0.50' ;
+$Inline::Java::Portable::VERSION = '0.49_90' ;
 
 # Here is some code to figure out if we are running on command.com
 # shell under Windows.
@@ -160,6 +160,7 @@ sub portable {
 		PRE_WHOLE_ARCHIVE	=>  '-Wl,--whole-archive',
 		POST_WHOLE_ARCHIVE	=>  '-Wl,--no-whole-archive',
 		PERL_PARSE_DUP_ENV	=>  '-DPERL_PARSE_DUP_ENV',
+		BUILD_JNI_BY_DFLT	=>  1,
 	} ;
 
 	my $map = {
@@ -207,6 +208,7 @@ sub portable {
 			},
 			JVM_LIB				=>	'jvm.lib',
 			JVM_SO				=>	'jvm.dll',
+			BUILD_JNI_BY_DFLT	=>  0,
 		},
 		hpux => {
 			GOT_NEXT_FREE_PORT  =>  0,
diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index bfe9f32..7292436 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -5,7 +5,7 @@ use Inline::Java::Object ;
 use Inline::Java::Array ;
 use Carp ;
 
-$Inline::Java::Protocol::VERSION = '0.50' ;
+$Inline::Java::Protocol::VERSION = '0.49_90' ;
 
 my %CLASSPATH_ENTRIES = () ;
 
diff --git a/Java/Server.pm b/Java/Server.pm
index 51a9594..595d227 100644
--- a/Java/Server.pm
+++ b/Java/Server.pm
@@ -13,7 +13,7 @@ require Inline::Java ;
 use File::Spec ;
 
 
-$Inline::Java::Server::VERSION = '0.50' ;
+$Inline::Java::Server::VERSION = '0.49_90' ;
 
 
 # Create a dummy Inline::Java object in order to 
diff --git a/Java/sources/org/perl/inline/java/InlineJavaUserClassLoader.java b/Java/sources/org/perl/inline/java/InlineJavaUserClassLoader.java
index 2b2756d..1d8b403 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaUserClassLoader.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaUserClassLoader.java
@@ -24,7 +24,9 @@ class InlineJavaUserClassLoader extends URLClassLoader {
 
 
     public InlineJavaUserClassLoader(){
-        super(new URL [] {}) ;
+		// Added Thread.currentThread().getContextClassLoader() so that the code works
+		// in Tomcat and possibly other embedded environments asa well.
+        super(new URL [] {}, Thread.currentThread().getContextClassLoader()) ;
     }
 
 
diff --git a/t/02_primitives.t b/t/02_primitives.t
index 422c333..2cf60a8 100644
--- a/t/02_primitives.t
+++ b/t/02_primitives.t
@@ -10,7 +10,7 @@ use Inline (
 
 
 BEGIN {
-	plan(tests => 99) ;
+	plan(tests => 103) ;
 }
 
 
@@ -65,65 +65,79 @@ my $t = new types2() ;
 	eval {$t->_Integer($max + 1)} ; ok($@, qr/out of range/) ;
 	eval {$t->_Integer($min - 1)} ; ok($@, qr/out of range/) ;
 	
-	$max = 2147483647 ;
-	$min = -2147483648 ;
+	$max = '9223372036854775807' ;
+	$min = '-9223372036854775808' ;
 	ok($t->_long(undef) == 1) ;
 	ok($t->_long(0) == 1) ;
-	ok($t->_long($max - 1) == $max) ;
-	ok($t->_long("$min") == $min + 1) ;
-	eval {$t->_long($max + 1)} ; ok($@, qr/out of range/) ;
-	eval {$t->_long($min - 1)} ; ok($@, qr/out of range/) ;
+	ok($t->_long('9223372036854775806') eq $max) ;
+	ok($t->_long("$min") eq '-9223372036854775807') ;
+	# Out of range testing is now impossible since Perl has a lesser range.
+	# eval {$t->_long($max + 1)} ; ok($@, qr/out of range/) ;
+	# eval {$t->_long($min - 1)} ; ok($@, qr/out of range/) ;
 	ok($t->_Long(undef) == 0) ;
 	ok($t->_Long(0) == 0) ;
 	ok($t->_Long($max) == $max) ;
 	ok($t->_Long("$min") == $min) ;
-	eval {$t->_Long($max + 1)} ; ok($@, qr/out of range/) ;
-	eval {$t->_Long($min - 1)} ; ok($@, qr/out of range/) ;
+	# Out of range testing is now impossible since Perl has a lesser range.
+	# eval {$t->_Long($max + 1)} ; ok($@, qr/out of range/) ;
+	# eval {$t->_Long($min - 1)} ; ok($@, qr/out of range/) ;
 	
 	$max = 3.4028235e38 ;
 	$min = -3.4028235e38 ;
 	ok($t->_float(undef) == 1) ;
 	ok($t->_float(0) == 1) ;
-	# The format changes in JNI sometimes
-	# ok($t->_float($max - 1) == $max) ;
-	# ok($t->_float("$min") == $min + 1) ;
+	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 - 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) ;
-	# The format changes in JNI sometimes
-	# ok($t->_Float($max) == $max) ;
-	# ok($t->_Float("$min") == $min) ;
+	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/) ;
-	
-	$max = 3.4028235e38 ;
-	$min = -3.4028235e38 ;
+
+	$max = 1.7976931348623157e308 ;
+	$min = -1.7976931348623157e308 ;
 	ok($t->_double(undef) == 1) ;
 	ok($t->_double(0) == 1) ;
-	# The format changes in JNI sometimes
+	ok($t->_double($max / 2)) ;
+	ok($t->_double($min / 2)) ;
+	# Equality tests for such large floating point number are not always reliable
 	# ok($t->_double($max - 1) == $max) ;
 	# ok($t->_double("$min") == $min + 1) ;
-	eval {$t->_double($max + $max)} ; ok($@, qr/out of range/) ;
-	eval {$t->_double($min + $min)} ; ok($@, qr/out of range/) ;
+	# Out of range testing is impossible since Perl has an equal range.
+	# eval {$t->_double($max + $max)} ; ok($@, qr/out of range/) ;
+	# eval {$t->_double($min + $min)} ; ok($@, qr/out of range/) ;
 	ok($t->_Double(undef) == 0) ;
 	ok($t->_Double(0) == 0) ;
-	# The format changes in JNI sometimes
+	ok($t->_Double($max / 2)) ;
+	ok($t->_Double($min / 2)) ;
+	# Equality tests for such large floating point number are not always reliable
 	# ok($t->_Double($max) == $max) ;
 	# ok($t->_Double("$min") == $min) ;
-	eval {$t->_Double($max + $max)} ; ok($@, qr/out of range/) ;
-	eval {$t->_Double($min + $min)} ; ok($@, qr/out of range/) ;
+	# eval {$t->_Double($max + $max)} ; ok($@, qr/out of range/) ;
+	# eval {$t->_Double($min + $min)} ; ok($@, qr/out of range/) ;
 	
 	# Number is forced to Double
-	$max = 3.4028235e38 ;
-	$min = -3.4028235e38 ;
+	$max = 1.7976931348623157e308 ;
+	$min = -1.7976931348623157e308 ;
 	ok($t->_Number(undef) == 0) ;
 	ok($t->_Number(0) == 0) ;
-	# The format changes in JNI sometimes
+	ok($t->_Number($max / 2)) ;
+	ok($t->_Number($min / 2)) ;
+	# Equality tests for such large floating point number are not always reliable
 	# ok($t->_Number($max) == $max) ;
 	# ok($t->_Number("$min") == $min) ;
-	eval {$t->_Number($max + $max)} ; ok($@, qr/out of range/) ;
-	eval {$t->_Number($min + $min)} ; ok($@, qr/out of range/) ;
+	# Out of range testing is impossible since Perl has an equal range.
+	# eval {$t->_Number($max + $max)} ; ok($@, qr/out of range/) ;
+	# eval {$t->_Number($min + $min)} ; ok($@, qr/out of range/) ;
 	
 	ok(! $t->_boolean(undef)) ;
 	ok(! $t->_boolean(0)) ;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git



More information about the Pkg-perl-cvs-commits mailing list