You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/07/05 16:49:00 UTC

[jira] [Closed] (GROOVY-8323) @XmlSeeAlso annotation using Java syntax leads to groovy compiler error

     [ https://issues.apache.org/jira/browse/GROOVY-8323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles closed GROOVY-8323.
-------------------------------
    Resolution: Won't Fix

> @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
>            Priority: Major
>
> According to Oracle Java documentation, it should be possible to use JAXB with the @XmlSeeAlso annotaion as follows:
> {code}
> import javax.xml.bind.annotation.XmlSeeAlso
> @XmlSeeAlso({Dog.class,Cat.class})
>  class Animal {}
>  class Dog extends Animal {}
>  class Cat extends Animal {}
> {code}
> Running a groovy script containing the above code, results in a compiler error message:
> {noformat}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> <subdir>\myscript.groovy: 3: expecting '}', found ',' @ line 3, column 23.
>    @XmlSeeAlso({Dog.class,Cat.class})
> {noformat}
> 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
(v8.20.10#820010)