forked from loafle/openapi-generator-original
[Bug] [Java] Remove raw type compilation warnings when generating using jersey2 or jersey3 (#19033)
* Add type annotations to raw types for jersey2 and jersey3 templates * Update samples * Add type parameters to anyof_model.mustache and oneof_model.mustache --------- Co-authored-by: Kasper S. Nielsen <kasper.s.nielsen@secata.com>
This commit is contained in:
@@ -641,9 +641,9 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
return formatDate((Date) param);
|
||||
} else if (param instanceof OffsetDateTime) {
|
||||
return formatOffsetDateTime((OffsetDateTime) param);
|
||||
} else if (param instanceof Collection) {
|
||||
} else if (param instanceof Collection<?>) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
for(Object o : (Collection)param) {
|
||||
for(Object o : (Collection<?>)param) {
|
||||
if(b.length() > 0) {
|
||||
b.append(',');
|
||||
}
|
||||
@@ -669,9 +669,9 @@ public class ApiClient extends JavaTimeFormatter {
|
||||
// preconditions
|
||||
if (name == null || name.isEmpty() || value == null) return params;
|
||||
|
||||
Collection valueCollection;
|
||||
if (value instanceof Collection) {
|
||||
valueCollection = (Collection) value;
|
||||
Collection<?> valueCollection;
|
||||
if (value instanceof Collection<?>) {
|
||||
valueCollection = (Collection<?>) value;
|
||||
} else {
|
||||
params.add(new Pair(name, parameterToString(value)));
|
||||
return params;
|
||||
|
||||
@@ -178,9 +178,9 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
||||
visitedClasses.add(modelClass);
|
||||
|
||||
// Traverse the oneOf/anyOf composed schemas.
|
||||
Map<String, GenericType> descendants = modelDescendants.get(modelClass);
|
||||
Map<String, GenericType<?>> descendants = modelDescendants.get(modelClass);
|
||||
if (descendants != null) {
|
||||
for (GenericType childType : descendants.values()) {
|
||||
for (GenericType<?> childType : descendants.values()) {
|
||||
if (isInstanceOf(childType.getRawType(), inst, visitedClasses)) {
|
||||
return true;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
||||
/**
|
||||
* A map of oneOf/anyOf descendants for each model class.
|
||||
*/
|
||||
private static Map<Class<?>, Map<String, GenericType>> modelDescendants = new HashMap<>();
|
||||
private static Map<Class<?>, Map<String, GenericType<?>>> modelDescendants = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Register a model class discriminator.
|
||||
@@ -217,7 +217,7 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
||||
* @param modelClass the model class
|
||||
* @param descendants a map of oneOf/anyOf descendants.
|
||||
*/
|
||||
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType> descendants) {
|
||||
public static void registerDescendants(Class<?> modelClass, Map<String, GenericType<?>> descendants) {
|
||||
modelDescendants.put(modelClass, descendants);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class AbstractOpenApiSchema {
|
||||
*
|
||||
* @return an instance of the actual schema/object
|
||||
*/
|
||||
public abstract Map<String, GenericType> getSchemas();
|
||||
public abstract Map<String, GenericType<?>> getSchemas();
|
||||
|
||||
/**
|
||||
* Get the actual instance
|
||||
|
||||
Reference in New Issue
Block a user