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

Make this available in Java 7? #22

Closed
bbottema opened this issue Aug 26, 2018 · 5 comments
Closed

Make this available in Java 7? #22

bbottema opened this issue Aug 26, 2018 · 5 comments
Assignees
Milestone

Comments

@bbottema
Copy link
Contributor

bbottema commented Aug 26, 2018

Hi @dnault,

What an innovative and interesting way of including Javadoc in runtime! Reminds me of Lombok.

I would love to use this library in my own open source library Simple Java Mail, but I'm restricted to Java 7 and your library is out of reach because of that. Is it possible to make this library available to Java 7? I know what a pain it is to not be able to use Java 8 for my own library, but since Java 7 is still is used by a significant audience I have no choice if I want to service them.

I would love to try and make this library work for my own use case, which is that I'm using Java reflection to generate CLI support and I would like to use therapi-runtime-javadoc to dynamically include the Javadoc as documentation. Otherwise I would have to maintain the documentation both in Javadoc as well as annotations. You library would reach a lot of people if I could use it somehow.

@bbottema bbottema changed the title Make this available in Java 7 Make this available in Java 7? Aug 26, 2018
@dnault
Copy link
Owner

dnault commented Aug 27, 2018

Hi Benny. I'm open to this idea. Not sure what to do about the public API, which uses java.util.Optional.

@bbottema
Copy link
Contributor Author

I'm afraid there is no elegant solution for that, it's a breaking change for sure. Best thing you can do for that is include your own version of just the Optional class. Current users would only have to update their imports.

@bbottema
Copy link
Contributor Author

bbottema commented Aug 27, 2018

I was just looking into converting Optional for Java 7, but it is not a trivial task. I think the better option would be to use Guava v20's battle-tested Optional version or shade/shadow in something like https://github.com/MrHadiSatrio/Optional into your jar as a dependency.

Or just drop it alltogether and annotate your methods with @Nullable etc. instead, which nowadays is widely supported by IDE's and analyses tools (that's what I do as well until the world is ready to forget about Java 7).

bbottema added a commit to bbottema/therapi-runtime-javadoc that referenced this issue Sep 1, 2018
@dnault dnault added this to the 0.7.0 milestone Sep 1, 2018
@dnault
Copy link
Owner

dnault commented Sep 1, 2018

Thank you, Benny!

@dnault dnault closed this as completed Sep 1, 2018
@dnault dnault assigned dnault and bbottema and unassigned dnault Sep 2, 2018
@dnault
Copy link
Owner

dnault commented Sep 2, 2018

Hi Benny,

Version 0.7.0 now is available on Maven Central with support for Java 7.

I ended up dodging the @Nullable issue by using the Null Object pattern; instead of returning null, it now returns a dummy object that models absent Javadoc.

In the project where I use this library, this change actually lead to simpler code than using Optional... so that's pretty cool. Let me know how it works for you.

Thanks,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants