FYI, "Updating JDK libraries to use Project Coin features"
Joe Darcy
joe.darcy at oracle.com
Mon Dec 27 10:51:13 PST 2010
FYI, Stuart explains the Jackpot-based automated tooling he is using in
this blog entry:
http://stuartmarks.wordpress.com/2010/12/23/jdk7-coin-and-making-libraries-fresh-and-minty/
-Joe
On 12/26/2010 8:50 PM, "Zdeněk Troníček" wrote:
> Hi,
>
> RefactoringNG can be used to update the code in batch.
> For example, the following rule used in v0.3
> (http://kenai.com/projects/refactoringng/downloads) will update the code
> to the diamond operator:
>
> NewClass {
> Expression [id: enclosing, nullable: true],
> List<Tree> [id: typeArgs],
> ParameterizedType {
> Expression [id: ident],
> List<Tree>
> },
> List<Expression> [id: args],
> Class [id: body, elementKind: CLASS, nullable: true]
> } ->
> NewClass {
> Expression [ref: enclosing],
> List<Tree> [ref: typeArgs],
> ParameterizedType {
> Expression [ref: ident],
> List<Tree> { }
> },
> List<Expression> [ref: args],
> Class [ref: body]
> }
>
> (NetBeans 7 throws NullPointerException, but it is not severe and you can
> continue. In NetBeans 6, it is performed without any error.)
>
> When trying this, I found inconsistency in javac's AST. In NewClassTree,
> identifier is ExpressionTree:
>
> public interface NewClassTree extends ExpressionTree {
> ExpressionTree getEnclosingExpression();
> List<? extends Tree> getTypeArguments();
> ExpressionTree getIdentifier();
> List<? extends ExpressionTree> getArguments();
> ClassTree getClassBody();
> }
>
> However, for new ArrayList<Integer>() the identifier is
> ParameterizedTypeTree which is not ExpressionTree:
>
> public interface ParameterizedTypeTree extends Tree {
> Tree getType();
> List<? extends Tree> getTypeArguments();
> }
>
> Z.T.
More information about the coin-dev
mailing list