[ https://issues.apache.org/jira/browse/GROOVY-8637?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King resolved GROOVY-8637. ------------------------------- Resolution: Fixed Assignee: Paul King Fix Version/s: 2.5.1 Proposed PR merged. Thanks for spotting the issue. > @NamedVariant processing error > ------------------------------ > > Key: GROOVY-8637 > URL: https://issues.apache.org/jira/browse/GROOVY-8637 > Project: Groovy > Issue Type: Bug > Components: Compiler > Reporter: Alexey Afanasiev > Assignee: Paul King > Priority: Critical > Fix For: 2.5.1 > > > Example about @NamedVariant from > http://groovy-lang.org/releasenotes/groovy-2.5.html works perfectly well as > far as all @NamedDelegate type are compiling in the same compilation unit. > {code:java} > class Animal { > String type, name > } > @ToString(includeNames=true) > class Color { > Integer r, g, b > } > @NamedVariant > String foo(String s1, @NamedParam String s2, > @NamedDelegate Color shade, > @NamedDelegate Animal pet) { > "$s1 $s2 ${pet.type?.toUpperCase()}:$pet.name $shade" > } > {code} > But let's modify this example. If you have Animal an Color classes compiled > beforehand and passed to the compiler with classpath, you will receive 'Error > during @NamedVariant processing. Duplicate property 'metaClass' found.' > NamedVariantASTTransformation treats 'setMetaClass' method as set method of > some property with ''metaClass' name. Obviously these names are clashed at > compile time. -- This message was sent by Atlassian JIRA (v7.6.3#76005)