[libinline-java-perl] 388/398: 0.52_90

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:28 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 2a0954c43e599d7a9ef5e6fe78f5bf4614b073f3
Author: patrick_leb <>
Date:   Mon Jul 12 00:15:30 2010 +0000

    0.52_90
---
 CHANGES                                            |  8 ++++
 Java.pm                                            |  4 +-
 Java/Array.pm                                      |  2 +-
 Java/Callback.pm                                   |  2 +-
 Java/Class.pm                                      |  2 +-
 Java/Handle.pm                                     |  2 +-
 Java/JNI.pm                                        |  2 +-
 Java/JVM.pm                                        |  2 +-
 Java/Makefile.PL                                   | 37 ++++++++++---------
 Java/Object.pm                                     |  2 +-
 Java/PerlInterpreter/PerlInterpreter.xs            |  4 +-
 Java/PerlNatives/PerlNatives.xs                    |  5 +++
 Java/Portable.pm                                   |  2 +-
 Java/Protocol.pm                                   |  2 +-
 Java/Server.pm                                     |  2 +-
 .../org/perl/inline/java/InlineJavaProtocol.java   | 32 ++++++++++++++--
 MANIFEST                                           |  3 --
 META.yml                                           |  2 +-
 Makefile.PL                                        |  3 ++
 t/10_2_shared_start.t                              | 43 ----------------------
 t/10_3_shared_use.t                                | 42 ---------------------
 t/10_4_shared_stop.t                               | 43 ----------------------
 22 files changed, 79 insertions(+), 167 deletions(-)

diff --git a/CHANGES b/CHANGES
index 11dd111..0486699 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,13 @@
 Revision history for Perl extension Inline::Java
 ------------------------------------------------
+0.53  Fri Oct  2 10:22:26 EDT 2009
+    - Removed PerlNatives extension from the build because it is unmaintained and broken.
+      It can still be enabled manually using the BUILD_PERL_NATIVES build configuration 
+      option.
+    - Improved automatic casting.
+    - Fix with get_source_dir() using the DEBUGGER option. Thanks to Paul Frantz for the fix.
+    - Other minor bug and doc fixes.
+
 0.52  Sun Dec 17 20:46:51 EST 2006
     - Fixed JNI on cygwin (many thanks to Eric Rybski for the patch)
     - Improved installation. 'make java' is now performed automatically.
diff --git a/Java.pm b/Java.pm
index 25ee2ff..fa451c2 100644
--- a/Java.pm
+++ b/Java.pm
@@ -8,7 +8,7 @@ package Inline::Java ;
 use strict ;
 require 5.006 ;
 
-$Inline::Java::VERSION = '0.52' ;
+$Inline::Java::VERSION = '0.52_90' ;
 
 
 # DEBUG is set via the DEBUG config
@@ -203,7 +203,7 @@ sub validate {
 		$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") .
-			get_source_dir()
+			Inline::Java::Portable::get_source_dir()
 		) ;
 	}	
 
diff --git a/Java/Array.pm b/Java/Array.pm
index bef74f0..3eb7dd6 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.52' ;
+$Inline::Java::Array::VERSION = '0.52_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 bba56ee..de2fc86 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.52' ;
+$Inline::Java::Callback::VERSION = '0.52_90' ;
 
 $Inline::Java::Callback::OBJECT_HOOK = undef ;
 
diff --git a/Java/Class.pm b/Java/Class.pm
index 3047f8d..d8067ad 100644
--- a/Java/Class.pm
+++ b/Java/Class.pm
@@ -3,7 +3,7 @@ package Inline::Java::Class ;
 use strict ;
 use Carp ;
 
-$Inline::Java::Class::VERSION = '0.52' ;
+$Inline::Java::Class::VERSION = '0.52_90' ;
 
 $Inline::Java::Class::MAX_SCORE = 10 ;
 
diff --git a/Java/Handle.pm b/Java/Handle.pm
index d336073..971dc67 100644
--- a/Java/Handle.pm
+++ b/Java/Handle.pm
@@ -5,7 +5,7 @@ use strict ;
 use Symbol ;
 use Carp ;
 
-$Inline::Java::Handle::VERSION = '0.52' ;
+$Inline::Java::Handle::VERSION = '0.52_90' ;
 
 
 # Here we store as keys the knots and as values our blessed objects
diff --git a/Java/JNI.pm b/Java/JNI.pm
index 4ce50d0..574e74c 100644
--- a/Java/JNI.pm
+++ b/Java/JNI.pm
@@ -4,7 +4,7 @@ package Inline::Java::JNI ;
 
 use strict ;
 
-$Inline::Java::JNI::VERSION = '0.52' ;
+$Inline::Java::JNI::VERSION = '0.52_90' ;
 
 use DynaLoader ;
 use Carp ;
diff --git a/Java/JVM.pm b/Java/JVM.pm
index f81910f..d0a1b77 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -9,7 +9,7 @@ use IO::Socket ;
 use Text::ParseWords ;
 use Inline::Java::Portable ;
 
-$Inline::Java::JVM::VERSION = '0.52' ;
+$Inline::Java::JVM::VERSION = '0.52_90' ;
 
 my %SIGS = () ;
 
diff --git a/Java/Makefile.PL b/Java/Makefile.PL
index dc180a4..2349f48 100644
--- a/Java/Makefile.PL
+++ b/Java/Makefile.PL
@@ -58,9 +58,9 @@ if (! defined($build_jni)){
 		"process. The use of this extension is optional, and building it still\n" .
 		"allows Inline::Java to run the JVM in the default (separate process)\n" .
 		"fashion.\n" .
-		"Note: You need a C compiler to build the extension.\n" .
-		"Note: You must build the extension if you wish to use PerlNatives or\n" .
-		"      PerlInterpreter.\n" ;
+		"Note: You need a C compiler to build the extension.\n" ;
+#		"Note: You must build the extension if you wish to use PerlNatives or\n" .
+#		"      PerlInterpreter.\n" ;
 	if (AskYN("Do you wish to build the JNI extension?", 
 		($build_jni_by_dflt ? 'y' : 'n'))){
 		$build_jni = 1 ;
@@ -153,6 +153,22 @@ if ($build_jni){
 				($files->{$jvm_lib}->{selected}) ;
 
 			my $DIR = [] ;
+			if (! defined($build_perl_interpreter)){
+				print <<TXT;
+The PerlInterpreter extension allows Inline::Java to be loaded directly from
+Java using an embedded Perl interpreter. It is still EXPERIMENTAL and 
+may not build or work properly on all platforms. See documentation for 
+more details.
+TXT
+				if (AskYN("Do you wish to build the PerlInterpreter extension?", 'n')){
+					$build_perl_interpreter = 1 ;
+				}
+				print "\n" ;
+			}
+			if ($build_perl_interpreter){
+				push @{$DIR}, 'PerlInterpreter' ;
+			}
+
 			if (! defined($build_perl_natives)){
 				print <<TXT;
 The PerlNatives extension allows for callbacks to be defined as native
@@ -169,21 +185,6 @@ TXT
 				push @{$DIR}, 'PerlNatives' ;
 			}
 
-			if (! defined($build_perl_interpreter)){
-				print <<TXT;
-The PerlInterpreter extension allows Inline::Java to be loaded directly from
-Java using an embedded Perl interpreter. It is still EXPERIMENTAL and 
-may not build or work properly on all platforms. See documentation for 
-more details.
-TXT
-				if (AskYN("Do you wish to build the PerlInterpreter extension?", 'n')){
-					$build_perl_interpreter = 1 ;
-				}
-				print "\n" ;
-			}
-			if ($build_perl_interpreter){
-				push @{$DIR}, 'PerlInterpreter' ;
-			}
 
 			WriteMakefile(
 				NAME => 'Inline::Java::JNI',
diff --git a/Java/Object.pm b/Java/Object.pm
index 7cb6468..62dead5 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.52' ;
+$Inline::Java::Object::VERSION = '0.52_90' ;
 
 # Here we store as keys the knots and as values our blessed private objects
 my $PRIVATES = {} ;
diff --git a/Java/PerlInterpreter/PerlInterpreter.xs b/Java/PerlInterpreter/PerlInterpreter.xs
index bb4c844..d8d5ac9 100644
--- a/Java/PerlInterpreter/PerlInterpreter.xs
+++ b/Java/PerlInterpreter/PerlInterpreter.xs
@@ -40,11 +40,11 @@ void throw_ijp(JNIEnv *env, char *msg){
 
 JNIEXPORT void JNICALL Java_org_perl_inline_java_InlineJavaPerlInterpreter_construct(JNIEnv *env, jclass cls){
 	char *args[] = {"inline-java", "-e1"} ;
-	int envl = 0 ;
-	int i = 0 ;
 	char **envdup = NULL ;
 
 #ifdef PERL_PARSE_ENV_DUP
+	int envl = 0 ;
+	int i = 0 ;
 	/* This will leak, but it's a one shot... */
 	for (i = 0 ; environ[i] != NULL ; i++){
 		envl++ ;
diff --git a/Java/PerlNatives/PerlNatives.xs b/Java/PerlNatives/PerlNatives.xs
index b352e02..c66a5be 100644
--- a/Java/PerlNatives/PerlNatives.xs
+++ b/Java/PerlNatives/PerlNatives.xs
@@ -1,7 +1,12 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+/*
 #include "stdlib.h"
 #include "string.h"
 #include "stdio.h"
 #include "stdarg.h"
+*/
 
 #ifdef __CYGWIN__
 	#include "w32api/basetyps.h"
diff --git a/Java/Portable.pm b/Java/Portable.pm
index 3b70079..1cd2e9f 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.52' ;
+$Inline::Java::Portable::VERSION = '0.52_90' ;
 
 # Here is some code to figure out if we are running on command.com
 # shell under Windows.
diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index b01f277..c5daff3 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -10,7 +10,7 @@ BEGIN {
 }
 
 
-$Inline::Java::Protocol::VERSION = '0.52' ;
+$Inline::Java::Protocol::VERSION = '0.52_90' ;
 
 my %CLASSPATH_ENTRIES = () ;
 
diff --git a/Java/Server.pm b/Java/Server.pm
index b3358a6..21c6d81 100644
--- a/Java/Server.pm
+++ b/Java/Server.pm
@@ -13,7 +13,7 @@ require Inline::Java ;
 use File::Spec ;
 
 
-$Inline::Java::Server::VERSION = '0.52' ;
+$Inline::Java::Server::VERSION = '0.52_90' ;
 
 
 # Create a dummy Inline::Java object in order to 
diff --git a/Java/sources/org/perl/inline/java/InlineJavaProtocol.java b/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
index d758216..e84c214 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaProtocol.java
@@ -281,7 +281,7 @@ class InlineJavaProtocol {
 
 			try {
 				Object ret = InlineJavaServer.GetInstance().GetUserClassLoader().invoke(m, o, p) ;
-				SetResponse(ret) ;
+				SetResponse(ret, AutoCast(ret, m.getReturnType())) ;
 			}
 			catch (IllegalAccessException e){
 				throw new InlineJavaException("You are not allowed to invoke method " + name + " in class " + class_name + ": " + e.getMessage()) ;
@@ -307,6 +307,31 @@ class InlineJavaProtocol {
 
 
 	/*
+	*/  
+	Class AutoCast(Object o, Class want){
+		if (o == null){
+			return null ;
+		}
+		else {
+			Class got = o.getClass() ;
+			if (got.equals(want)){
+				return null ;
+			}
+			else {
+				boolean _public = (got.getModifiers() & Modifier.PUBLIC) != 0 ;
+				if ((_public)||(got.getPackage() == null)){
+					return null ;
+				}
+				else {
+					InlineJavaUtils.debug(3, "AutoCast: " + got.getName() + " -> " + want.getName()) ;
+					return want ;
+				}
+			}
+		}
+	}
+
+
+	/*
 		Returns a new reference to the current object, using the provided subtype
 	*/
 	void Cast(StringTokenizer st) throws InlineJavaException {
@@ -489,7 +514,8 @@ class InlineJavaProtocol {
 		if (ijc.ClassIsArray(c)){
 			int idx = Integer.parseInt(member) ;
 			Object ret = InlineJavaServer.GetInstance().GetUserClassLoader().array_get(o, idx) ;
-			SetResponse(ret) ;
+			Class eclass = ijc.ValidateClass(ijc.CleanClassName(class_name.substring(1))) ;
+			SetResponse(ret, AutoCast(ret, eclass)) ;
 		}
 		else{
 			ArrayList fl = ValidateMember(c, member, st) ;
@@ -498,7 +524,7 @@ class InlineJavaProtocol {
 			String name = f.getName() ;
 			try {
 				Object ret = InlineJavaServer.GetInstance().GetUserClassLoader().get(f, o) ;
-				SetResponse(ret) ;
+				SetResponse(ret, AutoCast(ret, f.getType())) ;
 			}
 			catch (IllegalAccessException e){
 				throw new InlineJavaException("You are not allowed to set member " + name + " in class " + class_name + ": " + e.getMessage()) ;
diff --git a/MANIFEST b/MANIFEST
index e8a797f..bd7d8ca 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -66,9 +66,6 @@ t/07_polymorph.t
 t/08_study.t
 t/09_usages.t
 t/10_1_shared_alone.t
-t/10_2_shared_start.t
-t/10_3_shared_use.t
-t/10_4_shared_stop.t
 t/10_5_shared_fork.t
 t/10_6_shared_sim.t
 t/11_exceptions.t
diff --git a/META.yml b/META.yml
index 41b9aaf..94041c1 100644
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Inline-Java
-version:      0.52
+version:      0.52_90
 version_from: Java.pm
 installdirs:  site
 requires:
diff --git a/Makefile.PL b/Makefile.PL
index 6fea382..6ed46c5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -9,6 +9,9 @@ require "Java/Portable.pm" ;
 
 print "\nWelcome to the Inline::Java installation procedure.\n\n" ;
 
+# Hide PerlNatives by default...
+$main::build_perl_natives = 0 ;
+
 # Grab the J2SDK argument
 my $jdk_dir = '' ;
 for (my $i = 0 ; $i < scalar(@ARGV) ; $i++){
diff --git a/t/10_2_shared_start.t b/t/10_2_shared_start.t
deleted file mode 100755
index 0df5fa0..0000000
--- a/t/10_2_shared_start.t
+++ /dev/null
@@ -1,43 +0,0 @@
-package 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("DETACH_OK")){
-		plan(tests => 0) ;
-		exit ;
-	}
-	else{		
-		plan(tests => 3) ;
-	}
-}
-
-
-use Inline Config => 
-           DIRECTORY => './_Inline_test' ;
-
-use Inline (
-	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()) ;
-}
-
-ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
-
diff --git a/t/10_3_shared_use.t b/t/10_3_shared_use.t
deleted file mode 100755
index 572c742..0000000
--- a/t/10_3_shared_use.t
+++ /dev/null
@@ -1,42 +0,0 @@
-package t10 ;
-
-use strict ;
-use Test ;
-
-
-BEGIN {
-	require Inline::Java::Portable ;
-	if ($ENV{PERL_INLINE_JAVA_JNI}){
-		plan(tests => 0) ;
-		exit ;
-	}
-	elsif (! Inline::Java::Portable::portable("DETACH_OK")){
-		plan(tests => 0) ;
-		exit ;
-	}
-	else{
-		plan(tests => 3) ;
-	}
-}
-
-
-use Inline Config => 
-           DIRECTORY => './_Inline_test' ;
-
-use Inline (
-	Java => 't/shared.java',
-	SHARED_JVM => 1,
-	START_JVM => 0,
-	PORT => 17891,
-	NAME => 't10',
-) ;
-
-
-my $t = new t10::t10() ;
-{
-	ok($t->{i}++, 6) ;
-	ok(! Inline::Java::i_am_JVM_owner()) ;
-}
-
-ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
-
diff --git a/t/10_4_shared_stop.t b/t/10_4_shared_stop.t
deleted file mode 100755
index aa1762a..0000000
--- a/t/10_4_shared_stop.t
+++ /dev/null
@@ -1,43 +0,0 @@
-package t10 ;
-
-use strict ;
-use Test ;
-
-
-BEGIN {
-	require Inline::Java::Portable ;
-	if ($ENV{PERL_INLINE_JAVA_JNI}){
-		plan(tests => 0) ;
-		exit ;
-	}
-	elsif (! Inline::Java::Portable::portable("DETACH_OK")){
-		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,
-	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()) ;
-}
-
-ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
-

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