Java 版的 Ruby 解释器 JRuby 1.7.14 发布
JRuby1.7.14发布,此版本现已提供下载:
http://www.jruby.org/download
JRuby1.7主要是为了兼容Ruby1.9.3版本,改进记录如下:
解决了30个issues
修复了Jar文件源潜在的内存泄漏问题
因为在Rails应用启动比较慢,所以默认禁用invokedynamic
load/require内部重构和简化
解决了一些兼容性问题
1.7.14修复的bug:
#1923-String#start_with?returnsfalsewhenusinganemptystring #1905-TempfileanddeleteOnExit #1899-Can'tcallstaticmethodonJava8interface #1898-Fixthememoryleakandactuallyclosetheresources. #1889-NPEfromorg.jruby.java.proxies.ArrayJavaProxy.to_a #1888-nativememoryleakwhenreadingfilesfrominsidea.jar #1859-JMXtriestodouble-bindaportwhenusingbundleexec #1858-JRubywithJava84to10timesslowerthanJava7 #1852-JRubyClassloaderseemstohaveaproblemwithfileurlspointingtojar... #1850-embeddedjarsdonotgetloaded #1846-Fix$LOAD_FEATURESpathsfor1.8 #1818-fixArrayJavaProxy#to_afailureonarrayscontainingnull #1813-cannotloadresourcesfromjaranymorewithjaruri #1809-applyminorenebo'scomments #1808-FixBigDecimal#roundbehaviorwithNANandINFINITY #1805-Zlibcrcimprovements #1803-Fixminorbugin`setNativeEnabled`,andexposeitinScriptingContainer #1802-FixEncoding::Converter#inspectoutput #1799-mvn-Pallfailsatthedocumentationstep #1790-MakeTime#to_rconsistentwithMRI #1777-ServerSocket#accept_nonblockreturnstheserver'sport,nottheclient's #1772-avoidsub-classingThreadLocalsinceitwillleakinenvssuchas.wars #1765-addedajava_fieldmethodforuseinthejrubyccommand. #1762-enhancedthejava_classcompilersoitcanhandlemultipleconstructors #1750-RefactorLoadServicetomakeuseofresources #1729-novalidstructlayoutforEthon::Curl::Slist #1676-Emptyhashoptimization #1580-IO.selectraisesCancelledKeyExceptiononshutdown #1520-Datecomparisonasjavaobjects #1435-bouncy-castle-javaJARsmissingwhenwarblingwithJRuby1.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"Hellofromruby" 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 classCallJava includeISpeaker definitialize super @count=0 end defsay(msg) puts"Rubysaying#{msg}" end defaddOne(from) #m.synchronize{ @count+=1 puts"Nowgot#@countfrom#{from}" #} end end