mulesoft-labs / raml-java-client-generator

Raml Java Client Generator
Apache License 2.0
34 stars 34 forks source link

Query parameter "class" generates invalid code #54

Open wmono opened 2 years ago

wmono commented 2 years ago

Describe the bug A RAML specifying a query parameter named "class" results in the generation of a method getClass(), which is an invalid override of Object.

package com.example.test.resource.test.model;

public class TestGETQueryParam {

    private String _class_;

    public TestGETQueryParam(String class_) {
        _class_ = class_;
    }

    public void setClass(String class_) {
        _class_ = class_;
    }

    public String getClass() {
        return _class_;
    }

}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project test: Compilation failure
[ERROR] /home/wiono/Projects/test/target/generated-sources/com/example/test/resource/test/model/TestGETQueryParam.java:[17,19] getClass() in com.example.test.resource.test.model.TestGETQueryParam cannot override getClass() in java.lang.Object
[ERROR]   overridden method is final

To Reproduce Steps to reproduce the behavior:

Generate a client from the following RAML:

#%RAML 1.0
title: Test
mediaType: application/json
/test:
  get:
    queryParameters:
      class:
        type: array

Expected behavior The generated client should compile.

Additional context Add any other context about the problem here.

Maven:

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T12:39:06-07:00)
Maven home: /home/wiono/local/apache-maven-3.5.0
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /home/wiono/local/jdk1.8.0_171/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-11-amd64", arch: "amd64", family: "unix"

Plugin configuration:

<plugin>
    <groupId>org.mule.raml.codegen</groupId>
    <artifactId>raml-client-generator-maven-plugin</artifactId>
    <version>0.11</version>
    <configuration>
        <useJava8Dates>true</useJava8Dates>
    </configuration>
    <executions>
        <execution>
            <id>test</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>generate-client</goal>
            </goals>
            <configuration>
                <basePackage>com.example.test</basePackage>
                <ramlFile>${project.basedir}/src/main/resources/schema/test/test.raml</ramlFile>
            </configuration>
        </execution>
    </executions>
</plugin>
uip-robot-zz commented 2 years ago

Git2Gus App is installed but the .git2gus/config.json doesn't exist.