|
Retour à la navigation
Both Groovy 1.5.7 and 1.6-beta-2 are out! — Ecrit par Guillaume
This is with great pleasure that the Groovy development team and G2One announce the joint release of both Groovy 1.5.7 -- current stable and maintenance branch -- and Groovy 1.6-beta-2 -- the upcoming major release.
Groovy 1.5.7 contains mainly bug fixes (61 bug fixes), but also some minor API improvements (20 improvements) backported from the1.6 branch, whereas Groovy 1.6-beta-2 brings a wealth of novelty (68 bug fixes and 38 improvements and new features). Here, we'll mainly cover the new features of beta-2. Following up on our major compile-time and runtime performance improvements in beta-1, we continued our efforts in that area for beta-2. But you'll also be interested in discovering the changes and new features brought by this new release. Multiple Assignments In beta-1, we introduced the possibility to define multiple assignments. However, we faced some issues and ambiguities with the subscript notation, so we adapted the syntax slightly by using parentheses instead of square brackets. We also now cover all the assignment use cases, which wasn't the case previously. You can define and assign several variables at once: def (a, b) = [1,2] assert a == 1 assert b == 2 And you can also define the types of the variables in one shot as follows: def (int i, String j) = [1, 'Groovy'] For the assignment (without priori definition of the variables), just don't use the 'def' keyword: def a, b (a, b) = functionReturningAList() Otherwise, apart from the syntax change, the behavior is the same as in beta-1: if the list on the right-hand side contains more elements than the number of variables on the left-hand side, only the first elements will be assigned in order into the variables. Also, when there are less elements than variables, the extra variables will be assigned null. Optional return for if/else and try/catch/finally blocks Although not a syntax change, but at least a new behavior: it is now possible for if/else and try/catch/finally blocks to return a value. No need to explicitly use the 'return' keyword inside these constructs, as long as they are the latest statement in the block of code. As an example, the following method will return 1, although the 'return' keyword was omitted. def method() { if (true) 1 else 0 } You can have a look at our test case to have an overview of this new behavior. AST Transformations Although at times, it may sound like a good idea to extend the syntax of Groovy to implement new features (like this is the case for instance for multiple assignments), most of the time, we can't just add a new keyword to the grammar, or create some new syntax construct to represent a new concept. However, with the idea of AST (Abstract Syntax Tree) Transformations initiated and introduced in beta-1, we are able to tackle new and innovative ideas without necessary grammar changes. With AST Transformations, people can hook into the compiler to make some changes to the AST in order to change the program that is being compiled. AST Transformations provides Groovy with improved compile-time metaprogramming capabilities allowing powerful flexibility at the language level, without a runtime performance penalty. In beta-1, two AST Transformations found their way in the release, pioneered by our talented Groovy Swing team. With the @Bindable transformation marker annotation, property listeners are transparently added to the class for the property that is being annotated. Sames goes for the @Vetoable annotation for vetoing property changes. In beta-2, new transformations have been created:
Swing builder The swing builder which pioneered AST transformations added support for binding to simple closures, i.e. bean(property: bind { otherBean.property } ) is the same as bind(source: otherBean, target: property). It is also a closure so you can do more complex expressions like bean(location: bind {pos.x + ',' + pos.y} ) -- but the expression needs to stay simple enough: no loops or branching, for instance. Grape, the adaptable / advanced packaging engine Also leveraging AST Transformations, Groovy 1.6-beta-2 provides a preview of the Groovy Advanced or Adaptable Packaging Engine. Groovy scripts can require certain libraries: by explicitly saying so in your script with the @Grab transformation or with the Grape.grab() method call, the runtime will find the needed JARs for you. With Grape, you can easily distribute scripts without their dependencies, and have them downloaded on first use of your script. For more information on Grape, please read the documentation. Per instance metaclass even for POJOs So far, Groovy classes could have a per-instance metaclass, but POJOs could only have on metaclass for all instances (ie. a per-class metaclass). This is now not the case anymore, as POJOs can have per-instance metaclass too. Also, setting the metaclass property to null will restore the default metaclass. ExpandoMetaClass DSL A new DSL for EMC was created to allow chaining the addition of new methods through EMC without the usual object.metaClass repetition. You can find some examples in our test cases again: here and there. Runtime mixins One last feature I'll mention today is runtime mixins. Unlike the @Category/@Mixin combo, or even the @Delegate transformation, as their name imply, mixin behavior at runtime. You can find examples here, which also combine the use of the EMC DSL Useful links You can download both versions here, and the JARs will be available shortly on the central Maven repository. And you can read the release notes from JIRA for 1.5.7 and the release notes for 1.6-beta-2. Further down the road We adapted the Groovy roadmap a little: as features which were supposed to be in 1.7 have already been implemented in 1.6, the scope of 1.7 is reduced and 1.8 is made useless, so after 1.6, we'll focus on 1.7 which will mainly bring one new major feature (the ability to define anonymous inner classes in Groovy, to bridge the small difference gap with Java), and afterwards, we'll be able to focus our energy on Groovy 2.0 improving and rewriting parts of the Groovy core to bring in even more performance and to pave the way for even more power features in future versions. We're looking forward to hearing about your feedback on those two releases. Thanks a lot to everybody for their help and respective contributions. Liens
CommentairesRob Ottaway a écrit :
18.10.2008 18:03:03
sadha a écrit :
Guillaume ,
I am struggling with sumthing while using groovy way for stored proc calls. We tried at forums too but no help. See the details - http://jira.codehaus.org/br... http://www.nabble.com/Re:-P... Is it possible with new version of grails ? Help appreciated. Thanks sadhna
19.11.2008 16:41:01
rolex a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
20.01.2010 04:39:29
rolex a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
20.01.2010 17:09:21
rolex a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
23.01.2010 20:08:06
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
24.01.2010 12:51:25
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
25.01.2010 20:44:54
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
27.01.2010 21:08:44
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
30.01.2010 00:25:47
replica watches a écrit :
The dial design a 100% copy http://www.watchvisa.com/ of the previous model: the famous Manchester Logo is http://www.watchvisa.com/ro... located at 3 and the chronograph 45-minute at 9 with orange figures. Football fans can use the very special 45-minute chronograph to measure the halves of a football match. Black hour replica watches hand and rolex watches minute hand breitling watches http://www.watchvisa.com/ca... features yellow luminescent cartier watches coating. http://www.watchvisa.com/om... The hour makers, chronograph and the first 15-minute http://www.watchvisa.com/br... scale of the chronograph counter is omega watches presented in eye-catching red. http://www.watchvisa.com/ta... Bright Yellow tones are found on the minute track, date window and the text tag heuer watches.<br/>
02.02.2010 13:16:46
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
03.02.2010 11:38:13
tag heuer watches a écrit :
Wearing Hamilton http://www.overwatches.com/ is not the replica watches privilege for the personnel of the railway company at that time. The inspectors of http://www.overwatches.com/... railroad, even rolex watches the company workers were its potential customers. As the development of the company, the Hamilton watch company is improving itself to being perfect. Till now, it has successfully become a top watch brand which is http://www.overwatches.com/... madly loved tag heuer watches across the world.At this point, Hamilton watch company, along with the tag heuer Watches other American cartier watch makers, decided to http://www.overwatches.com/... start producing breitling wristwatches. These were further used by the train engineers and in general, by the railroad personnel. In January 1957, this watch manufacturer http://www.overwatches.com/... launched the omega watches world's first electric wristwatch. As it was a premiere, this shocked the industry quite a bit. The battery was said to offer a power http://www.overwatches.com/... reserve of one men's watches year. In these conditions, the mainspring became useless.Hamilton Watch Company represented one of the solutions. By supplying railroad companies with amazingly accurate timepieces, the http://www.overwatches.com/... Hamilton women's watch helped to save countless lives. What also helped was the adoption of a standard time plan. The four time zones, namely Eastern, Central, Mountain and Pacific were set up. The Hamilton timepieces also played an important role in http://www.overwatches.com/... railroad safety at that ladies time. As a proof of this stands the fact that the Hamilton watch was called "The Watch of Railroad Accuracy. The book published by the Hamilton Company recorded all its historical issues. Detailed description about the models and relative data of Hamilton watches are marked inside. For those who are about to buy a Hamilton watch, this book is really worthy of reading. It can certainly help you to make the right choice.
04.02.2010 09:37:47
Rolex replica a écrit :
<a href="http://www.patekphilippewat... watches</a>
<a href="http://www.patekphilippewat... watches</a> <a href="http://www.patekphilippewat... droz watches</a> <a href="http://www.patekphilippewat... Watch watches</a> <a href="http://www.patekphilippewat... watches</a>
04.02.2010 10:05:42
tag heuer watches a écrit :
Roger Dubuis http://www.watchvisa.com/ro... is rolex watches a watch brand http://www.watchvisa.com/ta... which owns tag heuer watches many fans all over the world for the past years. That is because it is a watch brand with a reputation for creating seductive and innovative timepieces. By applying the most advanced technology, http://www.watchvisa.com/br... Roger Dubuis has breitling watches proven itself to be one of the most reliable brands in the watch making industry. This watch brand is a successful one by creating http://www.watchvisa.com/om... great timepieces omega watches.Roger Dubois has as a declared philosophy the intention to create highly individual timepieces, stating that Roger Dubuis represents a unique identity code. So far, Roger Dubuis has http://www.watchvisa.com/ca... managed to cartier watches fulfill all the requirements of a society interested in acquiring unique timepieces and its creations reflect passion for good taste, seductive design and high-end technical know how.Discover the power of curves with the new Roger Dubuis Excalibur Mens watch, with its interesting almost hexagonal case made of stainless Replica watches steel. Even though it replica approaches a sportier http://www.watchvisa.com/ appearance replica watches, the quality of the materials used is indisputable and the over all design of this timepiece is impressive. The case measures 43 mm in diameter, being quite masculine and it is covered with scratch resistant sapphire crystal. Also, surrounding the case we can see a unidirectional bezel made of white golf that's inscribed with Arabic numerals from 10 to 60, meant to help at diving.Belonging to the Easy Driver series, this watch was designed especially for the active men who are not afraid of exploring the depths of the oceans, as the new Roger Dubuis Excalibur Mens watch provides a water resistance of 1000 meters. Its automatic movement is quite impressive and it's defined by the designers from Roger Dubuis as the RD 14 Clibre.
04.02.2010 14:29:11
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
04.02.2010 21:33:41
Rolex replicas a écrit :
replica rolexes http://www.watcheslux.com/r... are just like the original in every way except -THE PRICE !! The fake Rolex watch has constantly evolved and re-designed to meet the demands and needs of the ever changing client needs. To fulfill one’s ego and the status symbol needs, the Rolex replicas http://www.watcheslux.com/r... go a long way. If you could set aside the feeling of guilt that may arise out of buying a replica Rolex http://www.watcheslux.com/r... What you need to know is that the watches replica http://www.exacthandbag.com... are out there for you, but it takes time to find. Replicas Rolex http://www.watcheslux.com/r... allow a person to have that bit of luxury and the touch of uniqueness, while still performing the most important function of accurate timekeeping.
05.02.2010 08:26:51
Rolex Daytona replica a écrit :
[url=http://www.longineswatches....]Rolex GMT replica[/url]
[url=http://www.longineswatches....]Rolex Sea-Dweller replica[/url] [url=http://www.longineswatches....]Rolex Day Date replica[/url] [url=http://www.longineswatches....]Rolex Masterpiece replica[/url] [url=http://www.longineswatches....]Rolex Milgauss replica[/url]
06.02.2010 07:13:11
Rolex Daytona replica a écrit :
Alexander McQueen on sale
Chloe on sale Christian Louboutin Boots on sale Christian Louboutin Boots on sale Christian Louboutin Evening on sale Christian Louboutin Pumps on sale Christian Louboutin Sandals on sale Christian Louboutin Wedges on sale Jimmy Choo on sale on sale Manolo Blahnik SnowboardBoots / Vancl on sal Tiffany Silver Jewelry on sale
06.02.2010 07:13:32
Rolex Daytona replica a écrit :
<a href="http://www.dearwatches.com/... Prince watches</a><br>
<a href="http://www.dearwatches.com/... Sea Dweller watches</a><br>
06.02.2010 07:13:47
replica watches a écrit :
http://www.replicame.com http://www.watchesview.com http://www.watchesday.com http://www.seawatches.com
06.02.2010 22:39:53
Ajouter un commentaireRéférences externesCette page a été vue 5228 fois. |
While something that doesn't actually affect me too much (I didn't even notice the 'problem' until I had been working with Groovy for months) other professionals I've been working with have thrown fits about this. If nothing else I could say that is a mental barrier for many, not some, to adoption.
On another note, any wishes out there to build real, compiler checkable, tuples into Groovy? I see the example of a method returning a list like so:
(a,b) = someMethodReturningList()
But the list returned could really be any size, maybe 1 or maybe 10 elements. Real tuples would allow for a type which expressed size, and also order like a lists of elements. If the method says it returns a tuple of size two then you need to a tuple of size two assigned to receive said methods return value. The compiler could catch errors in cases where the receiver tuple and returned do not match up.
I should probably mention, one of my favorite things about Groovy is its ability to do things both dynamic and statically.
Once again thanks for the hard work and keep it up. Groovy is a great gift to the Java community. I'll keep spreading the word.
regards,
Rob Ottaway
robottaway At GMail dot com