rjb 1.4.7 → 1.4.8

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.
@@ -1,8 +1,7 @@
1
1
  #ifndef EXTCONF_H
2
2
  #define EXTCONF_H
3
3
  #define HAVE_JNI_H 1
4
- #define HAVE_NL_LANGINFO 1
5
4
  #define HAVE_SETLOCALE 1
6
5
  #define HAVE_GETENV 1
7
- #define RJB_RUBY_VERSION_CODE 200
6
+ #define RJB_RUBY_VERSION_CODE 210
8
7
  #endif
data/ext/rjb.c CHANGED
@@ -15,7 +15,7 @@
15
15
  * $Id: rjb.c 199 2012-12-17 13:31:18Z arton $
16
16
  */
17
17
 
18
- #define RJB_VERSION "1.4.7"
18
+ #define RJB_VERSION "1.4.8"
19
19
 
20
20
  #include "ruby.h"
21
21
  #include "extconf.h"
@@ -1066,7 +1066,14 @@ static jarray r2objarray(JNIEnv* jenv, VALUE v, const char* cls)
1066
1066
  if (TYPE(v) == T_ARRAY)
1067
1067
  {
1068
1068
  int i;
1069
- ary = (*jenv)->NewObjectArray(jenv, (jint)RARRAY_LEN(v), j_object, NULL);
1069
+ jclass jcls = NULL;
1070
+ char* p = strchr(cls, ';');
1071
+ if (p)
1072
+ {
1073
+ volatile VALUE clsname = rb_str_new(cls + 1, p - cls - 1); // skip first 'L'
1074
+ jcls = rjb_find_class(jenv, clsname);
1075
+ }
1076
+ ary = (*jenv)->NewObjectArray(jenv, (jint)RARRAY_LEN(v), (jcls) ? jcls : j_object, NULL);
1070
1077
  rjb_check_exception(jenv, 0);
1071
1078
  for (i = 0; i < RARRAY_LEN(v); i++)
1072
1079
  {
Binary file
@@ -878,5 +878,13 @@ class TestRjb < Test::Unit::TestCase
878
878
  assert_equal(32, b.int_value)
879
879
  assert b.compareTo(@jByte._invoke(:valueOf, 'B', 32))
880
880
  end
881
+ def test_typedarray
882
+ test = import('jp.co.infoseek.hp.arton.rjb.Test').new
883
+ uri = import('java.net.URI')
884
+ ret = test.java_typed_array(['a', 'b', 'c'], [1, 2, 3], [uri.new('http://www.artonx.org')])
885
+ assert_equal '[Ljava.lang.String;', ret[0]
886
+ assert_equal '[Ljava.lang.Integer;', ret[1]
887
+ assert_equal '[Ljava.net.URI;', ret[2]
888
+ end
881
889
  end
882
890
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - arton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-18 00:00:00.000000000 Z
11
+ date: 2013-06-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  RJB is a bridge program that connect between Ruby and Java with Java Native Interface.
@@ -45,6 +45,7 @@ files:
45
45
  - test/test_osxjvm.rb
46
46
  - test/test_osxload.rb
47
47
  - test/test_unload.rb
48
+ - test/Test$TestTypes.class
48
49
  - test/Two.class
49
50
  - test/TwoCaller.class
50
51
  - test/jp/co/infoseek/hp/arton/rjb/CallbackTest$Callback.class