rjb 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
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);
data/test/test.rb CHANGED
@@ -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-10 00:00:00 +09:00
8
8
  summary: Ruby Java bridge
9
9
  require_paths:
10
10
  - lib
@@ -30,25 +30,25 @@ authors:
30
30
  - arton
31
31
  files:
32
32
  - ext/RBridge.java
33
+ - ext/load.c
33
34
  - ext/riconv.c
34
35
  - ext/rjbexception.c
35
- - ext/load.c
36
36
  - ext/rjb.c
37
- - ext/riconv.h
37
+ - ext/jniwrap.h
38
38
  - ext/rjb.h
39
+ - ext/riconv.h
39
40
  - ext/jp_co_infoseek_hp_arton_rjb_RBridge.h
40
- - ext/jniwrap.h
41
41
  - ext/depend
42
42
  - data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
43
43
  - lib/rjb.rb
44
44
  - samples/filechooser.rb
45
45
  - test/gctest.rb
46
46
  - test/test.rb
47
- - test/JTest.class
47
+ - test/jp/co/infoseek/hp/arton/rjb/Base.class
48
48
  - test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
49
- - test/jp/co/infoseek/hp/arton/rjb/Test.class
50
49
  - test/jp/co/infoseek/hp/arton/rjb/IBase.class
51
- - test/jp/co/infoseek/hp/arton/rjb/Base.class
50
+ - test/jp/co/infoseek/hp/arton/rjb/JTest.class
51
+ - test/jp/co/infoseek/hp/arton/rjb/Test.class
52
52
  - COPYING
53
53
  - ChangeLog
54
54
  - readme.sj
data/test/JTest.class DELETED
Binary file