Skip to content

Commit

Permalink
[Java-client] Add maven-compiler-plugin in pom.xml and enable linter …
Browse files Browse the repository at this point in the history
…checks by default (OpenAPITools#5866)

* Add maven-compiler-plugin plugin in Java pom.xml and enable linter checks by default

* Add maven-compiler-plugin plugin in Java pom.xml and enable linter checks by default
  • Loading branch information
sebastien-rosset authored and michaelpro1 committed May 7, 2020
1 parent f978a90 commit ecb21d2
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class JSON {
.registerTypeSelector({{classname}}.class, new TypeSelector() {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
{{#mappedModels}}
classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(Locale.ROOT), {{modelName}}.class);
{{/mappedModels}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
14 changes: 14 additions & 0 deletions modules/openapi-generator/src/main/resources/Java/pom.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
14 changes: 14 additions & 0 deletions samples/client/petstore/java/jersey1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static GsonBuilder createGson() {
.registerTypeSelector(Animal.class, new TypeSelector() {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class);
classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class);
Expand Down
13 changes: 13 additions & 0 deletions samples/client/petstore/java/okhttp-gson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static GsonBuilder createGson() {
.registerTypeSelector(Animal.class, new TypeSelector() {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class);
classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static GsonBuilder createGson() {
.registerTypeSelector(Animal.class, new TypeSelector() {
@Override
public Class getClassForElement(JsonElement readElement) {
Map classByDiscriminatorValue = new HashMap();
Map<String, Class> classByDiscriminatorValue = new HashMap<String, Class>();
classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class);
classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class);
classByDiscriminatorValue.put("BigCat".toUpperCase(Locale.ROOT), BigCat.class);
Expand Down

0 comments on commit ecb21d2

Please sign in to comment.