Groovy的这次发布最引人注目的特性有:
1. Groovy1.1RC1的性能又得到了进一步的提升,与前一个版本Groovy1.1beta3相比提升了15%~45%
2. 语法更简洁了:
class Person {
String name
}
// 以前的版本:Person.metaClass.'static'.createPerson
Person.metaClass.static.createPerson = { name ->
Person person = new Person()
person.name = name
return person
}
def person = Person.createPerson('Annie')
println person.name
3. GroovySh的互动性更强,无需go就可以执行代码
C:\Documents and Settings\Daniel>groovy -v
Groovy Version: 1.1-rc-1 JVM: 1.6.0_03-b05
C:\Documents and Settings\Daniel>groovysh
Groovy Shell (1.1-rc-1, JVM: 1.6.0_03-b05)
Type 'help' or '\h' for help.
----------------------------------------------------------------
groovy:000> name = "Daniel"
===> Daniel
groovy:000> println "Hello, $name"
Hello, Daniel
===> null
groovy:000>
4. GroovyConsole的输出过滤了无用的异常信息
将下面的代码复制到GroovyConsole中,并执行
class Person {
String name
}
// 注意Persn而非Person
Person person = new Persn()
提示信息为(大堆的异常信息被过滤了,仅保留了对开发人员有用的异常信息):
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script3: 5: unable to resolve class Persn
@ line 5, column 17.
1 error
Groovy1.1RC1发布了,Groovy1.1Final还会远吗?
Groovy1.1Final将于11月中旬发布,敬请期待!
下载地址:http://dist.groovy.codehaus.org/distributions/groovy-binary-1.1-rc-1.zip
附:
朝花夕拾——Groovy & GrailsRelease Notes - groovy - Version 1.1-rc-1 - HTML format
Sub-task
- [GROOVY-1902] - add check for usage of generics only with generics enabled classes and with the correct number of parameters
- [GROOVY-2151] - Filter stack traces in GroovyConsole
Bug
- [GROOVY-775] - MarkupBuilder works not the same as NodeBuilder
- [GROOVY-1186]
- NullpointerException occurs when unboxing boolean Java return type
where no return value specified from Java interface implemented in
Groovy
- [GROOVY-1323] - Inline conditional List << not being executed fully.
- [GROOVY-1440] - println /hello/ results in unexpected token exception
- [GROOVY-1503] - SimpleTemplateEngine drops Windows new-line character (\r)
- [GROOVY-1517] - DomToGroovy outputs builder code not compatible with MarkupBuilder
- [GROOVY-1549] - Array equality is not treated same as List equality
- [GROOVY-1738] - Color settings not saving
- [GROOVY-1744] - Extreme performance problem when calling closures using 'shorthand' notation
- [GROOVY-1776] - GroovyJ 0.1.9 corrupts compiler caches in IDEA Selena
- [GROOVY-1860] - Problem calling override method with different return type.
- [GROOVY-1863] - Groovy compiler executes code it is compiling
- [GROOVY-1913] - Problem when running script that uses java covariants
- [GROOVY-1962] - add a stream based class reader and an optional java5 module
- [GROOVY-1978] - static imports not working with groovy classes
- [GROOVY-1995] - minus(List self, Collection removeMe) throws IllegalStateException for dupplicate values
- [GROOVY-2126] - ClassCastException when using java.util.prefs package
- [GROOVY-2130] - Use of java iterators in for loop is syntax error
- [GROOVY-2132] - Filter stacktraces in the new shell
- [GROOVY-2133] - Static imports not working inside closures
- [GROOVY-2135] - failed to reference an instance defined in enum class with the syntax like Planet.MERCURY
- [GROOVY-2136] - Static import of properties and fields does not work
- [GROOVY-2137] - Enum class does not load
- [GROOVY-2139] - Can not init instances with super(...)
- [GROOVY-2141] - ExpandoMetaClass has concurrency modification issues with multiple threads
- [GROOVY-2150] - ClosureMetaClass regression (mapping of ArrayLIst to parameters)
- [GROOVY-2152] - Stacktrace in the new shell
- [GROOVY-2153] - BUG! exception in phase 'semantic analysis'
- [GROOVY-2155] - Some additional static import regressions since beta-2
- [GROOVY-2156] - Parameter annotations cannot be queried at runtime
- [GROOVY-2157] - Elvis operator is evaluating the "true" expression twice
- [GROOVY-2158] - Code crashing in new shell but not in old
- [GROOVY-2159] - Stub generator does not generate stubs for Groovy sub classes
- [GROOVY-2165] - GroovyClassLoader dead lock situation with multiple threads
- [GROOVY-2166] - ExpandoMetaClass causes exceptions with multiple threads, need to sync on isInitialised()
- [GROOVY-2167] - Occasional NPE with multiple threads with class caching mechanism
- [GROOVY-2169] - NPE in GroovyScriptEngine
- [GROOVY-2170] - Purge commands don't work anymore in the new shell
- [GROOVY-2180] - LoaderConfiguration is broken for relative paths
- [GROOVY-2181] - NPE generated groovydoc documentation
- [GROOVY-2187] - GString as String[] returns a 1-element array with the whole text
- [GROOVY-2188] - missing coercion for array
- [GROOVY-2190] - check generics usage in class header
- [GROOVY-2194] - The method primitiveArrayToList doesn't checks for nulls inside arrays causing NPE
- [GROOVY-2198] - owner/delegatechain is broken for multiple delegates
Improvement
- [GROOVY-1314] - support covariant return types (& generics)
- [GROOVY-1737] - Map unary negation operator to a method and be able to overload it via a Category
- [GROOVY-1832] - XMLParser: remove method on NodeList returns true (success). But, Node is not removed.
- [GROOVY-1835] - Allow string coercion into classes
- [GROOVY-1977] - Allow static and default to be used as property names after the dereference operator
- [GROOVY-1979] - SimpleTemplateEngine (and poentially other TemplateEngines) should allow caller to specify classloader
- [GROOVY-1996] - Groovy-all pom.xml has dependency to an outdated version of Castor
- [GROOVY-2053] - Re-write InteractiveShell (aka. groovysh) in Groovy
- [GROOVY-2068] - Extract a FactoryBuilder from SwingBuilder
- [GROOVY-2140] - Handle Null Attributes in MarkupBuilder
- [GROOVY-2142] - Add new metaClass property to all objects to unify access to meta class across instances
- [GROOVY-2162] - The unary negate "~" operator could work with any kind of object, not just numbers and strings
- [GROOVY-2172] - Change the new groovysh IO debug/verbose/quiet to a single verbosity field
- [GROOVY-2173] - Create a Main CLI class for the new groovysh, to free Groovysh from those details
- [GROOVY-2179] - Make the *new* groovysh the default
New Feature
- [GROOVY-174] - Round Peg, Square Hole
- [GROOVY-604] - Provide parsing errors and warnings
- [GROOVY-605] - Automatic imports
- [GROOVY-608] - Provide refactoring capabilities
- [GROOVY-611] - Intention actions
- [GROOVY-614] - Add an Outline/File structure pane
- [GROOVY-1851] - Expose unary plus and unary minus operators as interceptable method calls: positive() and negative()
- [GROOVY-1950] - Write an installer to automated Windows registry manipulation for configuring the native launcher
- [GROOVY-2174] - Add commands to capture/manage a complete transcript of a groovysh session
- [GROOVY-2175] - Add something like pythons {{sys.displayhook}} to the new groovysh
- [GROOVY-2176] - Install SecurityManager for groovysh to prevent unwanted System.exit()
posted on 2007-10-13 22:07
山风小子 阅读(2068)
评论(3) 编辑 收藏 所属分类:
Groovy & Grails