-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
#1981: Optional OSGi bundle's dependency on sun.misc package #1993
#1981: Optional OSGi bundle's dependency on sun.misc package #1993
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
The Apache NetBeans IDE seems to work fine with the Gson library build based on this change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks! We do need the CLA, though.
Will this still work when an OSGi user wants to use Unsafe with Gson, for example to create instances of classes without default constructor? Or will OSGi users now be unable to use Unsafe at all with Gson? It appears OSGi integrates to some extend with the Java module system (see blog post), so maybe this is also related to #1695? |
Working on it, but it is a process...
...alas, that may be the case...
...feel free to implement the fix for #1981 in a better way on your own without waiting for my CLA. optional dependency would very likely work for us as well. Me and @dbalek can do manual testing (including check for classes without default constructor) once the better fix is proposed even in a different PR. |
@JaroslavTulach could you please give the changes in #1999 a try? The OSGi metadata in the generated Though I am not a member of this project so maybe that pull request has to be adjusted before it can be merged. |
@googlebot I signed it! |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
@googlebot I consent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add the following to the description of this pull request so GitHub closes the corresponding issues (or wait until a maintainer manually links the issues):
Additionally, if possible, could you please test whether the following situations work (copied from #1999):
- works for OGSi deployments without
Unsafe
- works for OSGi deployments with
Unsafe
and Gson is able to construct instances of class without default constructor (by usingUnsafe
)- With System property
org.osgi.framework.bootdelegation=sun.misc.*
- With System property
org.osgi.framework.system.packages.extra=sun.misc
- Using extension bundle from https://github.com/diffplug/osgiX (?)
- With System property
Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
The Apache NetBeans IDE seems to work fine with the Gson library build based on the last changes to this pull request. |
Have done some basic testing based on the setup described in https://www.baeldung.com/osgi with Apache Karaf by editing its
Key:
Note that I have not tested how Karaf interacts with the Java Platform Module System. |
It looks as if this is ready to go, so I'm merging it. Thanks to everyone who helped out here! |
As #1981 wrotes: The Apache NetBeans project has just tried to migrate from version
2.8.5
to version2.8.8
in the pull request apache/netbeans#3200 and the update fails with unsatisfied OSGi missing constraint:Import-Package: sun.misc
. The best solution is to avoid such dependency.The PR introduces a test that verifies
Import-Package
statement in GSON JAR's manifest no longer contains reference tosun.misc
. Then this PR modifiesbnd
configuration file to explicitly avoidsun.misc
package from list of imported packages.