Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A8A5E200CDD for ; Mon, 7 Aug 2017 14:12:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A6F7F1653EB; Mon, 7 Aug 2017 12:12:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C66471653E9 for ; Mon, 7 Aug 2017 14:12:08 +0200 (CEST) Received: (qmail 78962 invoked by uid 500); 7 Aug 2017 12:12:08 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 78953 invoked by uid 99); 7 Aug 2017 12:12:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Aug 2017 12:12:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2D497C059D for ; Mon, 7 Aug 2017 12:12:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id TWjKxoCZex2E for ; Mon, 7 Aug 2017 12:12:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 569FB5F6C1 for ; Mon, 7 Aug 2017 12:12:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 91ECDE010F for ; Mon, 7 Aug 2017 12:12:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4FF2723FFD for ; Mon, 7 Aug 2017 12:12:00 +0000 (UTC) Date: Mon, 7 Aug 2017 12:12:00 +0000 (UTC) From: "Silvio Assuncao (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-8273) JavaAwareCompilationUnit with array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 07 Aug 2017 12:12:09 -0000 [ https://issues.apache.org/jira/browse/GROOVY-8273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16116497#comment-16116497 ] Silvio Assuncao commented on GROOVY-8273: ----------------------------------------- I can't use [], the class is generated by wadlToJava, this is a CXF tool Do you know when the new version of the parser will be launched? > JavaAwareCompilationUnit with array > ----------------------------------- > > Key: GROOVY-8273 > URL: https://issues.apache.org/jira/browse/GROOVY-8273 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk, groovy-runtime > Affects Versions: 2.4.7 > Reporter: Silvio Assuncao > Assignee: Jochen Theodorou > > I have the generated java class below with Array, when I try compile using JavaAwareCompilationUnit I receive the error: > *Error* > {code:java} > Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: > br/com/me/geodata/message/City.java: 33: unexpected token: id @ line 33, column 5.org.codehaus.groovy.syntax.SyntaxException: unexpected token: id @ line 33, column 5. > at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:143) > at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:111) > {code} > Generated class City.java > {code:java} > package br.com.me.geodata.message; > import javax.xml.bind.annotation.XmlAccessType; > import javax.xml.bind.annotation.XmlAccessorType; > import javax.xml.bind.annotation.XmlType; > /** > *

Java class for City complex type. > * > *

The following schema fragment specifies the expected content contained within this class. > * > *

>  * <complexType name="City">
>  *   <complexContent>
>  *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
>  *       <sequence>
>  *         <element name="id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
>  *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
>  *         <element name="state" type="{http://message.geodata.me.com.br/}State" minOccurs="0"/>
>  *         <element name="version" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
>  *       </sequence>
>  *     </restriction>
>  *   </complexContent>
>  * </complexType>
>  * 
> * > * > */ > @XmlAccessorType(XmlAccessType.FIELD) > @XmlType(name = "City", propOrder = { > "id", > "name", > "state", > "version" > }) > public class City { > protected String id; > protected String name; > protected State state; > protected Integer version; > /** > * Gets the value of the id property. > * > * @return > * possible object is > * {@link String } > * > */ > public String getId() { > return id; > } > /** > * Sets the value of the id property. > * > * @param value > * allowed object is > * {@link String } > * > */ > public void setId(String value) { > this.id = value; > } > /** > * Gets the value of the name property. > * > * @return > * possible object is > * {@link String } > * > */ > public String getName() { > return name; > } > /** > * Sets the value of the name property. > * > * @param value > * allowed object is > * {@link String } > * > */ > public void setName(String value) { > this.name = value; > } > /** > * Gets the value of the state property. > * > * @return > * possible object is > * {@link State } > * > */ > public State getState() { > return state; > } > /** > * Sets the value of the state property. > * > * @param value > * allowed object is > * {@link State } > * > */ > public void setState(State value) { > this.state = value; > } > /** > * Gets the value of the version property. > * > * @return > * possible object is > * {@link Integer } > * > */ > public Integer getVersion() { > return version; > } > /** > * Sets the value of the version property. > * > * @param value > * allowed object is > * {@link Integer } > * > */ > public void setVersion(Integer value) { > this.version = value; > } > } > {code} > *My method compilation* > {code:java} > @Override > public List compile(DynamicClassLoader classLoader, List sourceCodes) throws CantCompileException { > File tempDir = createTempDir(); > try { > CompilerConfiguration configuration = new CompilerConfiguration(); > configuration.setDebug(true); > configuration.setTargetBytecode(CompilerConfiguration.JDK8); > Map compilationOptions = new HashMap<>(); > compilationOptions.put("jointCompilation", true); > compilationOptions.put("stubDir", tempDir); > configuration.setJointCompilationOptions(compilationOptions); > JavaAwareCompilationUnit javaCompilerUnit = new JavaAwareCompilationUnit(configuration, classLoader); > for (SourceCode sourceCode : sourceCodes) { > javaCompilerUnit.addSource(sourceCode.getCanonicalPath(), new ByteArrayInputStream(sourceCode.getCode())); > } > javaCompilerUnit.setCompilerFactory(new JavacCompilerFactory()); > javaCompilerUnit.compile(); > List groovyClassList = javaCompilerUnit.getClasses(); > return groovyClassList.stream() > .map(d -> new CompiledCode(d.getName(), null, d.getBytes())) > .collect(Collectors.toList()); > } finally { > tempDir.delete(); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)