You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CustomResource classes with private or package-private visability will be found by the CRDGenerator collector. But those cannot be processed by the CRDGenerator api-v2 because it is using reflection to instantiate the CustomResource class without modifying the constructors accessability.
We should align the behaviour of the collector and api-v2. Either we filter private and package-private custom resource classes in the collector, or we should modify the accessability of the constructor of the CustomResource in CustomResourceInfo before trying to instantiate it.
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
CRD-Generator Maven Plugin Logs
Caused by: java.lang.IllegalAccessException: class io.fabric8.crdv2.generator.CustomResourceInfo cannot access a member of class io.fabric8.crd.maven.example.api.v2.Multiple with modifiers ""
at jdk.internal.reflect.Reflection.newIllegalAccessException (Reflection.java:392)
at java.lang.reflect.AccessibleObject.checkAccess (AccessibleObject.java:674)
at java.lang.reflect.Constructor.newInstanceWithCaller (Constructor.java:490)
at java.lang.reflect.Constructor.newInstance (Constructor.java:481)
at io.fabric8.crdv2.generator.CustomResourceInfo.fromClass (CustomResourceInfo.java:168)
at java.util.stream.ReferencePipeline$3$1.accept (ReferencePipeline.java:197)
at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:179)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1625)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:509)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:575)
at java.util.stream.AbstractPipeline.evaluateToArrayNode (AbstractPipeline.java:260)
at java.util.stream.ReferencePipeline.toArray (ReferencePipeline.java:616)
at io.fabric8.crdv2.generator.CRDGenerator.customResourceClasses (CRDGenerator.java:128)
at io.fabric8.crd.generator.maven.plugin.CrdGeneratorMojo.execute (CrdGeneratorMojo.java:178)
Describe the bug
CustomResource classes with private or package-private visability will be found by the CRDGenerator collector. But those cannot be processed by the CRDGenerator api-v2 because it is using reflection to instantiate the CustomResource class without modifying the constructors accessability.
https://github.com/fabric8io/kubernetes-client/blob/main/crd-generator/api-v2/src/main/java/io/fabric8/crdv2/generator/CustomResourceInfo.java#L168
getDeclaredConstructor()
does only work with public classes.Fabric8 Kubernetes Client version
SNAPSHOT
Steps to reproduce
baloo42/crd-generator-maven-examples#11
Expected behavior
We should align the behaviour of the collector and api-v2. Either we filter private and package-private custom resource classes in the collector, or we should modify the accessability of the constructor of the CustomResource in CustomResourceInfo before trying to instantiate it.
Runtime
Kubernetes (vanilla)
Kubernetes API Server version
1.25.3@latest
Environment
Linux
CRD-Generator Maven Plugin Logs
Additional context
operator-framework/java-operator-sdk#2540
#6683
/cc @metacosm
The text was updated successfully, but these errors were encountered: