rjb 1.0.0-mswin32 → 1.0.1-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ Sun Sep 10 arton
2
+ *test.rb
3
+ add a test of return type is an object wrapped an array
4
+ *Test.java
5
+ add a method that returns an object wrapped an array
6
+ *rjb.c
7
+ check array-mark in jv2rv for returned object was an array
1
8
  Tue Aug 1 arton
2
9
  *load.c
3
10
  *rjb.c
@@ -1,21 +1,21 @@
1
1
  /* DO NOT EDIT THIS FILE - it is machine generated */
2
- #include <jni.h>
2
+ #include <jni.h>
3
3
  /* Header for class jp_co_infoseek_hp_arton_rjb_RBridge */
4
4
 
5
5
  #ifndef _Included_jp_co_infoseek_hp_arton_rjb_RBridge
6
- #define _Included_jp_co_infoseek_hp_arton_rjb_RBridge
6
+ #define _Included_jp_co_infoseek_hp_arton_rjb_RBridge
7
7
  #ifdef __cplusplus
8
8
  extern "C" {
9
- #endif
10
- /*
11
- * Class: jp_co_infoseek_hp_arton_rjb_RBridge
12
- * Method: call
13
- * Signature: (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
14
- */
15
- JNIEXPORT jobject JNICALL Java_jp_co_infoseek_hp_arton_rjb_RBridge_call
9
+ #endif
10
+ /*
11
+ * Class: jp_co_infoseek_hp_arton_rjb_RBridge
12
+ * Method: call
13
+ * Signature: (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
14
+ */
15
+ JNIEXPORT jobject JNICALL Java_jp_co_infoseek_hp_arton_rjb_RBridge_call
16
16
  (JNIEnv *, jobject, jstring, jobject, jobjectArray);
17
-
17
+
18
18
  #ifdef __cplusplus
19
19
  }
20
- #endif
21
- #endif
20
+ #endif
21
+ #endif
data/ext/rjb.c CHANGED
@@ -15,7 +15,7 @@
15
15
  * $Id: rjb.c 15 2006-08-01 13:52:36Z arton $
16
16
  */
17
17
 
18
- #define RJB_VERSION "1.0.0"
18
+ #define RJB_VERSION "1.0.1"
19
19
 
20
20
  #include "ruby.h"
21
21
  #include "st.h"
@@ -43,6 +43,7 @@ static VALUE register_instance(JNIEnv* jenv, struct jvi_data*, jobject);
43
43
  static VALUE rjb_s_free(struct jv_data*);
44
44
  static VALUE rjb_class_forname(int argc, VALUE* argv, VALUE self);
45
45
  static void setup_metadata(JNIEnv* jenv, VALUE self, struct jv_data*, VALUE classname);
46
+ static VALUE jarray2rv(JNIEnv* jenv, jvalue val);
46
47
  static jarray r2objarray(JNIEnv* jenv, VALUE v, const char* cls);
47
48
 
48
49
  static VALUE rjb;
@@ -243,6 +244,11 @@ static VALUE jv2rv(JNIEnv* jenv, jvalue val)
243
244
  nm = (*jenv)->CallObjectMethod(jenv, klass, class_getName);
244
245
  check_exception(jenv, 0);
245
246
  cname = (*jenv)->GetStringUTFChars(jenv, nm, NULL);
247
+ if (*cname == '[')
248
+ {
249
+ release_string(jenv, nm, cname);
250
+ return jarray2rv(jenv, val);
251
+ }
246
252
  clsname = rb_str_new2(cname);
247
253
  release_string(jenv, nm, cname);
248
254
  v = rb_hash_aref(loaded_classes, clsname);
Binary file
@@ -1,3 +1,6 @@
1
+ #!/usr/local/env ruby
2
+ # $Id:$
3
+
1
4
  require 'test/unit'
2
5
  require 'rjb'
3
6
 
@@ -390,5 +393,17 @@ class TestRjb < Test::Unit::TestCase
390
393
  assert_equal("another string",mixed[1][0][1].toString)
391
394
  assert_equal([],mixed[2])
392
395
  end
396
+
397
+ def test_CastObjectArray()
398
+ test = import('jp.co.infoseek.hp.arton.rjb.Test').new
399
+ a = test.getObjectArray()
400
+ assert_equal(1, a[0].intValue)
401
+ assert_equal('Hello World !', a[1].toString)
402
+ a = test.getObjectArrayOfArray()
403
+ assert_equal(1, a[0][0].intValue)
404
+ assert_equal('Hello World !', a[0][1].toString)
405
+ assert_equal(2, a[1][0].intValue)
406
+ assert_equal('Hello World !!', a[1][1].toString)
407
+ end
393
408
  end
394
409
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: rjb
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2006-08-01 00:00:00 +09:00
6
+ version: 1.0.1
7
+ date: 2006-09-11 00:00:00 +09:00
8
8
  summary: Ruby Java bridge
9
9
  require_paths:
10
10
  - lib
@@ -47,6 +47,7 @@ files:
47
47
  - test/jp/co/infoseek/hp/arton/rjb/Base.class
48
48
  - test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
49
49
  - test/jp/co/infoseek/hp/arton/rjb/IBase.class
50
+ - test/jp/co/infoseek/hp/arton/rjb/JTest.class
50
51
  - test/jp/co/infoseek/hp/arton/rjb/Test.class
51
52
  - COPYING
52
53
  - ChangeLog