Skip to content

Commit

Permalink
support java 9/10
Browse files Browse the repository at this point in the history
  • Loading branch information
frantuma committed Mar 29, 2018
1 parent 059312e commit 928e33d
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ language: java
script: ./mvnw clean verify
jdk:
- oraclejdk8
- oraclejdk9
- oraclejdk9
after_success:
- if [ $SONATYPE_USERNAME ] && [ -z $TRAVIS_TAG ] && [ $TRAVIS_PULL_REQUEST == false ]; then
./mvnw clean deploy --settings .travis/settings.xml;
Expand Down
4 changes: 2 additions & 2 deletions modules/swagger-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
Expand Down Expand Up @@ -97,7 +97,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.1</version>
<version>3.0.0</version>
<configuration>
<checkoutDirectory>${project.build.directory}/scmpublish</checkoutDirectory>
<checkinComment>Publishing javadoc for ${project.artifactId}:${project.version}</checkinComment>
Expand Down
9 changes: 7 additions & 2 deletions modules/swagger-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<version>3.0.2</version>
<executions>
<execution>
<goals>
Expand All @@ -48,6 +48,11 @@
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down Expand Up @@ -127,7 +132,7 @@
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
<version>2.2.0</version>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,14 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
// TODO custom implementation of hashcode as Objects.hash fails (hash code different for what seem to be equal
// fileds ) for some reason for "sun" annotations.
if (ctxAnnotations == null || ctxAnnotations.length == 0) {
return Objects.hash(type, ctxAnnotations);
return Objects.hash(type);
}
List<Annotation> meaningfulAnnotations = new ArrayList<>();

boolean hasDifference = false;
for (Annotation a: ctxAnnotations) {
if(!a.annotationType().getName().startsWith("sun")) {
if(!a.annotationType().getName().startsWith("sun") && !a.annotationType().getName().startsWith("jdk")) {
meaningfulAnnotations.add(a);
} else {
hasDifference = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context
}

// using deprecated method to maintain compatibility with jackson version < 2.9
//alternatively use AnnotatedMember jsonValueMember = beanDesc.findJsonValueAccessor();
final AnnotatedMethod jsonValueMethod = beanDesc.findJsonValueMethod();
if(jsonValueMethod != null) {
AnnotatedType aType = new AnnotatedType()
Expand Down Expand Up @@ -561,6 +562,15 @@ public Schema resolve(AnnotatedType annotatedType, ModelConverterContext context

if (property != null) {
if (property.get$ref() == null) {
if (!"object".equals(property.getType())) {
try {
String cloneName = property.getName();
property = Json.mapper().readValue(Json.pretty(property), Schema.class);
property.setName(cloneName);
} catch (IOException e) {
LOGGER.error("Could not clone property, e");
}
}
Boolean required = md.getRequired();
if (required != null && !Boolean.FALSE.equals(required)) {
addRequiredItem(model, propName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public static boolean isVoid(Type type) {
}

public static boolean isSystemType(JavaType type) {
// used while resolving containter types to skip resolving system types; possibly extend by checking classloader
// used while resolving container types to skip resolving system types; possibly extend by checking classloader
// and/or other packages
if (type.getRawClass().getName().startsWith("java")) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.swagger.v3.core.converter.AnnotatedType;
import io.swagger.v3.core.converter.ModelConverterContextImpl;
import io.swagger.v3.core.jackson.ModelResolver;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.oas.models.media.Schema;
import org.testng.annotations.Test;

Expand Down
14 changes: 12 additions & 2 deletions modules/swagger-jaxrs2-servlet-initializer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,23 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
47 changes: 41 additions & 6 deletions modules/swagger-jaxrs2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,17 @@
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.21.0-GA</version>
<version>3.22.0-GA</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
Expand All @@ -175,32 +181,61 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.restassured</groupId>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-impl</artifactId>
<version>3.0.2.Final</version>
<version>3.0.3.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<version>1.1.15.Final</version>
<version>1.4.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-weld-embedded</artifactId>
<version>2.0.0.Final</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-spi</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-container-test-spi</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.arquillian.test</groupId>
<artifactId>arquillian-test-spi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
Expand Down Expand Up @@ -253,7 +288,7 @@
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.9.1</version>
<version>${jackson-version}</version>
</dependency>
</dependencies>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.swagger.v3.jaxrs2.it;

import com.fasterxml.jackson.databind.SerializationFeature;
import com.jayway.restassured.http.ContentType;

import io.restassured.http.ContentType;
import io.swagger.v3.core.util.Json;
import io.swagger.v3.core.util.Yaml;
import io.swagger.v3.jaxrs2.annotations.AbstractAnnotationTest;
Expand All @@ -12,7 +12,7 @@

import java.io.IOException;

import static com.jayway.restassured.RestAssured.given;
import static io.restassured.RestAssured.given;

/**
* <p>
Expand Down
14 changes: 10 additions & 4 deletions modules/swagger-models/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<argLine>-Djdk.attach.allowAttachSelf</argLine>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
Expand Down Expand Up @@ -79,9 +87,7 @@
<validation-api-version>1.1.0.Final</validation-api-version>
<coverage.complexity.minimum>0.07</coverage.complexity.minimum>
<coverage.line.minimum>0.0</coverage.line.minimum>
<jmockit-version>1.25</jmockit-version>

<powermock.version>1.6.4</powermock.version>
<mockito-version>1.10.19</mockito-version>
<jmockit-version>1.39</jmockit-version>
<mockito-version>2.16.0</mockito-version>
</properties>
</project>
Loading

0 comments on commit 928e33d

Please sign in to comment.