[libinline-java-perl] 33/398: *** empty log message ***

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:42:40 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 ca44f742fea865fc184d1774eb4f55e3b865f296
Author: patrick <>
Date:   Tue Mar 13 14:59:33 2001 +0000

    *** empty log message ***
---
 Java.pm           | 31 ++++---------------------------
 Java/Class.pm     |  6 +++++-
 t/02_primitives.t |  8 +++++++-
 3 files changed, 16 insertions(+), 29 deletions(-)

diff --git a/Java.pm b/Java.pm
index 76675d4..818eec1 100644
--- a/Java.pm
+++ b/Java.pm
@@ -251,6 +251,8 @@ sub find_file_in_path {
 		$paths = [(split(/$psep/, $ENV{PATH} || ''))] ;
 	}
 
+	debug_obj($paths) ;
+
 	my $home = $ENV{HOME} ;
 	my $sep = portable("PATH_SEP_RE") ;
 
@@ -440,7 +442,7 @@ sub compile {
 				}
 
 				debug("$cmd") ;
-				my $res = my_system($cmd) ;
+				my $res = system($cmd) ;
 				$res and do {
 					$o->error_copy ;
 					croak $o->compile_error_msg($cmd, $cwd) ;
@@ -568,7 +570,7 @@ sub load {
 			}
 		}
 
-		my_exec(@cmd)
+		exec(@cmd)
 			or croak "Can't exec Java interpreter" ;
 	}
 }
@@ -956,31 +958,6 @@ sub copy_pattern {
 }
 
 
-sub my_system {
-	my @args = @_ ;
-
-	my $envp = $ENV{PATH} ;
-	$ENV{PATH} = '' ;
-	my $ret = system(@args) ;
-	$ENV{PATH} = $envp ;
-
-	return $ret ;
-}
-
-
-sub my_exec {
-	my @args = @_ ;
-
-	my $envp = $ENV{PATH} ;
-	$ENV{PATH} = '' ;
-	my $ret = exec(@args) ;
-	$ENV{PATH} = $envp ;
-
-	return $ret ;
-}
-
-
-
 1 ;
 
 __END__
diff --git a/Java/Class.pm b/Java/Class.pm
index c2cacef..e36cdea 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -105,7 +105,11 @@ sub CastArgument {
 	ValidateClass($proto) ;
 
 	if ((ClassIsReference($proto))&&(! UNIVERSAL::isa($arg, "Inline::Java::Object"))){
-		croak "Can't convert $arg to object $proto" ;
+		# Here we allow scalars to be passed in place of java.lang.Object
+		# They will wrapped on the Java side.
+		if ($proto ne "java.lang.Object"){
+			croak "Can't convert $arg to object $proto" ;
+		}
 	}
 	if ((ClassIsPrimitive($proto))&&(ref($arg))){
 		croak "Can't convert $arg to primitive $proto" ;
diff --git a/t/02_primitives.t b/t/02_primitives.t
index a674767..bbf336d 100644
--- a/t/02_primitives.t
+++ b/t/02_primitives.t
@@ -10,7 +10,7 @@ use Inline(
 
 
 BEGIN {
-	plan(tests => 20) ;
+	plan(tests => 21) ;
 }
 
 
@@ -38,6 +38,8 @@ ok($t->_Character("1"), '1') ;
 ok($t->_String("string"), 'string') ;
 ok($t->_StringBuffer("string_buffer"), 'string_buffer') ;
 
+# Test if scalars can pass as java.lang.Object (they should).
+ok($t->_Object("object"), 'object') ;
 
 __END__
 
@@ -118,6 +120,10 @@ class types {
 	public StringBuffer _StringBuffer(StringBuffer sb){
 		return sb ;
 	}
+
+	public Object _Object(Object o){
+		return o ;
+	}
 }
 
 

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