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

Add @Duplicates(Class declaringType, SourceVersion sinceJavaVersion) annotation so that extension method authors can tag known semantically duplicate methods #364

Closed
rsmckinney opened this issue May 17, 2022 · 3 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@rsmckinney
Copy link
Member

Add @Duplicates(Class declaringType, SourceVersion sinceJavaRelease) annotation so that extension method authors can tag known semantically duplicates methods.

@Extension
public class ManifoldStreamCollectionsExt {
  @Duplicates(Stream.class, RELEASE_16)
  public static <T> List<T> toList(@This Stream<T> thiz) {
    return thiz.collect(Collectors.toList());
  }
}
@rsmckinney rsmckinney added the dependencies Pull requests that update a dependency file label May 17, 2022
@rsmckinney rsmckinney changed the title Add @Duplicates(Class declaringType, SourceVersion sinceJavaVersion) annotation so that extension method authors can tag known semantically duplicates methods Add @Duplicates(Class declaringType, SourceVersion sinceJavaVersion) annotation so that extension method authors can tag known semantically duplicate methods May 17, 2022
@joseaio
Copy link

joseaio commented May 19, 2022

Can you use @Duplicates with isEmpty() on manifold.text.extensions.java.lang.CharSequence.ManCharSequenceExt?

Duplicate extension method. 'isEmpty(java.lang.CharSequence)' from 'manifold.text.extensions.java.lang.CharSequence.ManCharSequenceExt' duplicates a method in the extended class 'java.lang.CharSequence'

rsmckinney added a commit that referenced this issue Sep 8, 2023
- add @expires annotation to specify a jdk marking when the method is no longer to be added as an extension, usually because a new method with the same signature or behavior was added in that jdk.
@CC007
Copy link
Contributor

CC007 commented Sep 8, 2023

I see that you're implementing this with the @Expires annotation for Iterable.reversed().

Could you also add this to:

  • Stream.toList() in ManifoldStreamCollectionsExt in manifold-collections (since java 16)
  • CharSequence.isEmpty() in ManCharSequenceExt manifold-text (since java 15)

rsmckinney added a commit that referenced this issue Sep 11, 2023
- apply @expires to some extension methods that have since been added to jdk
@rsmckinney
Copy link
Member Author

Marking this issue as fixed with the @Expires annotation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

3 participants