欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Java 版的 Ruby 解释器 JRuby 1.7.14 发布

程序员文章站 2022-11-14 22:08:31
jruby 1.7.14 发布 ,此版本现已提供下载: jruby 1.7 主要是为了兼容 ruby 1.9.3 版本,改进记录如下: 解决了 30 个 issue...

jruby 1.7.14 发布 ,此版本现已提供下载:

jruby 1.7 主要是为了兼容 ruby 1.9.3 版本,改进记录如下:

解决了 30 个 issues

修复了 jar 文件源潜在的内存泄漏问题

因为在 rails 应用启动比较慢,所以默认禁用 invokedynamic

load/require 内部重构和简化

解决了一些兼容性问题

1.7.14 修复的 bug:

#1923 - string#start_with? returns false when using an empty string
#1905 - tempfile and deleteonexit
#1899 - can't call static method on java 8 interface
#1898 - fix the memory leak and actually close the resources.
#1889 - npe from org.jruby.java.proxies.arrayjavaproxy.to_a
#1888 - native memory leak when reading files from inside a .jar
#1859 - jmx tries to double-bind a port when using bundle exec
#1858 - jruby with java 8 4 to 10 times slower than java 7
#1852 - jrubyclassloader seems to have a problem with file urls pointing to jar ...
#1850 - embedded jars do not get loaded
#1846 - fix $load_features paths for 1.8
#1818 - fix arrayjavaproxy#to_a failure on arrays containing null
#1813 - can not load resources from jar anymore with jar uri
#1809 - apply minor enebo's comments
#1808 - fix bigdecimal#round behavior with nan and infinity
#1805 - zlib crc improvements
#1803 - fix minor bug in `setnativeenabled`, and expose it in scriptingcontainer
#1802 - fix encoding::converter#inspect output
#1799 - mvn -pall fails at the documentation step
#1790 - make time#to_r consistent with mri
#1777 - serversocket#accept_nonblock returns the server's port, not the client's
#1772 - avoid sub-classing threadlocal since it will leak in envs such as .wars
#1765 - added a java_field method for use in the jrubyc command.
#1762 - enhanced the java_class compiler so it can handle multiple constructors
#1750 - refactor loadservice to make use of resources
#1729 - no valid struct layout for ethon::curl::slist
#1676 - empty hash optimization
#1580 - io.select raises cancelledkeyexception on shutdown
#1520 - date comparison as java objects
#1435 - bouncy-castle-java jars missing when warbling with jruby 1.7.10

jruby是面向ruby、基于java虚拟机(jvm)的一种解释程序,它结合了ruby语言的简易性和功能强大的jvm的执行机制,包括与 java库 全面集成。rails彻底加快及简化了web应用的开发,不过它让人觉得不够成熟,特别是在高端企业级功能方面。另一方面,java平台及其虚拟机、库和 应用服务器的速度、稳定性和功能方面却一直在提升,现在已被公认为是开发高端服务器应用的领先平台。不过如果java平台不与ruby等新兴语言联系在一 起,就有可能落后于流行趋势。

示例代码:

require "java"
include_class "java.util.treeset"
include_class "com.example.callme"
include_class "com.example.ispeaker"
puts "hello from ruby"
set = treeset.new
set.add "foo"
set.add "bar"
set.add "baz"
set.each { |v| puts "value: #{v}" }
cm = callme.new
cm.hello
$globalcm.hello
class calljava
include ispeaker
def initialize
 super
 @count = 0
end
def say(msg)
 puts "ruby saying #{msg}"
end
def addone(from)
#  m.synchronize {
  @count += 1
  puts "now got #@count from #{from}"
#  }
end
end