Skip to content

Commit 0af1799

Browse files
committed
Remove usage of generic wildcard type
1 parent 85e3b63 commit 0af1799

30 files changed

Lines changed: 100 additions & 99 deletions

File tree

springfox-bean-validators/src/main/java/springfox/bean/validators/plugins/Validators.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public static <T extends Annotation> Optional<T> annotationFromBean(
5959
if (propertyDefinition.isPresent()) {
6060
Optional<Method> getter = extractGetterFromPropertyDefinition(propertyDefinition.get());
6161
Optional<Field> field = extractFieldFromPropertyDefinition(propertyDefinition.get());
62-
notNull = findAnnotation(getter, annotationType).map(Optional::of).orElse(findAnnotation(field, annotationType));
62+
notNull = findAnnotation(getter, annotationType)
63+
.or(() -> findAnnotation(field, annotationType));
6364
}
6465

6566
return notNull;

springfox-core/src/main/java/springfox/documentation/RequestHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public interface RequestHandler extends Comparable<RequestHandler> {
5959

6060
Set<RequestMethod> supportedMethods();
6161

62-
Set<? extends MediaType> produces();
62+
Set<MediaType> produces();
6363

64-
Set<? extends MediaType> consumes();
64+
Set<MediaType> consumes();
6565

6666
Set<NameValueExpression<String>> headers();
6767

@@ -82,7 +82,7 @@ public interface RequestHandler extends Comparable<RequestHandler> {
8282
* @deprecated This is introduced to preserve backwards compat
8383
*/
8484
@Deprecated
85-
RequestMappingInfo getRequestMapping();
85+
RequestMappingInfo<?> getRequestMapping();
8686

8787
/**
8888
* @return handler method

springfox-core/src/main/java/springfox/documentation/RequestHandlerKey.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ public class RequestHandlerKey {
2929

3030
private final Set<String> pathMappings;
3131
private final Set<RequestMethod> supportedMethods;
32-
private final Set<? extends MediaType> supportedMediaTypes;
33-
private final Set<? extends MediaType> producibleMediaTypes;
32+
private final Set<MediaType> supportedMediaTypes;
33+
private final Set<MediaType> producibleMediaTypes;
3434

3535
public RequestHandlerKey(
3636
Set<String> pathMappings,
3737
Set<RequestMethod> supportedMethods,
38-
Set<? extends MediaType> supportedMediaTypes,
39-
Set<? extends MediaType> producibleMediaTypes) {
38+
Set<MediaType> supportedMediaTypes,
39+
Set<MediaType> producibleMediaTypes) {
4040

4141
this.pathMappings = pathMappings;
4242
this.supportedMethods = supportedMethods;
@@ -52,11 +52,11 @@ public Set<RequestMethod> getSupportedMethods() {
5252
return supportedMethods;
5353
}
5454

55-
public Set<? extends MediaType> getSupportedMediaTypes() {
55+
public Set<MediaType> getSupportedMediaTypes() {
5656
return supportedMediaTypes;
5757
}
5858

59-
public Set<? extends MediaType> getProducibleMediaTypes() {
59+
public Set<MediaType> getProducibleMediaTypes() {
6060
return producibleMediaTypes;
6161
}
6262

springfox-core/src/main/java/springfox/documentation/builders/ElementFacets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static <T extends ElementFacetBuilder> Function<Class<?>, ElementFacetBui
1717
Class<T> clazz) {
1818
return t -> {
1919
try {
20-
return clazz.newInstance();
20+
return clazz.getDeclaredConstructor().newInstance();
2121
} catch (Exception e) {
2222
LOGGER.error("Unable to create builder of type {}", clazz);
2323
throw new RuntimeException(String.format("Unable to create builder of type %s", clazz), e);

springfox-core/src/main/java/springfox/documentation/builders/RequestHandlerSelectors.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ private static Function<Class<?>, Boolean> handlerPackage(final String basePacka
8888
* @param basePackage - base package of the classes
8989
* @return this
9090
*/
91-
public static Predicate<RequestHandler> basePackage(final String basePackage) {
91+
public static Predicate<RequestHandler> basePackage(String basePackage) {
9292
return input -> declaringClass(input).map(handlerPackage(basePackage)).orElse(true);
9393
}
9494

95-
private static Optional<? extends Class<?>> declaringClass(RequestHandler input) {
95+
private static Optional<Class<?>> declaringClass(RequestHandler input) {
9696
return ofNullable(input.declaringClass());
9797
}
9898

springfox-core/src/main/java/springfox/documentation/builders/RequestParameterBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public RequestParameterBuilder parameterSpecificationProvider(ParameterSpecifica
133133
return this;
134134
}
135135

136-
public RequestParameterBuilder accepts(Collection<? extends MediaType> accepts) {
136+
public RequestParameterBuilder accepts(Collection<MediaType> accepts) {
137137
this.accepts.addAll(accepts);
138138
return this;
139139
}

springfox-core/src/main/java/springfox/documentation/builders/ResourceListingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public ResourceListingBuilder apis(List<ApiListingReference> apis) {
6666
* @param authorizations - security definitions
6767
* @return this
6868
*/
69-
public ResourceListingBuilder securitySchemes(List<? extends SecurityScheme> authorizations) {
69+
public ResourceListingBuilder securitySchemes(List<SecurityScheme> authorizations) {
7070
this.securitySchemes.addAll(nullToEmptyList(authorizations));
7171
return this;
7272
}

springfox-core/src/main/java/springfox/documentation/schema/ModelProperty.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public boolean isHidden() {
130130
return isHidden;
131131
}
132132

133-
public ModelProperty updateModelRef(Function<ResolvedType, ? extends ModelReference> modelRefFactory) {
133+
public ModelProperty updateModelRef(Function<ResolvedType, ModelReference> modelRefFactory) {
134134
modelRef = modelRefFactory.apply(type);
135135
return this;
136136
}

springfox-core/src/test/groovy/springfox/documentation/builders/MockRequestHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ public Set<RequestMethod> supportedMethods() {
8787
}
8888

8989
@Override
90-
public Set<? extends MediaType> produces() {
90+
public Set<MediaType> produces() {
9191
return null;
9292
}
9393

9494
@Override
95-
public Set<? extends MediaType> consumes() {
95+
public Set<MediaType> consumes() {
9696
return null;
9797
}
9898

@@ -132,7 +132,7 @@ public <T extends Annotation> Optional<T> findControllerAnnotation(Class<T> anno
132132
}
133133

134134
@Override
135-
public springfox.documentation.spring.wrapper.RequestMappingInfo getRequestMapping() {
135+
public springfox.documentation.spring.wrapper.RequestMappingInfo<?> getRequestMapping() {
136136
return null;
137137
}
138138
}

springfox-data-rest/src/main/java/springfox/documentation/spring/data/rest/SpringDataRestRequestHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ public Set<RequestMethod> supportedMethods() {
9393
}
9494

9595
@Override
96-
public Set<? extends MediaType> produces() {
96+
public Set<MediaType> produces() {
9797
return actionSpecification.getProduces();
9898
}
9999

100100
@Override
101-
public Set<? extends MediaType> consumes() {
101+
public Set<MediaType> consumes() {
102102
return actionSpecification.getConsumes();
103103
}
104104

@@ -154,7 +154,7 @@ public HandlerMethod getHandlerMethod() {
154154
}
155155

156156
@Override
157-
public RequestMappingInfo getRequestMapping() {
157+
public RequestMappingInfo<?> getRequestMapping() {
158158
throw new UnsupportedOperationException();
159159
}
160160

0 commit comments

Comments
 (0)