Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromCustomResourceType should be of type CustomResource? #2695

Closed
jorsol opened this issue Dec 23, 2020 · 0 comments · Fixed by #2700
Closed

fromCustomResourceType should be of type CustomResource? #2695

jorsol opened this issue Dec 23, 2020 · 0 comments · Fixed by #2700
Assignees
Labels
Milestone

Comments

@jorsol
Copy link
Contributor

jorsol commented Dec 23, 2020

Right now CustomResourceDefinitionContext has the following method:

public static CustomResourceDefinitionContext fromCustomResourceType(Class<? extends HasMetadata> customResource) {
try {
final CustomResource instance = (CustomResource) customResource.getDeclaredConstructor().newInstance();

and it does a Cast to CustomResource... shouldn't be safer to use Class<? extends CustomResource> instead of HasMetadata? (like v1CRDFromCustomResourceType and v1beta1CRDFromCustomResourceType)

The try doesn't even catch ClassCastException so this could be potentially a problem.

@manusa manusa added the bug label Dec 24, 2020
@manusa manusa added this to the 5.0.0 milestone Dec 24, 2020
@manusa manusa self-assigned this Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants