improve: deprecate instance based Mappers.fromOwnerReferences#3365
Conversation
There was a problem hiding this comment.
Pull request overview
This PR deprecates the instance-based Mappers.fromOwnerReferences(HasMetadata ...) overloads in favor of using class-based (or explicit apiVersion/kind) inputs, aligning mapper creation with static primary resource types.
Changes:
- Mark
fromOwnerReferences(HasMetadata)as deprecated for removal. - Mark
fromOwnerReferences(HasMetadata, boolean)as deprecated for removal.
Comments suppressed due to low confidence (1)
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/Mappers.java:101
- Same here: the deprecation annotation doesn’t indicate the intended replacement. Please add a Javadoc
@deprecatedmessage (and optionally an inline@link) so consumers know to switch to the class-based overload.
@Deprecated(forRemoval = true)
public static <T extends HasMetadata> SecondaryToPrimaryMapper<T> fromOwnerReferences(
HasMetadata primaryResource, boolean clusterScoped) {
return fromOwnerReferences(
primaryResource.getApiVersion(), primaryResource.getKind(), clusterScoped);
}
|
|
||
| @Deprecated(forRemoval = true) | ||
| public static <T extends HasMetadata> SecondaryToPrimaryMapper<T> fromOwnerReferences( | ||
| HasMetadata primaryResource) { | ||
| return fromOwnerReferences(primaryResource, false); | ||
| } | ||
|
|
There was a problem hiding this comment.
TBH, I also think that all deprecations should point to replacements or explain why the method is being dropped.
There was a problem hiding this comment.
true, added javadoc to the alternative
|
|
||
| @Deprecated(forRemoval = true) | ||
| public static <T extends HasMetadata> SecondaryToPrimaryMapper<T> fromOwnerReferences( | ||
| HasMetadata primaryResource) { | ||
| return fromOwnerReferences(primaryResource, false); | ||
| } | ||
|
|
There was a problem hiding this comment.
TBH, I also think that all deprecations should point to replacements or explain why the method is being dropped.
This does not make sense to me, this should be always based on class Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
0e8de49 to
8e48dbb
Compare
This does not make sense to me, this should be always based on class
Signed-off-by: Attila Mészáros a_meszaros@apple.com