diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java index 60a7cb0e934..1130cea86ba 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java @@ -159,7 +159,7 @@ private TypeDef visitTypeDefInParallel(TypeDef def, List * @param format the format of the printer column * @return the concrete decorator implementing the addition of a printer column to the currently built CRD */ - protected abstract Decorator getPrinterColumnDecorator(String name, String version, String path, + protected abstract Decorator getPrinterColumnDecorator(String name, String version, String path, String type, String column, String description, String format, int priority); /** diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java index c31f826274d..0794ba40bb7 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractJsonSchema.java @@ -213,7 +213,7 @@ private static ClassRef extractClassRef(Object type) { if (type instanceof ClassRef) { return (ClassRef) type; } else if (type instanceof Class) { - return Types.typeDefFrom((Class) type).toReference(); + return Types.typeDefFrom((Class) type).toReference(); } else { throw new IllegalArgumentException("Unmanaged type passed to the annotation " + type); } @@ -564,7 +564,7 @@ public Property process() { String finalName = renamedTo != null ? renamedTo : original.getName(); return new Property(original.getAnnotations(), typeRef, finalName, - original.getComments(), original.getModifiers(), original.getAttributes()); + original.getComments(), false, false, original.getModifiers(), original.getAttributes()); } } @@ -653,6 +653,7 @@ private T internalFromImpl(String name, TypeRef typeRef, Set visited, In // Note that ordering of the checks here is meaningful: we need to check for complex types last // in case some "complex" types are handled specifically if (typeRef.getDimensions() > 0 || io.sundr.model.utils.Collections.isCollection(typeRef)) { // Handle Collections & Arrays + //noinspection unchecked final TypeRef collectionType = TypeAs.combine(TypeAs.UNWRAP_ARRAY_OF, TypeAs.UNWRAP_COLLECTION_OF) .apply(typeRef); final T schema = internalFromImpl(name, collectionType, visited, schemaSwaps); diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/CustomResourceInfo.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/CustomResourceInfo.java index 6535139ed41..ee0c326d076 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/CustomResourceInfo.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/CustomResourceInfo.java @@ -45,8 +45,8 @@ public class CustomResourceInfo { private final Scope scope; private final TypeDef definition; private final String crClassName; - private final Optional specClassName; - private final Optional statusClassName; + private final String specClassName; + private final String statusClassName; private final String id; private final int hash; @@ -68,8 +68,8 @@ public CustomResourceInfo(String group, String version, String kind, String sing this.scope = scope; this.definition = definition; this.crClassName = crClassName; - this.specClassName = Optional.ofNullable(specClassName); - this.statusClassName = Optional.ofNullable(statusClassName); + this.specClassName = specClassName; + this.statusClassName = statusClassName; this.id = crdName() + "/" + version; this.hash = id.hashCode(); this.annotations = annotations; @@ -125,11 +125,11 @@ public String crClassName() { } public Optional specClassName() { - return specClassName; + return Optional.ofNullable(specClassName); } public Optional statusClassName() { - return statusClassName; + return Optional.ofNullable(statusClassName); } public TypeDef definition() { @@ -144,9 +144,9 @@ public String[] labels() { return labels; } - public static CustomResourceInfo fromClass(Class customResource) { + public static CustomResourceInfo fromClass(Class> customResource) { try { - final CustomResource instance = customResource.getDeclaredConstructor().newInstance(); + final CustomResource instance = customResource.getDeclaredConstructor().newInstance(); final String[] shortNames = CustomResource.getShortNames(customResource); diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/InternalSchemaSwaps.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/InternalSchemaSwaps.java index 49fc4bef1b0..8527ddb5af9 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/InternalSchemaSwaps.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/InternalSchemaSwaps.java @@ -50,8 +50,7 @@ public InternalSchemaSwaps branchDepths() { public InternalSchemaSwaps branchAnnotations() { Map combined = new HashMap<>(swaps); combined.putAll(parentSwaps); - InternalSchemaSwaps result = new InternalSchemaSwaps(new HashMap<>(), this.swapDepths, combined); - return result; + return new InternalSchemaSwaps(new HashMap<>(), this.swapDepths, combined); } public void registerSwap(ClassRef definitionType, ClassRef originalType, String fieldName, ClassRef targetType, diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java index be211f1dc76..a16af18cd85 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java @@ -45,7 +45,7 @@ public CustomResourceHandler(Resources resources, boolean parallel) { } @Override - protected Decorator getPrinterColumnDecorator(String name, + protected Decorator getPrinterColumnDecorator(String name, String version, String path, String type, String column, String description, String format, int priority) { return new AddAdditionPrinterColumnDecorator(name, version, type, column, path, format, diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java index 9a660f86647..a257d732b59 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java @@ -45,7 +45,7 @@ public CustomResourceHandler(Resources resources, boolean parallel) { } @Override - protected Decorator getPrinterColumnDecorator( + protected Decorator getPrinterColumnDecorator( String name, String version, String path, String type, String column, String description, String format, int priority) { return new AddAdditionPrinterColumnDecorator(name, version, type, column, path, format,