[libinline-java-perl] 348/398: *** empty log message ***
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 61bc070f988c8008d30aaa0a9b21f2e94aca2733
Author: patrick_leb <>
Date: Wed Aug 10 16:57:26 2005 +0000
*** empty log message ***
---
Java/JVM.pm | 2 +-
Java/Object.pm | 10 +--
.../org/perl/inline/java/InlineJavaClass.java | 99 ++++++++++++----------
3 files changed, 62 insertions(+), 49 deletions(-)
diff --git a/Java/JVM.pm b/Java/JVM.pm
index bd731e7..c1677a8 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -421,7 +421,7 @@ sub process_command {
Inline::Java::debug(3, "packet recv is $resp") ;
# We got an answer from the server. Is it a callback?
- if ($resp =~ /^callback/){
+ if ($resp =~ /^callback/o){
($data, $Inline::Java::Callback::OBJECT_HOOK) = Inline::Java::Callback::InterceptCallback($inline, $resp) ;
next ;
}
diff --git a/Java/Object.pm b/Java/Object.pm
index fa7d683..c33cf5a 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -84,10 +84,10 @@ sub __validate_prototype {
my $inline = shift ;
my @matched = () ;
-
- my $nb_proto = scalar(values %{$protos}) ;
+
+ my @proto_values = values %{$protos} ;
my @errors = () ;
- foreach my $s (values %{$protos}){
+ foreach my $s (@proto_values){
my $proto = $s->{SIGNATURE} ;
my $stat = $s->{STATIC} ;
my $idx = $s->{IDX} ;
@@ -101,7 +101,7 @@ sub __validate_prototype {
($new_args, $score) = Inline::Java::Class::CastArguments($args, $proto, $inline) ;
} ;
if ($@){
- if ($nb_proto == 1){
+ if (scalar(@proto_values) == 1){
# Here we have only 1 prototype, so we return the error.
croak $@ ;
}
@@ -141,7 +141,7 @@ sub __validate_prototype {
my $msg = "In method $method of class $name: Can't find any signature that matches " .
"the arguments passed $sa.\nAvailable signatures are:\n" ;
my $i = 0 ;
- foreach my $s (values %{$protos}){
+ foreach my $s (@proto_values){
my $proto = $s->{SIGNATURE} ;
my $static = ($s->{STATIC} ? "static " : "") ;
diff --git a/Java/sources/org/perl/inline/java/InlineJavaClass.java b/Java/sources/org/perl/inline/java/InlineJavaClass.java
index 87e0e75..a90392a 100644
--- a/Java/sources/org/perl/inline/java/InlineJavaClass.java
+++ b/Java/sources/org/perl/inline/java/InlineJavaClass.java
@@ -140,7 +140,7 @@ class InlineJavaClass {
}
else if (type.equals("scalar")){
String arg = ijp.Decode((String)tokens.get(1)) ;
- InlineJavaUtils.debug(4, "args is scalar -> forcing to " + ap.getName()) ;
+ InlineJavaUtils.debug(4, "args is scalar (" + arg + ") -> forcing to " + ap.getName()) ;
try {
ret = ijp.CreateObject(ap, new Object [] {arg}, new Class [] {String.class}) ;
InlineJavaUtils.debug(4, " result is " + ret.toString()) ;
@@ -160,8 +160,8 @@ class InlineJavaClass {
InlineJavaUtils.debug(4, " result is " + ret.toString()) ;
}
else if (type.equals("scalar")){
- String arg = ijp.Decode(((String)tokens.get(1)).toLowerCase()) ;
- InlineJavaUtils.debug(4, "args is scalar -> forcing to bool") ;
+ String arg = ijp.Decode((String)tokens.get(1)) ;
+ InlineJavaUtils.debug(4, "args is scalar (" + arg + ") -> forcing to bool") ;
if ((arg.equals(""))||(arg.equals("0"))){
arg = "false" ;
}
@@ -349,9 +349,8 @@ class InlineJavaClass {
/*
Determines if class is of numerical type.
*/
- static boolean ClassIsNumeric (Class p){
- String name = p.getName() ;
-
+ static private HashMap numeric_classes = new HashMap() ;
+ static {
Class [] list = {
java.lang.Byte.class,
java.lang.Short.class,
@@ -367,81 +366,66 @@ class InlineJavaClass {
float.class,
double.class,
} ;
-
for (int i = 0 ; i < list.length ; i++){
- if (p == list[i]){
- InlineJavaUtils.debug(4, "class " + name + " is primitive numeric") ;
- return true ;
- }
+ numeric_classes.put(list[i], new Boolean(true)) ;
}
-
- return false ;
+ }
+ static boolean ClassIsNumeric (Class p){
+ return (numeric_classes.get(p) != null) ;
}
/*
Class is String or StringBuffer
*/
- static boolean ClassIsString (Class p){
- String name = p.getName() ;
-
+ static private HashMap string_classes = new HashMap() ;
+ static {
Class [] list = {
java.lang.String.class,
java.lang.StringBuffer.class,
} ;
-
for (int i = 0 ; i < list.length ; i++){
- if (p == list[i]){
- InlineJavaUtils.debug(4, "class " + name + " is primitive string") ;
- return true ;
- }
+ string_classes.put(list[i], new Boolean(true)) ;
}
-
- return false ;
+ }
+ static boolean ClassIsString (Class p){
+ return (string_classes.get(p) != null) ;
}
/*
Class is Char
*/
- static boolean ClassIsChar (Class p){
- String name = p.getName() ;
-
+ static private HashMap char_classes = new HashMap() ;
+ static {
Class [] list = {
java.lang.Character.class,
char.class,
} ;
-
for (int i = 0 ; i < list.length ; i++){
- if (p == list[i]){
- InlineJavaUtils.debug(4, "class " + name + " is primitive char") ;
- return true ;
- }
+ char_classes.put(list[i], new Boolean(true)) ;
}
-
- return false ;
+ }
+ static boolean ClassIsChar (Class p){
+ return (char_classes.get(p) != null) ;
}
/*
Class is Bool
*/
- static boolean ClassIsBool (Class p){
- String name = p.getName() ;
-
+ static private HashMap bool_classes = new HashMap() ;
+ static {
Class [] list = {
java.lang.Boolean.class,
boolean.class,
} ;
-
for (int i = 0 ; i < list.length ; i++){
- if (p == list[i]){
- InlineJavaUtils.debug(4, "class " + name + " is primitive bool") ;
- return true ;
- }
+ bool_classes.put(list[i], new Boolean(true)) ;
}
-
- return false ;
+ }
+ static boolean ClassIsBool (Class p){
+ return (bool_classes.get(p) != null) ;
}
@@ -482,4 +466,33 @@ class InlineJavaClass {
return false ;
}
+
+
+ static boolean ClassIsHandle (Class p){
+ if ((ClassIsReadHandle(p))||(ClassIsWriteHandle(p))){
+ return true ;
+ }
+
+ return false ;
+ }
+
+
+ static boolean ClassIsReadHandle (Class p){
+ if ((java.io.Reader.class.isAssignableFrom(p))||
+ (java.io.InputStream.class.isAssignableFrom(p))){
+ return true ;
+ }
+
+ return false ;
+ }
+
+
+ static boolean ClassIsWriteHandle (Class p){
+ if ((java.io.Writer.class.isAssignableFrom(p))||
+ (java.io.OutputStream.class.isAssignableFrom(p))){
+ return true ;
+ }
+
+ return false ;
+ }
}
--
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