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 guice7 (jakarta.inject) module #209

Merged
merged 1 commit into from May 22, 2023

Conversation

josephlbarnett
Copy link
Contributor

Copy guice (javax.inject) module over to a new guice 7 (jakarta.inject) module. Replace javax imports with jakarta imports, and leave everything else the same.

Fixes #206

@josephlbarnett
Copy link
Contributor Author

josephlbarnett commented May 19, 2023

(will rework this based on 3 vs/ 2.16 package changes....)

Copy guice (javax.inject) module over to a new guice 7
(jakarta.inject) module.  Replace javax imports with
jakarta imports, and leave everything else the same.

Fixes FasterXML#206
//Jakarta Reference Implementation
requires static jakarta.inject;

requires com.fasterxml.jackson.annotation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requires transitive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transitive on com.fasterxml.jackson.annotation? ok, i'll defer to you on module-info stuff but want to be sure I get it right. should that change also be made to the existing guice module?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If change was made here, yes, I think similarly to existing. I don't have strong opinion.

}
}

private static class ObjectMapperProvider implements Provider<ObjectMapper>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be split out, to allow overriding on the bindings, or to rescope to object mapper

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cowtowncoder Would this be ok? Allowing to provide the object mapper as a singleton to beat around the LRU cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly, but not sure exactly what that would look like. feels like a separate PR against existing guice module (and this new one if timing of that PR is after this gets in) would make more sense to me?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that (possible separate follow-up PR) makes sense assuming this is not a deviation from existing Guice module.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed - will get started with that (y)

@cowtowncoder
Copy link
Member

Sounds good, happy to merge (we have CLA).

Just one question: I guess "guice7" works (and I think it's best to leave existing id of "guide" etc as-is for compatibility), but I wonder if alternative of "guice-jakarta" would make sense wrt later Guice versions? (since this would work for Guice 8.x etc).

I don't have strong opinion here but many other modules add "jakarta".

@josephlbarnett
Copy link
Contributor Author

I dont have a strong opinion either way -- I did notice the latest guice main branch commit removes java8 support, so not sure if that changes anything about how you'd think about these guice modules?

@cowtowncoder
Copy link
Member

I dont have a strong opinion either way -- I did notice the latest guice main branch commit removes java8 support, so not sure if that changes anything about how you'd think about these guice modules?

Hmmh. That gets more difficult wrt keeping Guice module here while building others for Java 8 since ideally we wouldn't use later JDKs for building (just to avoid accidental beyond-JDK-8 deps for modules not meant to require later baseline).
Some Jackson repos do require JDK 11 or later, but in those cases they are less problematic (JAX-RS/Jakarta-RS provider; Hibernate).

So let's go with guice7 name that's fine. I'll try to get this merged soon.

@cowtowncoder
Copy link
Member

@josephlbarnett One question before merging -- have you addressed @GedMarc's concerns? If not, if you could do that (make change if they make sense which probably does for module-info -- or add a note why change doesn't make sense).

}
}

private static class ObjectMapperProvider implements Provider<ObjectMapper>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cowtowncoder Would this be ok? Allowing to provide the object mapper as a singleton to beat around the LRU cache?

}
}

private static class ObjectMapperProvider implements Provider<ObjectMapper>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed - will get started with that (y)

@cowtowncoder cowtowncoder merged commit 1794b41 into FasterXML:2.16 May 22, 2023
3 checks passed
cowtowncoder added a commit that referenced this pull request May 22, 2023
@@ -0,0 +1,114 @@
package com.fasterxml.jackson.module.guice;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whops. guice -> guice7; will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops sorry about that, thanks for fixing!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np @josephlbarnett ! Just happy I noticed it :)

@cowtowncoder
Copy link
Member

Merged; also converted master to tool.jackson (2.x -> 3.x conversion)

@josephlbarnett josephlbarnett deleted the guice7 branch July 8, 2023 21:23
@josephlbarnett
Copy link
Contributor Author

@cowtowncoder any chance of putting this in a 2.15.3 on a quicker timeline than a 2.16 release? is there a timeline on 2.16? (if not, no problem, just curious!)

@cowtowncoder
Copy link
Member

@josephlbarnett I do not, as a general rule, add new modules in patch releases: it's against SemVer and can be confusing.

No specific timeline for 2.16; I need to send an email since this time around I have specific idea of what needs to be ready for 2.16 -- and as soon as those things are in I'm happy to do RC.
But with vacation time and so on I suspect September is earliest I could so it happening.

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 this pull request may close these issues.

guice 7 / jakarta inject support?
3 participants