Matthias Albert created GROOVY-8323:
---------------------------------------

             Summary: @XmlSeeAlso annotation using Java syntax leads to groovy 
compiler error
                 Key: GROOVY-8323
                 URL: https://issues.apache.org/jira/browse/GROOVY-8323
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.4.12
            Reporter: Matthias Albert


According to Oracle Java documentation, it should be possible to use JAXB with 
the @XmlSeeAlso annotaion as follows:
{{
import javax.xml.bind.annotation.XmlSeeAlso
@XmlSeeAlso({Dog.class,Cat.class})
 class Animal {}
 class Dog extends Animal {}
 class Cat extends Animal {}
}}

Running a groovy script containing the above code, results in a compiler error 
message:
{{
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
<subdir>\myscript.groovy: 3: expecting '}', found ',' @ line 3, column 23.
   @XmlSeeAlso({Dog.class,Cat.class})
                         ^}}

Apparently, the class arguments are expected to be enclosed in square brackets 
[...].

My main question is:
It is possible, that this valid java code cannot be compiled by the groovy 
compiler?

My background is: 
I am writing a groovy script that uses java files generated by the xjc compiler 
from an XML schema file. They cannot be modified manually. I would like to 
compile these files by the groovy compiler using a CompilerConfiguration and 
adding 'java' to the scriptExtensions.

Thanks in advance.
Matthias




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to