Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into opto

  • Loading branch information...
commit ee64388932b01f0fedb0792e73edd467692e7059 2 parents 0b01e29 + 1d3d2ab
Charles Oliver Nutter headius authored
Showing with 16,171 additions and 2,138 deletions.
  1. +2 −2 Rakefile
  2. +2 −2 bench/bench_io_foreach.rb
  3. +27 −0 bench/bench_io_foreach_wide.rb
  4. +8 −24 bin/jruby
  5. 0  bin/jruby.dll
  6. 0  bin/jruby.exe
  7. 0  bin/jrubyw.exe
  8. +30 −2 build.xml
  9. BIN  build_lib/jaffl.jar
  10. BIN  build_lib/jffi-i386-FreeBSD.jar
  11. BIN  build_lib/jffi-x86_64-FreeBSD.jar
  12. BIN  build_lib/jnr-posix.jar
  13. BIN  build_lib/jsr223_stub.jar
  14. BIN  build_lib/junit-4.7.jar
  15. BIN  build_lib/ruby-debug-0.10.3.gem
  16. BIN  build_lib/ruby-debug-base-0.10.3.1-java.gem
  17. +1 −1  default.build.properties
  18. +60 −1 install/jruby.install4j
  19. +1 −1  ivy/build.xml
  20. +1 −1  ivy/ivy.xml
  21. +33 −3 lib/ruby/1.8/drb/drb.rb
  22. +32 −2 lib/ruby/1.9/drb/drb.rb
  23. +1 −2  lib/ruby/site_ruby/shared/builtin/java/java.util.rb
  24. +2 −2 nbproject/project.xml
  25. +1 −1  rubyspecs.revision
  26. +10 −6 spec/java_integration/types/array_spec.rb
  27. +0 −1  spec/tags/1.8/ruby/core/array/flatten_tags.txt
  28. +1 −0  spec/tags/1.8/ruby/core/io/popen_tags.txt
  29. +0 −1  spec/tags/1.8/ruby/library/iconv/close_tags.txt
  30. +0 −19 spec/tags/1.8/ruby/library/iconv/iconv_tags.txt
  31. +1 −0  spec/tags/1.8/ruby/library/matrix/collect_tags.txt
  32. +2 −0  spec/tags/1.8/ruby/library/matrix/column_tags.txt
  33. +1 −0  spec/tags/1.8/ruby/library/matrix/eql_tags.txt
  34. +1 −0  spec/tags/1.8/ruby/library/matrix/inspect_tags.txt
  35. +1 −0  spec/tags/1.8/ruby/library/matrix/inv_tags.txt
  36. +1 −0  spec/tags/1.8/ruby/library/matrix/inverse_tags.txt
  37. +1 −0  spec/tags/1.8/ruby/library/matrix/map_tags.txt
  38. +2 −0  spec/tags/1.8/ruby/library/matrix/minor_tags.txt
  39. +1 −0  spec/tags/1.8/ruby/library/matrix/row_tags.txt
  40. +1 −0  spec/tags/1.8/ruby/library/matrix/square_tags.txt
  41. +1 −0  spec/tags/1.8/ruby/library/matrix/t_tags.txt
  42. +1 −0  spec/tags/1.8/ruby/library/matrix/transpose_tags.txt
  43. 0  {lib/ruby/site_ruby/shared → src/builtin}/generator.rb
  44. 0  {lib/ruby/site_ruby/shared → src}/builtin/prelude.rb
  45. +32 −3 src/org/jruby/Ruby.java
  46. +17 −12 src/org/jruby/RubyArgsFile.java
  47. +31 −12 src/org/jruby/RubyArray.java
  48. +9 −4 src/org/jruby/RubyBasicObject.java
  49. +8 −1 src/org/jruby/RubyComplex.java
  50. +25 −8 src/org/jruby/RubyDigest.java
  51. +63 −56 src/org/jruby/RubyDir.java
  52. +2 −2 src/org/jruby/RubyEnumerable.java
  53. +17 −4 src/org/jruby/RubyFileStat.java
  54. +12 −5 src/org/jruby/RubyGlobal.java
  55. +136 −89 src/org/jruby/RubyIO.java
  56. +30 −11 src/org/jruby/RubyIconv.java
  57. +22 −14 src/org/jruby/RubyInstanceConfig.java
  58. +2 −2 src/org/jruby/RubyKernel.java
  59. +2 −2 src/org/jruby/RubyObject.java
  60. +8 −3 src/org/jruby/RubyObjectSpace.java
  61. +13 −0 src/org/jruby/RubyRange.java
  62. +11 −4 src/org/jruby/RubyRational.java
  63. +2 −2 src/org/jruby/RubyString.java
  64. +7 −0 src/org/jruby/RubySymbol.java
  65. +2 −1  src/org/jruby/RubyTempfile.java
  66. +1 −1  src/org/jruby/ast/executable/AbstractScript.java
  67. +0 −38 src/org/jruby/compiler/ir/IR_Class.java
  68. +66 −11 src/org/jruby/compiler/ir/IR_Method.java
  69. +41 −0 src/org/jruby/compiler/ir/IR_Module.java
  70. +7 −3 src/org/jruby/compiler/ir/IR_ScopeImpl.java
  71. +2 −2 src/org/jruby/compiler/ir/IR_Script.java
  72. +8 −7 src/org/jruby/compiler/ir/Operation.java
  73. +1 −1  src/org/jruby/compiler/ir/compiler_pass/AddFrameInstructions.java
  74. +2 −1  src/org/jruby/compiler/ir/compiler_pass/opts/DeadCodeElimination.java
  75. +4 −0 src/org/jruby/compiler/ir/compiler_pass/opts/LocalOptimizationPass.java
  76. +7 −0 src/org/jruby/compiler/ir/dataflow/DataFlowConstants.java
  77. +3 −1 src/org/jruby/compiler/ir/dataflow/FlowGraphNode.java
  78. +59 −28 src/org/jruby/compiler/ir/dataflow/analyses/FrameLoadPlacementNode.java
  79. +87 −3 src/org/jruby/compiler/ir/dataflow/analyses/FrameLoadPlacementProblem.java
  80. +105 −41 src/org/jruby/compiler/ir/dataflow/analyses/FrameStorePlacementNode.java
  81. +106 −10 src/org/jruby/compiler/ir/dataflow/analyses/FrameStorePlacementProblem.java
  82. +4 −3 src/org/jruby/compiler/ir/dataflow/analyses/LiveVariableNode.java
  83. +10 −4 src/org/jruby/compiler/ir/dataflow/analyses/LiveVariablesProblem.java
  84. +11 −2 src/org/jruby/compiler/ir/instructions/CALL_Instr.java
  85. +14 −0 src/org/jruby/compiler/ir/instructions/GET_CONST_Instr.java
  86. +19 −7 src/org/jruby/embed/AttributeName.java
  87. +8 −0 src/org/jruby/embed/EmbedEvalUnit.java
  88. +47 −0 src/org/jruby/embed/EmbedRubyInterfaceAdapter.java
  89. +3 −1 src/org/jruby/embed/EmbedRubyRuntimeAdapter.java
  90. +48 −0 src/org/jruby/embed/EvalFailedException.java
  91. +46 −0 src/org/jruby/embed/InvokeFailedException.java
  92. +47 −0 src/org/jruby/embed/ParseFailedException.java
  93. +42 −1 src/org/jruby/embed/PropertyName.java
  94. +52 −37 src/org/jruby/embed/ScriptingContainer.java
  95. +1 −2  src/org/jruby/embed/bsf/BsfJRubyEngine.properties
  96. +11 −5 src/org/jruby/embed/internal/BiVariableMap.java
  97. +17 −10 src/org/jruby/embed/internal/EmbedEvalUnitImpl.java
  98. +97 −0 src/org/jruby/embed/internal/EmbedRubyInterfaceAdapterImpl.java
  99. +133 −85 src/org/jruby/embed/internal/EmbedRubyObjectAdapterImpl.java
  100. +36 −17 src/org/jruby/embed/internal/EmbedRubyRuntimeAdapterImpl.java
  101. +15 −0 src/org/jruby/embed/io/ReaderInputStream.java
  102. +11 −0 src/org/jruby/embed/io/WriterOutputStream.java
  103. +20 −2 src/org/jruby/embed/jsr223/JRubyCompiledScript.java
  104. +7 −7 src/org/jruby/embed/jsr223/JRubyContext.java
  105. +61 −15 src/org/jruby/embed/jsr223/JRubyEngine.java
  106. +1 −2  src/org/jruby/embed/jsr223/Jsr223JRubyEngine.properties
  107. +2 −1  src/org/jruby/embed/jsr223/ServiceFinder.java
  108. +7 −0 src/org/jruby/embed/jsr223/Utils.java
  109. +45 −0 src/org/jruby/embed/util/SystemPropertyCatcher.java
  110. +36 −0 src/org/jruby/ext/mathn/Complex.java
  111. +36 −0 src/org/jruby/ext/mathn/Rational.java
  112. +1 −1  src/org/jruby/java/MiniJava.java
  113. +13 −10 src/org/jruby/java/proxies/ConcreteJavaProxy.java
  114. +0 −7 src/org/jruby/java/proxies/JavaProxy.java
  115. +6 −2 src/org/jruby/javasupport/JavaArray.java
  116. +1 −1  src/org/jruby/jruby.properties
  117. +1 −0  src/org/jruby/libraries/RbConfigLibrary.java
  118. +17 −0 src/org/jruby/libraries/ThreadLibrary.java
  119. +4 −0 src/org/jruby/runtime/ThreadContext.java
  120. +5 −1 src/org/jruby/runtime/callsite/CacheEntry.java
  121. +12 −13 src/org/jruby/runtime/callsite/CachingCallSite.java
  122. +2 −2 src/org/jruby/runtime/callsite/RespondToCallSite.java
  123. +10 −10 src/org/jruby/runtime/callsite/SuperCallSite.java
  124. +29 −31 src/org/jruby/runtime/load/LoadService.java
  125. +1 −1  test/externals/ruby1.8/digest/test_digest.rb
  126. +1 −1  test/externals/ruby1.8/drb/drbtest.rb
  127. +29 −23 test/externals/ruby1.8/erb/test_erb.rb
  128. +1 −1  test/externals/ruby1.8/fileutils/fileasserts.rb
  129. +1 −1  test/externals/ruby1.8/fileutils/test_dryrun.rb
  130. +1 −1  test/externals/ruby1.8/fileutils/test_fileutils.rb
  131. +1 −1  test/externals/ruby1.8/fileutils/test_nowrite.rb
  132. +1 −1  test/externals/ruby1.8/fileutils/test_verbose.rb
  133. +2 −2 test/externals/ruby1.8/gdbm/test_gdbm.rb
  134. +49 −0 test/externals/ruby1.8/iconv/test_basic.rb
  135. +31 −0 test/externals/ruby1.8/iconv/test_option.rb
  136. +41 −0 test/externals/ruby1.8/iconv/test_partial.rb
  137. +26 −0 test/externals/ruby1.8/iconv/utils.rb
  138. +4 −3 test/externals/ruby1.8/io/nonblock/test_flush.rb
  139. +4 −6 test/externals/ruby1.8/logger/test_logger.rb
  140. +43 −0 test/externals/ruby1.8/matrix/test_matrix.rb
  141. +43 −0 test/externals/ruby1.8/matrix/test_vector.rb
  142. +8 −1 test/externals/ruby1.8/net/http/test_https_proxy.rb
  143. +132 −0 test/externals/ruby1.8/net/pop/test_pop.rb
  144. +113 −0 test/externals/ruby1.8/openssl/test_ec.rb
  145. +301 −50 test/externals/ruby1.8/openssl/test_ssl.rb
  146. +23 −0 test/externals/ruby1.8/optparse/test_summary.rb
  147. +37 −0 test/externals/ruby1.8/ostruct/test_ostruct.rb
  148. +18 −17 test/externals/ruby1.8/pathname/test_pathname.rb
  149. +66 −0 test/externals/ruby1.8/rexml/test_document.rb
  150. +62 −57 test/externals/ruby1.8/rinda/test_rinda.rb
  151. BIN  test/externals/ruby1.8/rss/dot.png
  152. +1,728 −166 test/externals/ruby1.8/rss/rss-assertions.rb
  153. +192 −7 test/externals/ruby1.8/rss/rss-testcase.rb
  154. +54 −7 test/externals/ruby1.8/rss/test_1.0.rb
  155. +24 −4 test/externals/ruby1.8/rss/test_2.0.rb
  156. +681 −0 test/externals/ruby1.8/rss/test_atom.rb
  157. +39 −29 test/externals/ruby1.8/rss/test_content.rb
  158. +203 −113 test/externals/ruby1.8/rss/test_dublincore.rb
  159. +16 −6 test/externals/ruby1.8/rss/test_image.rb
  160. +2 −3 test/externals/ruby1.8/rss/test_inherit.rb
  161. +347 −0 test/externals/ruby1.8/rss/test_itunes.rb
  162. +93 −54 test/externals/ruby1.8/rss/test_maker_0.9.rb
  163. +129 −76 test/externals/ruby1.8/rss/test_maker_1.0.rb
  164. +47 −9 test/externals/ruby1.8/rss/test_maker_2.0.rb
  165. +367 −0 test/externals/ruby1.8/rss/test_maker_atom_entry.rb
  166. +389 −0 test/externals/ruby1.8/rss/test_maker_atom_feed.rb
  167. +13 −0 test/externals/ruby1.8/rss/test_maker_content.rb
  168. +7 −2 test/externals/ruby1.8/rss/test_maker_dc.rb
  169. +471 −0 test/externals/ruby1.8/rss/test_maker_itunes.rb
  170. +37 −0 test/externals/ruby1.8/rss/test_maker_slash.rb
  171. +1 −0  test/externals/ruby1.8/rss/test_maker_sy.rb
  172. +6 −2 test/externals/ruby1.8/rss/test_maker_xml-stylesheet.rb
  173. +14 −12 test/externals/ruby1.8/rss/test_parser.rb
  174. +0 −1  test/externals/ruby1.8/rss/test_parser_1.0.rb
  175. +163 −0 test/externals/ruby1.8/rss/test_parser_atom_entry.rb
  176. +276 −0 test/externals/ruby1.8/rss/test_parser_atom_feed.rb
  177. +19 −6 test/externals/ruby1.8/rss/test_setup_maker_0.9.rb
  178. +21 −5 test/externals/ruby1.8/rss/test_setup_maker_1.0.rb
  179. +409 −0 test/externals/ruby1.8/rss/test_setup_maker_atom_entry.rb
  180. +445 −0 test/externals/ruby1.8/rss/test_setup_maker_atom_feed.rb
  181. +144 −0 test/externals/ruby1.8/rss/test_setup_maker_itunes.rb
  182. +38 −0 test/externals/ruby1.8/rss/test_setup_maker_slash.rb
  183. +64 −0 test/externals/ruby1.8/rss/test_slash.rb
  184. +1 −3 test/externals/ruby1.8/rss/test_syndication.rb
  185. +231 −1 test/externals/ruby1.8/rss/test_to_s.rb
  186. +1 −1  test/externals/ruby1.8/rss/test_version.rb
  187. +3 −3 test/externals/ruby1.8/rss/test_xml-stylesheet.rb
  188. +6 −0 test/externals/ruby1.8/ruby/marshaltestlib.rb
  189. +1,144 −16 test/externals/ruby1.8/ruby/test_array.rb
  190. +3 −3 test/externals/ruby1.8/ruby/test_beginendblock.rb
  191. +11 −0 test/externals/ruby1.8/ruby/test_bignum.rb
  192. +258 −0 test/externals/ruby1.8/ruby/test_enum.rb
  193. +105 −0 test/externals/ruby1.8/ruby/test_enumerator.rb
  194. +2 −4 test/externals/ruby1.8/ruby/test_env.rb
  195. +673 −0 test/externals/ruby1.8/ruby/test_file_exhaustive.rb
  196. +26 −0 test/externals/ruby1.8/ruby/test_fixnum.rb
  197. +3 −1 test/externals/ruby1.8/ruby/test_hash.rb
  198. +653 −0 test/externals/ruby1.8/ruby/test_integer.rb
  199. +20 −0 test/externals/ruby1.8/ruby/test_io.rb
  200. +12 −14 test/externals/ruby1.8/ruby/test_iterator.rb
  201. +7 −0 test/externals/ruby1.8/ruby/test_marshal.rb
  202. +9 −9 test/externals/ruby1.8/ruby/test_method.rb
  203. +40 −0 test/externals/ruby1.8/ruby/test_pack.rb
  204. +16 −0 test/externals/ruby1.8/ruby/test_proc.rb
  205. +3 −3 test/externals/ruby1.8/ruby/test_settracefunc.rb
  206. +2 −1  test/externals/ruby1.8/ruby/test_signal.rb
  207. +10 −0 test/externals/ruby1.8/ruby/test_sleep.rb
  208. +15 −0 test/externals/ruby1.8/ruby/test_symbol.rb
  209. +0 −1  test/externals/ruby1.8/ruby/test_time.rb
  210. +1 −1  test/externals/ruby1.8/runner.rb
  211. +7 −36 test/externals/ruby1.8/thread/test_thread.rb
  212. +2 −3 test/externals/ruby1.8/uri/test_common.rb
  213. +21 −1 test/externals/ruby1.8/uri/test_ftp.rb
  214. +43 −37 test/externals/ruby1.8/uri/test_generic.rb
  215. +96 −0 test/externals/ruby1.8/xmlrpc/test_cookie.rb
  216. +1 −1  test/externals/ruby1.8/yaml/test_yaml.rb
  217. +74 −0 test/externals/ruby1.8/yaml/test_yamlstore.rb
  218. +2 −1  test/externals/ruby1.8/zlib/test_zlib.rb
  219. +5 −3 test/externals/ruby1.9/bigdecimal/test_bigdecimal.rb
  220. +78 −0 test/externals/ruby1.9/bigdecimal/test_bigmath.rb
  221. +10 −7 test/externals/ruby1.9/cgi/test_cgi_cookie.rb
  222. +1 −1  test/externals/ruby1.9/cgi/test_cgi_core.rb
  223. +2 −2 test/externals/ruby1.9/cgi/test_cgi_multipart.rb
  224. +2 −2 test/externals/ruby1.9/cgi/test_cgi_session.rb
  225. +1 −1  test/externals/ruby1.9/cgi/test_cgi_tag_helper.rb
  226. +37 −0 test/externals/ruby1.9/cgi/test_cgi_util.rb
  227. +23 −23 test/externals/ruby1.9/csv/test_csv_parsing.rb
  228. +3 −3 test/externals/ruby1.9/csv/test_csv_writing.rb
  229. +33 −33 test/externals/ruby1.9/csv/test_data_converters.rb
  230. +37 −33 test/externals/ruby1.9/csv/test_encodings.rb
  231. +37 −37 test/externals/ruby1.9/csv/test_features.rb
  232. +34 −34 test/externals/ruby1.9/csv/test_headers.rb
  233. +54 −54 test/externals/ruby1.9/csv/test_interface.rb
  234. +43 −43 test/externals/ruby1.9/csv/test_row.rb
  235. +26 −26 test/externals/ruby1.9/csv/test_serialization.rb
  236. +59 −59 test/externals/ruby1.9/csv/test_table.rb
  237. +8 −8 test/externals/ruby1.9/date/test_date_base.rb
  238. +7 −0 test/externals/ruby1.9/date/test_date_conv.rb
  239. +16 −1 test/externals/ruby1.9/date/test_date_parse.rb
  240. +1 −1  test/externals/ruby1.9/date/test_date_strftime.rb
  241. +1 −1  test/externals/ruby1.9/date/test_date_strptime.rb
  242. +2 −2 test/externals/ruby1.9/dbm/test_dbm.rb
  243. +1 −1  test/externals/ruby1.9/digest/test_digest.rb
  244. +87 −0 test/externals/ruby1.9/dl/test_base.rb
  245. +59 −0 test/externals/ruby1.9/dl/test_cfunc.rb
  246. +33 −0 test/externals/ruby1.9/dl/test_cptr.rb
  247. +112 −0 test/externals/ruby1.9/dl/test_dl2.rb
  248. +62 −0 test/externals/ruby1.9/dl/test_func.rb
  249. +154 −0 test/externals/ruby1.9/dl/test_import.rb
  250. +54 −0 test/externals/ruby1.9/dl/test_win32.rb
  251. +2 −8 test/externals/ruby1.9/drb/drbtest.rb
  252. +1 −1  test/externals/ruby1.9/drb/test_acl.rb
  253. +9 −9 test/externals/ruby1.9/drb/test_drb.rb
  254. +1 −1  test/externals/ruby1.9/drb/ut_large.rb
  255. +1 −1  test/externals/ruby1.9/drb/ut_safe1.rb
  256. +1 −1  test/externals/ruby1.9/drb/ut_timerholder.rb
  257. +3 −3 test/externals/ruby1.9/erb/test_erb.rb
  258. +1 −1  test/externals/ruby1.9/erb/test_erb_m17n.rb
  259. +11 −11 test/externals/ruby1.9/etc/test_etc.rb
  260. +2 −2 test/externals/ruby1.9/fileutils/fileasserts.rb
  261. +1 −1  test/externals/ruby1.9/fileutils/test_dryrun.rb
  262. +87 −57 test/externals/ruby1.9/fileutils/test_fileutils.rb
  263. +2 −2 test/externals/ruby1.9/fileutils/test_nowrite.rb
  264. +1 −1  test/externals/ruby1.9/fileutils/test_verbose.rb
  265. +1 −1  test/externals/ruby1.9/gdbm/test_gdbm.rb
  266. +4 −1 test/externals/ruby1.9/iconv/test_basic.rb
  267. +2 −2 test/externals/ruby1.9/iconv/test_option.rb
  268. +1 −1  test/externals/ruby1.9/iconv/test_partial.rb
  269. +79 −51 test/externals/ruby1.9/json/test_json.rb
  270. +9 −2 test/externals/ruby1.9/json/test_json_addition.rb
  271. +7 −2 test/externals/ruby1.9/json/test_json_fixtures.rb
  272. +17 −10 test/externals/ruby1.9/json/test_json_generate.rb
  273. +33 −1 test/externals/ruby1.9/json/test_json_rails.rb
  274. +5 −1 test/externals/ruby1.9/json/test_json_unicode.rb
  275. +12 −0 test/externals/ruby1.9/minitest/test_mini_spec.rb
  276. +2 −1  test/externals/ruby1.9/minitest/test_mini_test.rb
  277. +35 −0 test/externals/ruby1.9/mkmf/base.rb
  278. +12 −0 test/externals/ruby1.9/mkmf/test_sizeof.rb
  279. +2 −2 test/externals/ruby1.9/net/http/test_http.rb
  280. +1 −1  test/externals/ruby1.9/net/http/test_https_proxy.rb
  281. +158 −0 test/externals/ruby1.9/net/imap/test_imap.rb
  282. +1 −1  test/externals/ruby1.9/nkf/test_kconv.rb
  283. +726 −0 test/externals/ruby1.9/open-uri/test_open-uri.rb
  284. +314 −0 test/externals/ruby1.9/open-uri/test_ssl.rb
  285. +1 −1  test/externals/ruby1.9/openssl/ssl_server.rb
  286. +1 −1  test/externals/ruby1.9/openssl/test_ec.rb
  287. +106 −5 test/externals/ruby1.9/openssl/test_pair.rb
  288. +3 −3 test/externals/ruby1.9/openssl/test_pkcs7.rb
  289. +65 −12 test/externals/ruby1.9/openssl/test_ssl.rb
  290. +15 −15 test/externals/ruby1.9/openssl/test_x509cert.rb
  291. +3 −3 test/externals/ruby1.9/openssl/test_x509crl.rb
  292. +1 −1  test/externals/ruby1.9/openssl/utils.rb
  293. +2 −0  test/externals/ruby1.9/optparse/test_optparse.rb
  294. +8 −0 test/externals/ruby1.9/optparse/test_placearg.rb
  295. +15 −1 test/externals/ruby1.9/ostruct/test_ostruct.rb
  296. +93 −5 test/externals/ruby1.9/pathname/test_pathname.rb
  297. +24 −0 test/externals/ruby1.9/rake/capture_stdout.rb
  298. +5 −0 test/externals/ruby1.9/rake/check_expansion.rb
  299. +5 −0 test/externals/ruby1.9/rake/check_no_expansion.rb
  300. +55 −0 test/externals/ruby1.9/rake/contrib/test_ftp.rb
Sorry, we could not display the entire diff because too many files (627) changed.
4 Rakefile
View
@@ -39,7 +39,7 @@ Object.const_set(:BASE_DIR, Dir.pwd)
File.open("default.build.properties") do |props|
props.each_line do |line|
# skip comments
- next if line =~ /^\W*#/
+ next if line =~ /(^\W*#|^$)/
# build const name
name, value = line.split("=")
@@ -207,7 +207,7 @@ namespace :maven do
end
task :installer do
- ant "dist"
+ ant "dist" unless ENV['TESTING_INSTALLER']
sh "#{INSTALL4J_EXECUTABLE} -m win32 -D jruby.version=#{VERSION_JRUBY} " \
"install/jruby.install4j" do |ok, result|
$stderr.puts "** Something went wrong: #{result}" unless ok
4 bench/bench_io_foreach.rb
View
@@ -2,8 +2,8 @@
MAX = 1000
BLOCKSIZE = 16 * 1024
-LINE_SIZE = 10000
-LINES = 10
+LINE_SIZE = 10
+LINES = 10000
FILE = 'io_test_bench_file.txt'
File.open(FILE, 'w'){ |fh|
27 bench/bench_io_foreach_wide.rb
View
@@ -0,0 +1,27 @@
+require 'benchmark'
+
+MAX = 1000
+BLOCKSIZE = 16 * 1024
+LINE_SIZE = 10000
+LINES = 10
+FILE = 'io_test_bench_file.txt'
+
+File.open(FILE, 'w'){ |fh|
+ LINES.times{ |n|
+ LINE_SIZE.times { |t|
+ fh.print "This is time: #{t} "
+ }
+ fh.puts
+ }
+}
+stat = File.stat(FILE)
+(ARGV[0] || 5).to_i.times do
+ Benchmark.bm(30) do |x|
+ x.report('IO.foreach(file)'){
+ MAX.times{ IO.foreach(FILE){} }
+ }
+
+ end
+end
+File.delete(FILE) if File.exists?(FILE)
+
32 bin/jruby
View
@@ -19,16 +19,6 @@ case "`uname`" in
Darwin) darwin=true;;
esac
-#
-# Figure out the OS and cpu the same as JNA would, so the library path can be set
-#
-case "`uname -m`" in
- i[34567]86) JNA_CPU=i386; JNA_ALT_CPU=amd64;;
- i86pc) JNA_CPU="x86"; JNA_ALT_CPU=amd64;;
- amd64|x86_64) JNA_CPU=amd64; JNA_ALT_CPU=i386;;
- sparc*) JNA_CPU=sparc; JNA_ALT_CPU=sparcv9;;
-esac
-
# ----- Verify and Set Required Environment Variables -------------------------
## resolve links - $0 may be a link to home
@@ -143,6 +133,10 @@ fi
# ----- Execute The Requested Command -----------------------------------------
+if [ -z "$JAVA_MEM" ] ; then
+ JAVA_MEM=-Xmx500m
+fi
+
if [ -z "$JAVA_STACK" ] ; then
JAVA_STACK=-Xss1024k
fi
@@ -257,10 +251,7 @@ if [[ $darwin && -z "$JAVA_ENCODING" ]]; then
fi
# Add a property to report memory max
-JAVA_OPTS="$JAVA_OPTS $JAVA_VM -Djruby.stack.max=${JAVA_STACK:4}"
-if [ "$JAVA_MEM" ]; then
- JAVA_OPTS="$JAVA_OPTS -Djruby.memory.max=${JAVA_MEM:4}"
-fi
+JAVA_OPTS="$JAVA_OPTS $JAVA_VM -Djruby.memory.max=${JAVA_MEM:4} -Djruby.stack.max=${JAVA_STACK:4}"
# Append the rest of the arguments
ruby_args=("${ruby_args[@]}" "$@")
@@ -269,13 +260,6 @@ ruby_args=("${ruby_args[@]}" "$@")
set -- "${ruby_args[@]}"
JAVA_OPTS="$JAVA_OPTS $JAVA_MEM $JAVA_STACK"
-JNA_OS="`uname -s | tr '[:upper:]' '[:lower:]'`"
-case "$JNA_OS" in
-darwin) JNA_PATH="$JRUBY_HOME/lib/native/darwin";;
- *) JNA_PATH="$JRUBY_HOME/lib/native/${JNA_OS}-${JNA_CPU}:$JRUBY_HOME/lib/native/${JNA_OS}-${JNA_ALT_CPU}";;
-esac
-#JAVA_OPTS="$JAVA_OPTS -Djna.boot.library.path=$JNA_PATH"
-JAVA_JNA="-Djna.boot.library.path=$JNA_PATH"
JFFI_BOOT=""
for d in $JRUBY_HOME/lib/native/*`uname -s`; do
@@ -319,7 +303,7 @@ if [ "$VERIFY_JRUBY" != "" ]; then
echo "Running with instrumented profiler"
fi
- "$JAVA_CMD" $PROFILE_ARGS $JAVA_OPTS "$JAVA_JNA" "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
+ "$JAVA_CMD" $PROFILE_ARGS $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -classpath "$JRUBY_CP$CP_DELIMITER$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
@@ -342,7 +326,7 @@ if [ "$VERIFY_JRUBY" != "" ]; then
else
if $cygwin; then
# exec doed not work correctly with cygwin bash
- "$JAVA_CMD" $JAVA_OPTS "$JAVA_JNA" "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
+ "$JAVA_CMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
@@ -355,7 +339,7 @@ else
exit $JRUBY_STATUS
else
- exec "$JAVA_CMD" $JAVA_OPTS "$JAVA_JNA" "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
+ exec "$JAVA_CMD" $JAVA_OPTS "$JFFI_OPTS" "${java_args[@]}" -Xbootclasspath/a:"$JRUBY_CP" -classpath "$CP$CP_DELIMITER$CLASSPATH" \
"-Djruby.home=$JRUBY_HOME" \
"-Djruby.lib=$JRUBY_HOME/lib" -Djruby.script=jruby \
"-Djruby.shell=$JRUBY_SHELL" \
0  bin/jruby.dll 100644 → 100755
View
File mode changed
0  bin/jruby.exe 100644 → 100755
View
File mode changed
0  bin/jrubyw.exe 100644 → 100755
View
File mode changed
32 build.xml
View
@@ -18,6 +18,8 @@
<!-- Gem file names -->
<property name="rspec.gem" value="rspec-1.2.9.gem"/>
<property name="rake.gem" value="rake-0.8.7.gem"/>
+ <property name="ruby-debug.gem" value="ruby-debug-0.10.3.gem"/>
+ <property name="ruby-debug-base.gem" value="ruby-debug-base-0.10.3.1-java.gem"/>
<property name="shared.lib.dir" value="lib/ruby/site_ruby/shared"/>
@@ -429,8 +431,11 @@
<arg value="maybe_install_gems"/>
<arg value="${build.lib.dir}/${rspec.gem}"/>
<arg value="${build.lib.dir}/${rake.gem}"/>
+ <arg value="${build.lib.dir}/${ruby-debug-base.gem}"/>
+ <arg value="${build.lib.dir}/${ruby-debug.gem}"/>
<arg value="--no-ri"/>
<arg value="--no-rdoc"/>
+ <arg value="--ignore-dependencies"/>
<arg value="--env-shebang"/>
</java>
@@ -519,8 +524,11 @@
<arg value="maybe_install_gems"/>
<arg value="${build.lib.dir}/${rspec.gem}"/>
<arg value="${build.lib.dir}/${rake.gem}"/>
+ <arg value="${build.lib.dir}/${ruby-debug-base.gem}"/>
+ <arg value="${build.lib.dir}/${ruby-debug.gem}"/>
<arg value="--no-ri"/>
<arg value="--no-rdoc"/>
+ <arg value="--ignore-dependencies"/>
<arg value="--env-shebang"/>
</java>
@@ -595,7 +603,7 @@
</target>
<target name="compile-test" depends="jar" description="Compile the unit tests">
- <javac destdir="${test.classes.dir}" deprecation="true" debug="true"
+ <javac destdir="${test.classes.dir}" deprecation="true" encoding="UTF-8" debug="true"
source="${javac.version}">
<classpath>
<path refid="build.classpath"/>
@@ -627,8 +635,11 @@
<arg value="maybe_install_gems"/>
<arg value="${build.lib.dir}/${rspec.gem}"/>
<arg value="${build.lib.dir}/${rake.gem}"/>
+ <arg value="${build.lib.dir}/${ruby-debug-base.gem}"/>
+ <arg value="${build.lib.dir}/${ruby-debug.gem}"/>
<arg value="${install.ri}"/>
<arg value="${install.rdoc}"/>
+ <arg value="--ignore-dependencies"/>
<arg value="--env-shebang"/>
</java>
</target>
@@ -762,6 +773,7 @@
<target name="run-junit-interpreted-threadpool"><run-junit-1.8 thread.pooling="true"/></target>
<target name="run-junit-compiled-threadpool"><run-junit-1.8 compile.mode="JIT" jit.threshold="0" thread.pooling="true"/></target>
<target name="run-junit-precompiled-threadpool"><run-junit-1.8 compile.mode="FORCE" jit.threshold="0" thread.pooling="true"/></target>
+ <target name="run-junit-embed" depends="copy-test-files" description="Runs unit embedding API tests."><run-junit-embed-all/></target>
<path id="test.class.path">
<fileset dir="${build.lib.dir}" includes="*.jar">
@@ -906,7 +918,23 @@
</sequential>
</macrodef>
- <target name="test-security-manager">
+ <macrodef name="run-junit-embed-all">
+ <sequential>
+ <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpath="${build.lib.dir}/junit-4.7.jar"/>
+ <junit jvm="${jruby.test.jvm}" fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}" maxmemory="${jruby.test.memory}" showoutput="true" timeout="1800000">
+ <classpath refid="test.class.path"/>
+ <formatter type="xml"/>
+ <formatter type="brief" usefile="false" />
+ <batchtest fork="yes" todir="${test.results.dir}">
+ <fileset dir="${test.dir}">
+ <include name="org/jruby/embed/**/*Test*.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </sequential>
+ </macrodef>
+
+ <target name="test-security-manager" depends="jar-jruby">
<java classname="org.jruby.Main" fork="true" failonerror="false">
<classpath refid="test.class.path"/>
BIN  build_lib/jaffl.jar
View
Binary file not shown
BIN  build_lib/jffi-i386-FreeBSD.jar
View
Binary file not shown
BIN  build_lib/jffi-x86_64-FreeBSD.jar
View
Binary file not shown
BIN  build_lib/jnr-posix.jar
View
Binary file not shown
BIN  build_lib/jsr223_stub.jar
View
Binary file not shown
BIN  build_lib/junit-4.7.jar
View
Binary file not shown
BIN  build_lib/ruby-debug-0.10.3.gem
View
Binary file not shown
BIN  build_lib/ruby-debug-base-0.10.3.1-java.gem
View
Binary file not shown
2  default.build.properties
View
@@ -31,6 +31,6 @@ jruby.test.memory=512M
jruby.test.jvm=java
ruby.executable=/usr/bin/ruby
install4j.executable=/Applications/install4j\ 4/bin/install4jc
-version.jruby=1.5.0dev
+version.jruby=1.5.0.dev
version.ruby.major=1.8
version.ruby.minor=7
61 install/jruby.install4j
View
@@ -41,6 +41,7 @@
<entry location="bench" fileType="regular" />
<entry location="bin" fileType="regular" />
<entry location="build" fileType="regular" />
+ <entry location="build-config.xml" fileType="regular" />
<entry location="build.xml" fileType="regular" />
<entry location="build_lib" fileType="regular" />
<entry location="default.build.properties" fileType="regular" />
@@ -186,6 +187,61 @@
</actions>
<formComponents />
</screen>
+ <screen name="" id="149" beanClass="com.install4j.runtime.beans.screens.FormScreen" enabled="true" commentSet="false" comment="" rollbackBarrier="false" backButton="2" finishScreen="false">
+ <serializedBean>
+ <java class="java.beans.XMLDecoder">
+ <object class="com.install4j.runtime.beans.screens.FormScreen" />
+ </java>
+ </serializedBean>
+ <condition />
+ <validation />
+ <preActivation />
+ <postActivation />
+ <actions />
+ <formComponents>
+ <formComponent name="" id="153" beanClass="com.install4j.runtime.beans.formcomponents.MultilineHtmlLabelComponent" enabled="true" commentSet="false" comment="" insetTop="" insetLeft="" insetBottom="" insetRight="" resetInitOnPrevious="false">
+ <serializedBean>
+ <java class="java.beans.XMLDecoder">
+ <object class="com.install4j.runtime.beans.formcomponents.MultilineHtmlLabelComponent">
+ <void property="labelHtml">
+ <string>The installer will by default set up your PATH so you can run JRuby easily. Some users have special needs and want to do this step manually. Unless you are one of those users just press next.</string>
+ </void>
+ </object>
+ </java>
+ </serializedBean>
+ <initScript />
+ <visibiltyScript />
+ </formComponent>
+ <formComponent name="" id="152" beanClass="com.install4j.runtime.beans.formcomponents.SpacerComponent" enabled="true" commentSet="false" comment="" insetTop="" insetLeft="" insetBottom="" insetRight="" resetInitOnPrevious="false">
+ <serializedBean>
+ <java class="java.beans.XMLDecoder">
+ <object class="com.install4j.runtime.beans.formcomponents.SpacerComponent" />
+ </java>
+ </serializedBean>
+ <initScript />
+ <visibiltyScript />
+ </formComponent>
+ <formComponent name="" id="151" beanClass="com.install4j.runtime.beans.formcomponents.CheckboxComponent" enabled="true" commentSet="false" comment="" insetTop="" insetLeft="" insetBottom="" insetRight="" resetInitOnPrevious="false">
+ <serializedBean>
+ <java class="java.beans.XMLDecoder">
+ <object class="com.install4j.runtime.beans.formcomponents.CheckboxComponent">
+ <void property="checkboxText">
+ <string>Configure Path for me (recommended)</string>
+ </void>
+ <void property="initiallySelected">
+ <boolean>true</boolean>
+ </void>
+ <void property="variableName">
+ <string>configure.path</string>
+ </void>
+ </object>
+ </java>
+ </serializedBean>
+ <initScript />
+ <visibiltyScript />
+ </formComponent>
+ </formComponents>
+ </screen>
<screen name="" id="5" beanClass="com.install4j.runtime.beans.screens.ComponentsScreen" enabled="true" commentSet="false" comment="" rollbackBarrier="false" backButton="2" finishScreen="false">
<serializedBean>
<java class="java.beans.XMLDecoder">
@@ -237,7 +293,7 @@
</object>
</java>
</serializedBean>
- <condition />
+ <condition>context.getBooleanVariable("configure.path")</condition>
</action>
<action name="Set Windows JAVA_HOME" id="63" beanClass="com.install4j.runtime.beans.actions.misc.ModifyEnvironmentVariableAction" enabled="true" commentSet="false" comment="" rollbackBarrier="false" multiExec="false" failureStrategy="1" errorMessage="">
<serializedBean>
@@ -261,6 +317,9 @@
<serializedBean>
<java class="java.beans.XMLDecoder">
<object class="com.install4j.runtime.beans.actions.desktop.CreateProgramGroupAction">
+ <void property="allUsers">
+ <boolean>false</boolean>
+ </void>
<void property="programGroupName">
<string>${compiler:sys.fullName} ${compiler:sys.version}</string>
</void>
2  ivy/build.xml
View
@@ -53,7 +53,7 @@
<taskdef name="findbugs" classpathref="check.path" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
<findbugs classpathref="check.path" pluginList="" output="html" outputfile="${basedir}/jruby-findbugs.html"
- excludefilter="${basedir}/findbugs.xml">
+ excludefilter="${basedir}/findbugs.xml" jvmargs="-Xmx512M">
<sourcepath path="${basedir}/source" />
<class location="${jruby.classes.dir}" />
<auxclasspath>
2  ivy/ivy.xml
View
@@ -10,6 +10,6 @@
<artifact name="jruby-sources" />
</publications>
<dependencies>
- <dependency org="com.google.code.findbugs" name="findbugs" rev="1.3.8" conf="check->*" />
+ <dependency org="com.google.code.findbugs" name="findbugs" rev="1.3.9" conf="check->*" />
</dependencies>
</ivy-module>
36 lib/ruby/1.8/drb/drb.rb
View
@@ -54,6 +54,7 @@
require 'socket'
require 'thread'
require 'fcntl'
+require 'weakref'
require 'drb/eq'
#
@@ -366,22 +367,51 @@ class DRbConnError < DRbError; end
# For alternative mechanisms, see DRb::TimerIdConv in rdb/timeridconv.rb
# and DRbNameIdConv in sample/name.rb in the full drb distribution.
class DRbIdConv
+ def initialize
+ @id2ref = {}
+ end
# Convert an object reference id to an object.
#
# This implementation looks up the reference id in the local object
# space and returns the object it refers to.
def to_obj(ref)
- ObjectSpace._id2ref(ref)
+ _get(ref)
end
-
+
# Convert an object into a reference id.
#
# This implementation returns the object's __id__ in the local
# object space.
def to_id(obj)
- obj.nil? ? nil : obj.__id__
+ obj.nil? ? nil : _put(obj)
+ end
+
+ def _clean
+ dead = []
+ @id2ref.each {|id,weakref| dead << id unless weakref.weakref_alive?}
+ dead.each {|id| @id2ref.delete(id)}
+ end
+
+ def _put(obj)
+ _clean
+ @id2ref[obj.__id__] = WeakRef.new(obj)
+ obj.__id__
+ end
+
+ def _get(id)
+ weakref = @id2ref[id]
+ if weakref
+ result = weakref.__getobj__ rescue nil
+ if result
+ return result
+ else
+ @id2ref.delete id
+ end
+ end
+ nil
end
+ private :_clean, :_put, :_get
end
# Mixin module making an object undumpable or unmarshallable.
34 lib/ruby/1.9/drb/drb.rb
View
@@ -54,6 +54,7 @@
require 'socket'
require 'thread'
require 'fcntl'
+require 'weakref'
require 'drb/eq'
#
@@ -366,13 +367,16 @@ class DRbConnError < DRbError; end
# For alternative mechanisms, see DRb::TimerIdConv in rdb/timeridconv.rb
# and DRbNameIdConv in sample/name.rb in the full drb distribution.
class DRbIdConv
+ def initialize
+ @id2ref = {}
+ end
# Convert an object reference id to an object.
#
# This implementation looks up the reference id in the local object
# space and returns the object it refers to.
def to_obj(ref)
- ObjectSpace._id2ref(ref)
+ _get(ref)
end
# Convert an object into a reference id.
@@ -380,8 +384,34 @@ def to_obj(ref)
# This implementation returns the object's __id__ in the local
# object space.
def to_id(obj)
- obj.nil? ? nil : obj.__id__
+ obj.nil? ? nil : _put(obj)
+ end
+
+ def _clean
+ dead = []
+ @id2ref.each {|id,weakref| dead << id unless weakref.weakref_alive?}
+ dead.each {|id| @id2ref.delete(id)}
+ end
+
+ def _put(obj)
+ _clean
+ @id2ref[obj.__id__] = WeakRef.new(obj)
+ obj.__id__
+ end
+
+ def _get(id)
+ weakref = @id2ref[id]
+ if weakref
+ result = weakref.__getobj__ rescue nil
+ if result
+ return result
+ else
+ @id2ref.delete id
+ end
+ end
+ nil
end
+ private :_clean, :_put, :_get
end
# Mixin module making an object undumpable or unmarshallable.
3  lib/ruby/site_ruby/shared/builtin/java/java.util.rb
View
@@ -101,8 +101,7 @@ def compare(o1, o2)
end
end.new
- # This should probably return a new instance of self class instead of ArrayList
- list = self.class.new
+ list = java::util::ArrayList.new
list.addAll(self)
java::util::Collections.sort(list, comparator)
4 nbproject/project.xml
View
@@ -169,7 +169,7 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>${src.dir}</package-root>
- <classpath mode="compile">build_lib/junit.jar:build_lib/jline-0.9.93.jar:build_lib/jna.jar:build_lib/nailgun-0.7.1.jar:build_lib/joni.jar:build_lib/dynalang-0.3.jar:build_lib/invokedynamic.jar:build_lib/jcodings.jar:build_lib/constantine.jar:build_lib/bytelist.jar:build_lib/jffi.jar:build_lib/yydebug.jar:build_lib/bsf.jar:build_lib/jaffl.jar:build_lib/asm-3.2.jar:build_lib/asm-analysis-3.2.jar:build_lib/asm-commons-3.2.jar:build_lib/asm-tree-3.2.jar:build_lib/asm-util-3.2.jar:build_lib/jsr292-mock.jar:build_lib/jgrapht-jdk1.5.jar:build_lib/jnr-posix.jar:build_lib/jsr223_stub.jar:build_lib/joda-time-1.6.jar</classpath>
+ <classpath mode="compile">build_lib/junit.jar:build_lib/jline-0.9.93.jar:build_lib/jna.jar:build_lib/nailgun-0.7.1.jar:build_lib/joni.jar:build_lib/dynalang-0.3.jar:build_lib/invokedynamic.jar:build_lib/jcodings.jar:build_lib/constantine.jar:build_lib/bytelist.jar:build_lib/jffi.jar:build_lib/yydebug.jar:build_lib/bsf.jar:build_lib/jaffl.jar:build_lib/asm-3.2.jar:build_lib/asm-analysis-3.2.jar:build_lib/asm-commons-3.2.jar:build_lib/asm-tree-3.2.jar:build_lib/asm-util-3.2.jar:build_lib/jsr292-mock.jar:build_lib/jgrapht-jdk1.5.jar:build_lib/jnr-posix.jar:build_lib/joda-time-1.6.jar:build_lib/livetribe-jsr223-2.0.6.jar</classpath>
<built-to>${jruby.classes.dir}</built-to>
<built-to>${lib.dir}/jruby.jar</built-to>
<javadoc-built-to>docs/api</javadoc-built-to>
@@ -178,7 +178,7 @@
<compilation-unit>
<package-root>${test.dir}</package-root>
<unit-tests/>
- <classpath mode="compile">build_lib/bsf.jar:build/classes/jruby:build_lib/junit.jar:build_lib/joda-time-1.5.1.jar:build_lib/jna.jar:build_lib/bytelist.jar:build_lib/asm-3.2.jar:build_lib/jnr-posix.jar</classpath>
+ <classpath mode="compile">build_lib/bsf.jar:build/classes/jruby:build_lib/junit.jar:build_lib/joda-time-1.5.1.jar:build_lib/jna.jar:build_lib/bytelist.jar:build_lib/asm-3.2.jar:build_lib/jnr-posix.jar:build_lib/junit-4.7.jar:build_lib/livetribe-jsr223-2.0.6.jar</classpath>
<built-to>${test.classes.dir}</built-to>
<source-level>1.5</source-level>
</compilation-unit>
2  rubyspecs.revision
View
@@ -3,4 +3,4 @@
mspec.revision=bcec47c70e0678a29fd0c1345358c4daf7b971a3
-rubyspecs.revision=fdd3ced44f89419f243835fe030ade8b0100ba00
+rubyspecs.revision=b31860873b59e6894e1677cc5916d030fc6dc354
16 spec/java_integration/types/array_spec.rb
View
@@ -537,7 +537,7 @@
it "should be possible to create primitive array from Ruby array" do
# Check with symbol name
- arr = ["foo","bar"].to_java :string
+ arr = ["foo", :bar].to_java :string
arr.java_class.to_s.should == "[Ljava.lang.String;"
arr.length.should == 2
@@ -547,7 +547,7 @@
# Check with type
- arr = ["foo","bar"].to_java java.lang.String
+ arr = ["foo", :bar].to_java java.lang.String
arr.java_class.to_s.should == "[Ljava.lang.String;"
arr.length.should == 2
@@ -559,25 +559,25 @@
it "should be possible to set values in primitive array" do
arr = java.lang.String[5].new
arr[0] = "12"
- arr[1] = "20"
+ arr[1] = :blah
arr[2] = "42"
arr[0].should == "12"
- arr[1].should == "20"
+ arr[1].should == "blah"
arr[2].should == "42"
arr[3].should be_nil
arr[4].should be_nil
end
it "should be possible to get values from primitive array" do
- arr = ["flurg", "glax", "morg"].to_java :string
+ arr = ["flurg", :glax, "morg"].to_java :string
arr[0].should == "flurg"
arr[1].should == "glax"
arr[2].should == "morg"
end
it "should be possible to call methods that take primitive array" do
- arr = ["flurg", "glax", "morg"].to_java :string
+ arr = ["flurg", :glax, "morg"].to_java :string
ret = ArrayReceiver::call_with_string(arr)
ret.to_a.should == ["flurg", "glax", "morg"]
end
@@ -678,6 +678,10 @@
ary[4].class.should == FalseClass
ary[5].class.should == NilClass
end
+
+ it "should raise ArgumentError when types can't be coerced" do
+ lambda { [Time.new].to_java :string }.should raise_error(ArgumentError)
+ end
end
describe "Class ref" do
1  spec/tags/1.8/ruby/core/array/flatten_tags.txt
View
@@ -1 +0,0 @@
-fails(emulating Ruby 1.8.7 bugs):Array#flatten! returns nil when the level of recursion is 0
1  spec/tags/1.8/ruby/core/io/popen_tags.txt
View
@@ -1 +1,2 @@
fails(JRUBY-4093,macos,hang):IO::popen allows the io to be closed inside the block
+fails(JRUBY-4171,linux,intermittent failure):IO::popen writes to a write-only pipe
1  spec/tags/1.8/ruby/library/iconv/close_tags.txt
View
@@ -1,2 +1 @@
fails(JRUBY-2543):Iconv#close returns a string containing the byte sequence to change the output buffer to its initial shift state
-fails(JRUBY-2543):Iconv#close ignores multiple calls
19 spec/tags/1.8/ruby/library/iconv/iconv_tags.txt
View
@@ -1,22 +1,3 @@
-fails(JRUBY-2543):Iconv#iconv keeps context between calls
-fails(JRUBY-2543):Iconv#iconv when given nil resets the converter
-fails(JRUBY-2543):Iconv#iconv raises Iconv::IllegalSequence when faced with an invalid byte
-fails(JRUBY-2543):Iconv#iconv raises Iconv::IllegalSequence when a character cannot be represented on the target encoding
fails(JRUBY-2543):Iconv#iconv raises Iconv::InvalidCharacter when an incomplete character or shift sequence happens at the end of the input buffer
-fails(JRUBY-2543):Iconv#iconv ignores characters which cannot be represented in the target encoding when the //ignore option is set for the target encoding
-fails(JRUBY-2543):Iconv#iconv transliterates characters which cannot be accurately represented in the target encoding when the //translit option is set for the target encoding
-fails(JRUBY-2543):Iconv.iconv converts a series of strings with a single converter
-fails(JRUBY-2543):Iconv.iconv acts exactly as if invoking Iconv#iconv consecutively on the same converter
-fails(JRUBY-2543):Iconv#iconv when given the same source and target encodings still goes through all the decoding and encoding steps
-fails(JRUBY-2543):Iconv#iconv raises Iconv::IllegalSequence when faced with an invalid byte for the source encoding
-fails(JRUBY-2543):The 'us-ascii' decoder accepts only the strict 7-bit ASCII set
-fails(JRUBY-2543):The 'us-ascii' encoder accepts only the strict 7-bit ASCII set
-fails(JRUBY-2543):The 'utf-8' decoder accepts only strictly valid UTF-8 sequences
-fails(JRUBY-2543):The 'utf-8' decoder rejects surrogate characters
-fails(JRUBY-2543):The 'utf-16' decoder rejects surrogates without pairs
-fails(JRUBY-2543):The 'utf-16' encoder emits a byte-order mark on first non-empty output
fails(JRUBY-2543):The 'utf-16be' decoder treats possible byte-order marks as regular characters
fails(JRUBY-2543):The 'utf-16le' decoder treats possible byte-order marks as regular characters
-fails(JRUBY-2543):The 'iso-8859-1' encoder rejects characters which are not in the ISO-8859-1 range
-fails(JRUBY-2543):Iconv#iconv when given a positive length
-fails(JRUBY-2543):Iconv#iconv when given a negative length
1  spec/tags/1.8/ruby/library/matrix/collect_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#collect returns an enumerator if no block is given
2  spec/tags/1.8/ruby/library/matrix/column_tags.txt
View
@@ -1 +1,3 @@
fails(JRUBY-3716):Matrix#column returns nil when out of bounds
+fails(JRUBY-4176):Matrix#column returns self when called with a block
+fails(JRUBY-4176):Matrix#column never yields when out of bounds
1  spec/tags/1.8/ruby/library/matrix/eql_tags.txt
View
@@ -2,3 +2,4 @@ fails(JRUBY-3321):Matrix#eql? returns true when the each corresponding elements
fails(JRUBY-3321):Matrix#eql? returns false when there are a pair corresponding elements which are not equal in the sense of Object#eql?
fails(JRUBY-3716):Matrix#eql? returns true when the each corresponding elements are equal in the sense of Object#eql?
fails(JRUBY-3716):Matrix#eql? returns false when there are a pair corresponding elements which are not equal in the sense of Object#eql?
+fails(JRUBY-4176):Matrix#eql? returns false if some elements are == but not eql?
1  spec/tags/1.8/ruby/library/matrix/inspect_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#inspect returns 'Matrix.empty(...)' for empty matrices
1  spec/tags/1.8/ruby/library/matrix/inv_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#inv returns the inverse of the Matrix (other case)
1  spec/tags/1.8/ruby/library/matrix/inverse_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#inverse returns the inverse of the Matrix (other case)
1  spec/tags/1.8/ruby/library/matrix/map_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#map returns an enumerator if no block is given
2  spec/tags/1.8/ruby/library/matrix/minor_tags.txt
View
@@ -1,3 +1,5 @@
fails(JRUBY-3716):Matrix#minor with start_row, nrows, start_col, ncols returns an empty Matrix unless nrows and ncols are greater than 0
fails(JRUBY-3716):Matrix#minor with start_row, nrows, start_col, ncols returns nil for out-of-bounds start_row/col
fails(JRUBY-3716):Matrix#minor with col_range, row_range returns an empty Matrix if col_range or row_range don't select any elements
+fails(JRUBY-4176):Matrix#minor with start_row, nrows, start_col, ncols returns nil for negative nrows or ncols
+fails(JRUBY-4176):Matrix#minor with col_range, row_range returns nil if col_range or row_range is out of range
1  spec/tags/1.8/ruby/library/matrix/row_tags.txt
View
@@ -1,2 +1,3 @@
fails(JRUBY-3716):Matrix#row returns self when called with a block
fails(JRUBY-3716):Matrix#row returns nil when out of bounds
+fails(JRUBY-4176):Matrix#row never yields when out of bounds
1  spec/tags/1.8/ruby/library/matrix/square_tags.txt
View
@@ -1 +1,2 @@
fails(JRUBY-3716):"Matrix#square? returns false when the Matrix is not square\n and the first row has the same number of columns as the matrix has rows."
+fails(JRUBY-4176):Matrix#square? returns handles empty matrices
1  spec/tags/1.8/ruby/library/matrix/t_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#transpose can transpose empty matrices
1  spec/tags/1.8/ruby/library/matrix/transpose_tags.txt
View
@@ -0,0 +1 @@
+fails(JRUBY-4176):Matrix#transpose can transpose empty matrices
0  lib/ruby/site_ruby/shared/generator.rb → src/builtin/generator.rb
View
File renamed without changes
0  lib/ruby/site_ruby/shared/builtin/prelude.rb → src/builtin/prelude.rb
View
File renamed without changes
35 src/org/jruby/Ruby.java
View
@@ -537,7 +537,7 @@ public IRubyObject runNormally(Node scriptNode) {
boolean compile = getInstanceConfig().getCompileMode().shouldPrecompileCLI();
boolean forceCompile = getInstanceConfig().getCompileMode().shouldPrecompileAll();
if (compile) {
- script = tryCompile(scriptNode);
+ script = tryCompile(scriptNode, jrubyClassLoader, config.isShowBytecode());
if (forceCompile && script == null) {
return getNil();
}
@@ -560,6 +560,10 @@ public Script tryCompile(Node node) {
}
private Script tryCompile(Node node, JRubyClassLoader classLoader) {
+ return tryCompile(node, classLoader, false);
+ }
+
+ private Script tryCompile(Node node, JRubyClassLoader classLoader, boolean dump) {
Script script = null;
try {
String filename = node.getPosition().getFile();
@@ -570,7 +574,7 @@ private Script tryCompile(Node node, JRubyClassLoader classLoader) {
StandardASMCompiler asmCompiler = new StandardASMCompiler(classname, filename);
ASTCompiler compiler = config.newCompiler();
- if (config.isShowBytecode()) {
+ if (dump) {
compiler.compileRoot(node, asmCompiler, inspector, false, false);
asmCompiler.dumpClass(System.out);
} else {
@@ -1373,6 +1377,10 @@ private void initBuiltins() {
addLazyBuiltin("ffi-internal.jar", "ffi-internal", "org.jruby.ext.ffi.Factory$Service");
addLazyBuiltin("tempfile.rb", "tempfile", "org.jruby.libraries.TempfileLibrary");
addLazyBuiltin("fcntl.rb", "fcntl", "org.jruby.libraries.FcntlLibrary");
+ if (is1_9()) {
+ addLazyBuiltin("mathn/complex.jar", "mathn/complex", "org.jruby.ext.mathn.Complex");
+ addLazyBuiltin("mathn/rational.jar", "mathn/rational", "org.jruby.ext.mathn.Rational");
+ }
if(RubyInstanceConfig.NATIVE_NET_PROTOCOL) {
addLazyBuiltin("net/protocol.rb", "net/protocol", "org.jruby.libraries.NetProtocolBufferedIOLibrary");
@@ -1395,7 +1403,7 @@ public void load(Ruby runtime, boolean wrap) throws IOException {
"yaml/rubytypes", "yaml/store", "yaml/stream",
"yaml/stringio", "yaml/tag", "yaml/types",
"yaml/yamlnode", "yaml/ypath",
- "jsignal" };
+ "jsignal", "generator", "prelude"};
for (String library : builtins) {
addBuiltinIfAllowed(library + ".rb", new BuiltinScript(library));
}
@@ -1442,6 +1450,22 @@ public void setCurrentDirectory(String dir) {
public String getCurrentDirectory() {
return currentDirectory;
}
+
+ public void setCurrentLine(int line) {
+ currentLine = line;
+ }
+
+ public int getCurrentLine() {
+ return currentLine;
+ }
+
+ public void setArgsFile(IRubyObject argsFile) {
+ this.argsFile = argsFile;
+ }
+
+ public IRubyObject getArgsFile() {
+ return argsFile;
+ }
public RubyModule getEtc() {
return etcModule;
@@ -3458,6 +3482,11 @@ public Object getHierarchyLock() {
// former java.lang.System concepts now internalized for MVM
private String currentDirectory;
+ // The "current line" global variable
+ private int currentLine = 0;
+
+ private IRubyObject argsFile;
+
private long startTime = System.currentTimeMillis();
private final RubyInstanceConfig config;
29 src/org/jruby/RubyArgsFile.java
View
@@ -41,6 +41,7 @@
import org.jruby.ext.posix.FileStat;
import org.jruby.ext.posix.util.Platform;
import org.jruby.runtime.Block;
+import org.jruby.runtime.IAccessor;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ByteList;
@@ -170,24 +171,29 @@ private void inplaceEdit(ThreadContext context, String filename, String extensio
}
}
- public static void setCurrentLineNumber(IRubyObject recv, IRubyObject newLineNumber) {
+ public static void setCurrentLineNumber(IRubyObject recv, int newLineNumber) {
ArgsFileData data = ArgsFileData.getDataFrom(recv);
if (data != null) {
- int lineno = RubyNumeric.fix2int(newLineNumber);
- data.currentLineNumber = lineno;
- if (data.currentFile != null && !data.currentFile.isNil() && !(((RubyIO)data.currentFile).isClosed())) {
- data.currentFile.callMethod(recv.getRuntime().getCurrentContext(), "lineno=", newLineNumber);
- }
+ data.currentLineNumber = newLineNumber;
}
}
- public static void initArgsFile(Ruby runtime) {
+ public static void initArgsFile(final Ruby runtime) {
RubyObject argsFile = new RubyObject(runtime, runtime.getObject());
runtime.getEnumerable().extend_object(argsFile);
-
- runtime.defineReadonlyVariable("$<", argsFile);
+
+ runtime.setArgsFile(argsFile);
+ runtime.getGlobalVariables().defineReadonly("$<", new IAccessor() {
+ public IRubyObject getValue() {
+ return runtime.getArgsFile();
+ }
+
+ public IRubyObject setValue(IRubyObject newValue) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+ });
runtime.defineGlobalConstant("ARGF", argsFile);
RubyClass argfClass = argsFile.getMetaClass();
@@ -226,7 +232,7 @@ private static IRubyObject argf_getline(ThreadContext context, IRubyObject recv,
}
if (!line.isNil()) {
- context.getRuntime().getGlobalVariables().set("$.", context.getRuntime().newFixnum(data.currentLineNumber));
+ context.getRuntime().setCurrentLine(data.currentLineNumber);
}
return line;
@@ -495,8 +501,7 @@ public static IRubyObject lineno(ThreadContext context, IRubyObject recv) {
public static IRubyObject lineno_set(ThreadContext context, IRubyObject recv, IRubyObject line) {
ArgsFileData data = ArgsFileData.getDataFrom(recv);
data.currentLineNumber = RubyNumeric.fix2int(line);
-// data.currentFile.callMethod(context, "lineno=", line);
- context.getRuntime().getGlobalVariables().set("$.", line);
+ context.getRuntime().setCurrentLine(data.currentLineNumber);
return recv.getRuntime().getNil();
}
43 src/org/jruby/RubyArray.java
View
@@ -2432,9 +2432,22 @@ public IRubyObject zip(ThreadContext context, IRubyObject[] args, Block block) {
*/
@JRubyMethod(name = "<=>", required = 1)
public IRubyObject op_cmp(ThreadContext context, IRubyObject obj) {
- Ruby runtime = context.getRuntime();
- RubyArray ary2 = obj.convertToArray();
+ Ruby runtime = context.getRuntime();
+ IRubyObject ary2 = runtime.getNil();
+ boolean isAnArray = (obj instanceof RubyArray) || obj.getMetaClass().getSuperClass() == runtime.getArray();
+
+ if (!isAnArray && !obj.respondsTo("to_ary")) {
+ return ary2;
+ } else if (!isAnArray) {
+ ary2 = obj.callMethod(context, "to_ary");
+ } else {
+ ary2 = obj.convertToArray();
+ }
+
+ return cmpCommon(context, runtime, (RubyArray) ary2);
+ }
+ private IRubyObject cmpCommon(ThreadContext context, Ruby runtime, RubyArray ary2) {
if (this == ary2 || runtime.isInspecting(this)) return RubyFixnum.zero(runtime);
try {
@@ -2475,9 +2488,8 @@ public IRubyObject slice_bang(IRubyObject[] args) {
}
}
- private IRubyObject slice_internal(long pos, long len, IRubyObject arg0, IRubyObject arg1) {
- Ruby runtime = getRuntime();
-
+ private IRubyObject slice_internal(long pos, long len,
+ IRubyObject arg0, IRubyObject arg1, Ruby runtime) {
if(len < 0) return runtime.getNil();
int orig_len = realLength;
if(pos < 0) {
@@ -2488,6 +2500,7 @@ private IRubyObject slice_internal(long pos, long len, IRubyObject arg0, IRubyOb
} else if(orig_len < pos) {
return runtime.getNil();
}
+
if(orig_len < pos + len) {
len = orig_len - pos;
}
@@ -2495,7 +2508,7 @@ private IRubyObject slice_internal(long pos, long len, IRubyObject arg0, IRubyOb
return runtime.newEmptyArray();
}
- arg1 = makeShared((int)pos, (int)len, getMetaClass());
+ arg1 = makeShared(begin + (int)pos, (int)len, getMetaClass());
splice(pos, len, null);
return arg1;
@@ -2507,11 +2520,17 @@ private IRubyObject slice_internal(long pos, long len, IRubyObject arg0, IRubyOb
@JRubyMethod(name = "slice!")
public IRubyObject slice_bang(IRubyObject arg0) {
modifyCheck();
+ Ruby runtime = getRuntime();
if (arg0 instanceof RubyRange) {
- long[] beglen = ((RubyRange) arg0).begLen(realLength, 1);
+ RubyRange range = (RubyRange) arg0;
+ if (!range.checkBegin(realLength)) {
+ return runtime.getNil();
+ }
+
+ long[] beglen = range.begLen(realLength, 1);
long pos = beglen[0];
long len = beglen[1];
- return slice_internal(pos, len, arg0, null);
+ return slice_internal(pos, len, arg0, null, runtime);
}
return delete_at((int) RubyNumeric.num2long(arg0));
}
@@ -2524,7 +2543,7 @@ public IRubyObject slice_bang(IRubyObject arg0, IRubyObject arg1) {
modifyCheck();
long pos = RubyNumeric.num2long(arg0);
long len = RubyNumeric.num2long(arg1);
- return slice_internal(pos, len, arg0, arg1);
+ return slice_internal(pos, len, arg0, arg1, getRuntime());
}
/** rb_ary_assoc
@@ -2625,7 +2644,7 @@ public IRubyObject flatten_bang19(ThreadContext context) {
public IRubyObject flatten_bang(ThreadContext context, IRubyObject arg) {
Ruby runtime = context.getRuntime();
int level = RubyNumeric.num2int(arg);
- if (level == 0) return this;
+ if (level == 0) return runtime.getNil();
RubyArray result = new RubyArray(runtime, getMetaClass(), realLength);
if (flatten(context, level, result)) {
@@ -3101,7 +3120,7 @@ private IRubyObject cycleCommon(ThreadContext context, long n, Block block) {
/** rb_ary_product
*
*/
- @JRubyMethod(name = "product", rest = true, compat = CompatVersion.RUBY1_9)
+ @JRubyMethod(name = "product", rest = true)
public IRubyObject product(ThreadContext context, IRubyObject[] args) {
Ruby runtime = context.getRuntime();
@@ -3170,7 +3189,7 @@ public IRubyObject combination(ThreadContext context, IRubyObject num, Block blo
block.yield(context, newEmptyArray(runtime));
} else if (n == 1) {
for (int i = 0; i < realLength; i++) {
- block.yield(context, values[begin + i]);
+ block.yield(context, newArray(runtime, values[begin + i]));
}
} else if (n >= 0 && realLength >= n) {
int stack[] = new int[n + 1];
13 src/org/jruby/RubyBasicObject.java
View
@@ -883,11 +883,16 @@ public synchronized Object dataGetStructChecked() {
/** rb_obj_id
*
* Return the internal id of an object.
- *
- * FIXME: Should this be renamed to match its ruby name?
*/
- public synchronized IRubyObject id() {
- return getRuntime().newFixnum(getRuntime().getObjectSpace().idOf(this));
+ public IRubyObject id() {
+ Ruby runtime = getRuntime();
+ if (runtime.isObjectSpaceEnabled()) {
+ synchronized (this) {
+ return runtime.newFixnum(runtime.getObjectSpace().idOf(this));
+ }
+ } else {
+ return runtime.newFixnum(System.identityHashCode(this));
+ }
}
/** rb_obj_inspect
9 src/org/jruby/RubyComplex.java
View
@@ -270,6 +270,14 @@ public static IRubyObject newInstanceBang(ThreadContext context, IRubyObject rec
return new RubyComplex(context.getRuntime(), recv, real, image);
}
+ /** nucomp_canonicalization
+ *
+ */
+ private static boolean canonicalization = false;
+ public static void setCanonicalization(boolean canonical) {
+ canonicalization = canonical;
+ }
+
/** nucomp_real_check (might go to bimorphic)
*
*/
@@ -291,7 +299,6 @@ private static void realCheck(ThreadContext context, IRubyObject num) {
*
*/
private static final boolean CL_CANON = Numeric.CANON;
- private static boolean canonicalization = false;
private static IRubyObject canonicalizeInternal(ThreadContext context, IRubyObject clazz, IRubyObject real, IRubyObject image) {
if (Numeric.CANON) {
if (f_zero_p(context, image) &&
33 src/org/jruby/RubyDigest.java
View
@@ -31,8 +31,10 @@
***** END LICENSE BLOCK *****/
package org.jruby;
+import java.security.AccessController;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.PrivilegedAction;
import java.security.Provider;
import java.util.Arrays;
@@ -55,11 +57,20 @@
private static Provider provider = null;
public static void createDigest(Ruby runtime) {
- try {
- provider = (Provider) Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider").newInstance();
- } catch(Exception e) {
- // provider is not available
- }
+ // We're not setting the provider or anything, but it seems that BouncyCastle does some internal things in its
+ // provider's constructor which require it to be executed in a secure context.
+ // Ideally this hack should be removed. See JRUBY-3919 and this BC bug:
+ // http://www.bouncycastle.org/jira/browse/BJA-227
+ provider = (Provider) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ try {
+ return Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider").newInstance();
+ } catch(Exception e) {
+ // provider is not available
+ return null;
+ }
+ }
+ });
RubyModule mDigest = runtime.defineModule("Digest");
mDigest.defineAnnotatedMethods(RubyDigest.class);
@@ -160,15 +171,21 @@ public static void createDigestSHA2(Ruby runtime) {
RubyModule mDigest = runtime.fastGetModule("Digest");
RubyClass cDigestBase = mDigest.fastGetClass("Base");
RubyClass cDigest_SHA2_256 = mDigest.defineClassUnder("SHA256",cDigestBase,cDigestBase.getAllocator());
- cDigest_SHA2_256.setInternalModuleVariable("metadata",runtime.newString("SHA-256"));
- cDigest_SHA2_256.defineFastMethod("block_length", new Callback() {
+ RubyClass cDigest_SHA2_META = mDigest.defineClassUnder("SHA2",cDigestBase,cDigestBase.getAllocator());
+ RubyString sha256Method = runtime.newString("SHA-256");
+ Callback sha256Callback = new Callback() {
public Arity getArity() {
return Arity.NO_ARGUMENTS;
}
public IRubyObject execute(IRubyObject recv, IRubyObject[] args, Block block) {
return RubyFixnum.newFixnum(recv.getRuntime(), 64);
}
- });
+ };
+ cDigest_SHA2_256.setInternalModuleVariable("metadata", sha256Method);
+ cDigest_SHA2_META.setInternalModuleVariable("metadata", sha256Method);
+ cDigest_SHA2_256.defineFastMethod("block_length", sha256Callback);
+ cDigest_SHA2_META.defineFastMethod("block_length", sha256Callback);
+
RubyClass cDigest_SHA2_384 = mDigest.defineClassUnder("SHA384",cDigestBase,cDigestBase.getAllocator());
cDigest_SHA2_384.setInternalModuleVariable("metadata",runtime.newString("SHA-384"));
cDigest_SHA2_384.defineFastMethod("block_length", new Callback() {
119 src/org/jruby/RubyDir.java
View
@@ -56,7 +56,7 @@
*
* @author jvoegele
*/
-@JRubyClass(name="Dir", include="Enumerable")
+@JRubyClass(name = "Dir", include = "Enumerable")
public class RubyDir extends RubyObject {
private RubyString path; // What we passed to the constructor for method 'path'
protected JRubyFile dir;
@@ -67,7 +67,7 @@
public RubyDir(Ruby runtime, RubyClass type) {
super(runtime, type);
}
-
+
private static final ObjectAllocator DIR_ALLOCATOR = new ObjectAllocator() {
public IRubyObject allocate(Ruby runtime, RubyClass klass) {
return new RubyDir(runtime, klass);
@@ -83,14 +83,14 @@ public static RubyClass createDirClass(Ruby runtime) {
return dirClass;
}
-
+
private final void checkDir() {
- if (!isTaint() && getRuntime().getSafeLevel() >= 4) throw getRuntime().newSecurityError("Insecure: operation on untainted Dir");
-
+ if (!isTaint() && getRuntime().getSafeLevel() >= 4)throw getRuntime().newSecurityError("Insecure: operation on untainted Dir");
+
testFrozen("Dir");
-
+
if (!isOpen) throw getRuntime().newIOError("closed directory");
- }
+ }
/**
* Creates a new <code>Dir</code>. This method takes a snapshot of the
@@ -112,7 +112,7 @@ public IRubyObject initialize(IRubyObject _newPath, Block unusedBlock) {
List<String> snapshotList = RubyDir.getEntries(getRuntime(), adjustedPath);
snapshot = (String[]) snapshotList.toArray(new String[snapshotList.size()]);
-
+
return this;
}
@@ -120,37 +120,37 @@ public IRubyObject initialize(IRubyObject _newPath, Block unusedBlock) {
private static List<ByteList> dirGlobs(String cwd, IRubyObject[] args, int flags) {
List<ByteList> dirs = new ArrayList<ByteList>();
-
+
for (int i = 0; i < args.length; i++) {
ByteList globPattern = args[i].convertToString().getByteList();
dirs.addAll(Dir.push_glob(cwd, globPattern, flags));
}
-
+
return dirs;
}
-
+
private static IRubyObject asRubyStringList(Ruby runtime, List<ByteList> dirs) {
List<RubyString> allFiles = new ArrayList<RubyString>();
- for (ByteList dir: dirs) {
+ for (ByteList dir : dirs) {
allFiles.add(RubyString.newString(runtime, dir));
- }
+ }
IRubyObject[] tempFileList = new IRubyObject[allFiles.size()];
allFiles.toArray(tempFileList);
-
+
return runtime.newArrayNoCopy(tempFileList);
}
-
+
private static String getCWD(Ruby runtime) {
try {
return new org.jruby.util.NormalizedFile(runtime.getCurrentDirectory()).getCanonicalPath();
- } catch(Exception e) {
+ } catch (Exception e) {
return runtime.getCurrentDirectory();
}
}
- @JRubyMethod(name = "[]", required = 1, rest=true, meta = true)
+ @JRubyMethod(name = "[]", required = 1, rest = true, meta = true)
public static IRubyObject aref(IRubyObject recv, IRubyObject[] args) {
List<ByteList> dirs;
if (args.length == 1) {
@@ -162,7 +162,7 @@ public static IRubyObject aref(IRubyObject recv, IRubyObject[] args) {
return asRubyStringList(recv.getRuntime(), dirs);
}
-
+
/**
* Returns an array of filenames matching the specified wildcard pattern
* <code>pat</code>. If a block is given, the array is iterated internally
@@ -172,7 +172,7 @@ public static IRubyObject aref(IRubyObject recv, IRubyObject[] args) {
@JRubyMethod(name = "glob", required = 1, optional = 1, frame = true, meta = true)
public static IRubyObject glob(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) {
Ruby runtime = context.getRuntime();
- int flags = args.length == 2 ? RubyNumeric.num2int(args[1]) : 0;
+ int flags = args.length == 2 ? RubyNumeric.num2int(args[1]) : 0;
List<ByteList> dirs;
IRubyObject tmp = args[0].checkArrayType();
@@ -182,12 +182,12 @@ public static IRubyObject glob(ThreadContext context, IRubyObject recv, IRubyObj
} else {
dirs = dirGlobs(getCWD(runtime), ((RubyArray) tmp).toJavaArray(), flags);
}
-
+
if (block.isGiven()) {
for (int i = 0; i < dirs.size(); i++) {
block.yield(context, RubyString.newString(runtime, dirs.get(i)));
}
-
+
return runtime.getNil();
}
@@ -201,7 +201,7 @@ public static IRubyObject glob(ThreadContext context, IRubyObject recv, IRubyObj
public RubyArray entries() {
return getRuntime().newArrayNoCopy(JavaUtil.convertJavaArrayToRuby(getRuntime(), snapshot));
}
-
+
/**
* Returns an array containing all of the filenames in the given directory.
*/
@@ -227,7 +227,7 @@ private static RubyArray entriesCommon(Ruby runtime, String path) {
if (!RubyFileTest.directory_p(runtime, RubyString.newString(runtime, path)).isTrue()) {
throw runtime.newErrnoENOENTError("No such directory");
}
-
+
if (path.startsWith("file:")) return entriesIntoAJarFile(runtime, path);
return entriesIntoADirectory(runtime, path);
@@ -249,12 +249,12 @@ private static RubyArray entriesCommon(Ruby runtime, String path) {
List<String> fileList = new ArrayList<String>();
for (ByteList file : dirs) {
String[] split = file.toString().split("/");
- fileList.add(split[split.length -1]);
- }
+ fileList.add(split[split.length - 1]);
+ }
return fileList;
}
-
+
// MRI behavior: just plain '//' or '\\\\' are considered illegal on Windows.
private static void checkDirIsTwoSlashesOnWindows(Ruby runtime, String path) {
if (Platform.IS_WINDOWS && ("//".equals(path) || "\\\\".equals(path))) {
@@ -273,7 +273,7 @@ public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyOb
JRubyFile dir = getDir(runtime, adjustedPath, true);
String realPath = null;
String oldCwd = runtime.getCurrentDirectory();
-
+
// We get canonical path to try and flatten the path out.
// a dir '/subdir/..' should return as '/'
// cnutter: Do we want to flatten path out?
@@ -282,10 +282,10 @@ public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyOb
} catch (IOException e) {
realPath = dir.getAbsolutePath();
}
-
+
IRubyObject result = null;
if (block.isGiven()) {
- // FIXME: Don't allow multiple threads to do this at once
+ // FIXME: Don't allow multiple threads to do this at once
runtime.setCurrentDirectory(realPath);
try {
result = block.yield(context, path);
@@ -294,10 +294,10 @@ public static IRubyObject chdir(ThreadContext context, IRubyObject recv, IRubyOb
runtime.setCurrentDirectory(oldCwd);
}
} else {
- runtime.setCurrentDirectory(realPath);
- result = runtime.newFixnum(0);
+ runtime.setCurrentDirectory(realPath);
+ result = runtime.newFixnum(0);
}
-
+
return result;
}
@@ -318,7 +318,7 @@ public static IRubyObject chroot(IRubyObject recv, IRubyObject path) {
public static IRubyObject rmdir(IRubyObject recv, IRubyObject path) {
return rmdirCommon(recv.getRuntime(), path.convertToString().getUnicodeValue());
}
-
+
@JRubyMethod(name = {"rmdir", "unlink", "delete"}, required = 1, meta = true, compat = CompatVersion.RUBY1_9)
public static IRubyObject rmdir19(ThreadContext context, IRubyObject recv, IRubyObject path) {
return rmdirCommon(context.getRuntime(), getPath19(context, path));
@@ -341,14 +341,14 @@ private static IRubyObject rmdirCommon(Ruby runtime, String path) {
@JRubyMethod(name = "foreach", frame = true, meta = true, compat = CompatVersion.RUBY1_8)
public static IRubyObject foreach(ThreadContext context, IRubyObject recv, IRubyObject _path, Block block) {
RubyString pathString = _path.convertToString();
-
+
return foreachCommon(context, recv, context.getRuntime(), pathString, block);
}
@JRubyMethod(name = "foreach", frame = true, meta = true, compat = CompatVersion.RUBY1_9)
public static IRubyObject foreach19(ThreadContext context, IRubyObject recv, IRubyObject arg, Block block) {
RubyString pathString = arg instanceof RubyString ? (RubyString) arg : arg.callMethod(context, "to_path").convertToString();
-
+
return foreachCommon(context, recv, context.getRuntime(), pathString, block);
}
@@ -357,11 +357,11 @@ private static IRubyObject foreachCommon(ThreadContext context, IRubyObject recv
runtime.checkSafeString(_path);
RubyClass dirClass = runtime.getDir();
- RubyDir dir = (RubyDir) dirClass.newInstance(context, new IRubyObject[] { _path }, block);
+ RubyDir dir = (RubyDir) dirClass.newInstance(context, new IRubyObject[]{_path}, block);
dir.each(context, block);
return runtime.getNil();
- }
+ }
return enumeratorize(runtime, recv, "foreach", _path);
}
@@ -375,6 +375,16 @@ public static RubyString getwd(IRubyObject recv) {
}
/**
+ * Returns the home directory of the current user or the named user if given.
+ */
+ @JRubyMethod(name = "home", optional = 1, meta = true, compat = CompatVersion.RUBY1_9)
+ public static IRubyObject home(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
+ if (args.length > 0) return getHomeDirectoryPath(context, args[0].toString());
+
+ return getHomeDirectoryPath(context);
+ }
+
+ /**
* Creates the directory specified by <code>path</code>. Note that the
* <code>mode</code> parameter is provided only to support existing Ruby
* code, and is ignored.
@@ -382,11 +392,10 @@ public static RubyString getwd(IRubyObject recv) {
@JRubyMethod(name = "mkdir", required = 1, optional = 1, meta = true, compat = CompatVersion.RUBY1_8)
public static IRubyObject mkdir(IRubyObject recv, IRubyObject[] args) {
Ruby runtime = recv.getRuntime();
- runtime.checkSafeString(args[0]);
-
- String path= args[0].convertToString().getUnicodeValue();
+ RubyString stringArg = args[0].convertToString();
+ runtime.checkSafeString(stringArg);
- return mkdirCommon(runtime, path, args);
+ return mkdirCommon(runtime, stringArg.getUnicodeValue(), args);
}
@JRubyMethod(name = "mkdir", required = 1, optional = 1, meta = true, compat = CompatVersion.RUBY1_9)
@@ -419,8 +428,8 @@ public static IRubyObject open(ThreadContext context, IRubyObject recv, IRubyObj
RubyDir directory = (RubyDir) context.getRuntime().getDir().newInstance(context,
new IRubyObject[]{path}, Block.NULL_BLOCK);
- if (!block.isGiven()) return directory;
-
+ if (!block.isGiven())return directory;
+
try {
return block.yield(context, directory);
} finally {
@@ -435,7 +444,6 @@ public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyO
}
// ----- Ruby Instance Methods -------------------------------------------------
-
/**
* Closes the directory stream.
*/
@@ -443,7 +451,7 @@ public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyO
public IRubyObject close() {
// Make sure any read()s after close fail.
checkDir();
-
+
isOpen = false;
return getRuntime().getNil();
@@ -454,12 +462,12 @@ public IRubyObject close() {
*/
public IRubyObject each(ThreadContext context, Block block) {
checkDir();
-
+
String[] contents = snapshot;
- for (pos=0; pos<contents.length; pos++) {
+ for (pos = 0; pos < contents.length; pos++) {
block.yield(context, getRuntime().newString(contents[pos]));
}
-
+
return this;
}
@@ -495,11 +503,11 @@ public RubyInteger tell() {
@JRubyMethod(name = "seek", required = 1)
public IRubyObject seek(IRubyObject newPos) {
checkDir();
-
+
set_pos(newPos);
return this;
}
-
+
@JRubyMethod(name = "pos=", required = 1)
public IRubyObject set_pos(IRubyObject newPos) {
this.pos = RubyNumeric.fix2int(newPos);
@@ -543,7 +551,6 @@ public static IRubyObject exist(ThreadContext context, IRubyObject recv, IRubyOb
}
// ----- Helper Methods --------------------------------------------------------
-
protected static String getPath19(ThreadContext context, IRubyObject arg) {
RubyString pathObject = arg instanceof RubyString ? (RubyString) arg : arg.callMethod(context, "to_path").convertToString();
return pathObject.getUnicodeValue();
@@ -557,7 +564,7 @@ protected static String getPath19(ThreadContext context, IRubyObject arg) {
* @throws IOError if <code>path</code> is not a directory.
*/
protected static JRubyFile getDir(final Ruby runtime, final String path, final boolean mustExist) {
- JRubyFile result = JRubyFile.create(runtime.getCurrentDirectory(),path);
+ JRubyFile result = JRubyFile.create(runtime.getCurrentDirectory(), path);
if (mustExist && !result.exists()) {
throw runtime.newErrnoENOENTError("No such file or directory - " + path);
}
@@ -583,7 +590,7 @@ protected static JRubyFile getDir(final Ruby runtime, final String path, final b
// If an IO exception occurs (something odd, but possible)
// A directory may return null.
if (contents != null) {
- for (int i=0; i<contents.length; i++) {
+ for (int i = 0; i < contents.length; i++) {
result.add(contents[i]);
}
}
@@ -597,13 +604,13 @@ protected static JRubyFile getDir(final Ruby runtime, final String path, final b
protected static List<RubyString> getContents(File directory, Ruby runtime) {
List<RubyString> result = new ArrayList<RubyString>();
String[] contents = directory.list();
-
+
for (int i = 0; i < contents.length; i++) {
result.add(runtime.newString(contents[i]));
}
return result;
}
-
+
/**
* Returns the home directory of the specified <code>user</code> on the
* system. If the home directory of the specified user cannot be found,
@@ -618,7 +625,7 @@ public static IRubyObject getHomeDirectoryPath(ThreadContext context, String use
* use /etc/passwd for regular user accounts
*/
Ruby runtime = context.getRuntime();
-
+
try {
// try to use POSIX for this first
return runtime.newString(runtime.getPosix().getpwnam(user).getHome());
4 src/org/jruby/RubyEnumerable.java
View
@@ -345,8 +345,8 @@ public static IRubyObject to_a19(ThreadContext context, IRubyObject self) {
return result;
}
- @JRubyMethod(name = {"to_a", "entries"}, required = 1, rest = true)
- public static IRubyObject to_a19(ThreadContext context, IRubyObject self, IRubyObject[]args) {
+ @JRubyMethod(name = {"to_a", "entries"}, rest = true)
+ public static IRubyObject to_a19(ThreadContext context, IRubyObject self, IRubyObject[] args) {
Ruby runtime = context.getRuntime();
RubyArray result = runtime.newArray();
RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(),
21 src/org/jruby/RubyFileStat.java
View
@@ -35,8 +35,8 @@
import java.io.FileDescriptor;
-import org.jruby.anno.JRubyMethod;
import org.jruby.anno.JRubyClass;
+import org.jruby.anno.JRubyMethod;
import org.jruby.ext.posix.FileStat;
import org.jruby.ext.posix.util.Platform;
import org.jruby.runtime.Block;
@@ -249,7 +249,7 @@ public IRubyObject inspect() {
try { buf.append("uid=").append(stat.uid()).append(", "); } catch (Exception e) {}
try { buf.append("gid=").append(stat.gid()).append(", "); } catch (Exception e) {}
try { buf.append("rdev=0x").append(Long.toHexString(stat.rdev())).append(", "); } catch (Exception e) {}
- buf.append("size=").append(stat.st_size()).append(", ");
+ buf.append("size=").append(sizeInternal()).append(", ");
try { buf.append("blksize=").append(stat.blockSize()).append(", "); } catch (Exception e) {}
try { buf.append("blocks=").append(stat.blocks()).append(", "); } catch (Exception e) {}
@@ -338,14 +338,27 @@ public IRubyObject setuid_p() {
return getRuntime().newBoolean(stat.isSetuid());
}
+ private long sizeInternal() {
+ // Workaround for JRUBY-4149
+ if (Platform.IS_WINDOWS && file != null) {
+ try {
+ return file.length();
+ } catch (SecurityException ex) {
+ return 0L;
+ }
+ } else {
+ return stat.st_size();
+ }
+ }
+
@JRubyMethod(name = "size")
public IRubyObject size() {