| 

.NET C# Java Javascript Exception

Problem with annotations for closure parameters

Dies ist das Archiv des ehemaligen Forums zum Thema Groovy, Grails, Griffon und Bean Scripting Framework, welches unter groovy-forum.de existierte. Die neue Adresse des Groovy-Forums ist: http://codekicker.de/fragen/themen/groovy.


Problem with annotations for closure parameters

herrmama - 01.04.2010 09:02
Hi guys,

I am using Groovy as part of COPE (http://cope.in.tum.de/pmwiki.php) to define a model migration in response to a metamodel adaptation. Recently, I wanted to switch from Groovy 1.5.7 to 1.7.0. However, my Groovy files no longer compile. I get the error "class description is not an annotation in @description" on annotations which are defined for closure parameters. This is some code where the problem occurs:

----------------------------------------------------------------------------------------------------
import org.eclipse.emf.ecore.util.*
import edu.tum.cs.cope.migration.*

@label("New Class")
@description("In the metamodel, a new class is created. Nothing is changed in the model.")
newClassImpl = {
@description("The package in which the class is created") EPackage ePackage,
@description("The name of the new class") String name,
@description("The super classes of the new class") Collection<EClass> superClasses = [],
@description("Whether the class is abstract") boolean abstr = false ->
ePackage.newEClass(name, superClasses, abstr)
}
newClass = newClassImpl


@label("New Reference")
@description("In the metamodel, a new reference is created. Nothing is changed in the model.")
newReferenceImpl = {
@description("The class in which the reference is created") EClass eClass,
@description("The name of the new reference") String name,
@description("The type of the new reference") EClass type,
@description("The lower bound of the new reference") int lowerBound = 0,
@description("The upper bound of the new reference") int upperBound = 1,
@description("Whether the new reference is a containment reference") boolean containment = false,
@description("The opposite reference of the new reference") EReference opposite = null ->
eClass.newEReference(name, type, lowerBound, upperBound, containment, opposite)
}
newReference = newReferenceImpl
-----------------------------------------------------------------------------------------

I do not get the error for the description annotation of the closures, but only for the description annotation of its parameters. I tried a number of things, e.g. explicitely defining the annotations, however I could not find a solution to this problem. Could you please take a look at it and help me to resolve this problem? If I cannot resolve this problem, I cannot switch to Groovy 1.7.0.
Thanks in advance for your help.
Cheers,

Markus

--
Markus Herrmannsdörfer Technische Universität München
[www4.in.tum.de] Institut für Informatik
phone: +49 (89) 289-17336 Software & Systems Engineering
fax: +49 (89) 289-17307 Boltzmannstraße 3
room: 01.11.043 85748 Garching


Re: Problem with annotations for closure parameters

herrmama - 05.04.2010 11:21
Hallo Christian,

sorry, wusste nicht, dass Deutsch verpflichtend. Habs jetzt noch einmal auf Deutsch eingestellt.
Vielen Dank für die Info.

Markus


Stelle deine Groovy-Frage jetzt!


Diese Seite zeigt den Thread "Problem with annotations for closure parameters" der ehemaligen Webseite groovy-forum.de, welche durch einen Serverunfall zerstört wurde. codekicker.de hat viele Konversationen über die beliebte Programmiersprache Groovy und zugehörige Frameworks wie das Grails-Framework retten können.

Hast Du eine Frage zum Thema Groovy, Grails oder allgemein Java? Viele ehemalige groovy-forum.de Mitglieder beantworten dir auf codekicker.de deine Frage! Stelle jetzt eine Frage!

Viele weitere Diskussionen zu Grails und Groovy befinden sich auf der Threadübersicht des alten groovy-forum.de.