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

jackson-core 2.14.0-rc2 requires OSGi bnd artefacts #824

Closed
poutsma opened this issue Oct 18, 2022 · 11 comments
Closed

jackson-core 2.14.0-rc2 requires OSGi bnd artefacts #824

poutsma opened this issue Oct 18, 2022 · 11 comments
Milestone

Comments

@poutsma
Copy link

poutsma commented Oct 18, 2022

Hi,

The Spring Framework is trying to upgrade to Jackson 2.14.0, so that we can set it as our baseline for the upcoming 6.0.x branch, and use the ByteBufferFeeder introduced through #478 (thanks!). Unfortunately, when upgrading from 2.13.4 to 2.14.0-rc2 we run into the following warning:

/Users/arjen/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.14.0-rc2/16f52b48723470c8e8a7f8f3fe80c5093eb3e9c3/jackson-core-2.14.0-rc2.jar(/com/fasterxml/jackson/core/JsonFactory.class): 
warning: Cannot find annotation method 'value()' in type 'ServiceProvider': class file for aQute.bnd.annotation.spi.ServiceProvider not found

(line break added for clarity)

Because we use -Werror during compilation, this warning breaks our build. Of course, it can be resolved by adding dependencies to the class path (specifically biz.aQute.bnd:biz.aQute.bnd.annotation and org.osgi:osgi.annotation), or by changing our build to ignore this specific warning.

I still thought it wise to make you aware of this warning, as I am hoping that there is something that can be done, and users can use Jackson 2.14 without getting warnings about missing OSGi artefacts.

@cowtowncoder
Copy link
Member

Does #822 solve this?

@poutsma
Copy link
Author

poutsma commented Oct 18, 2022

Does #822 solve this?

I am not sure.

@sdeleuze, in our meeting today you mentioned a related problem (and potential solution ?) which I cannot recall anymore. Do you have further insights?

@sdeleuze
Copy link

sdeleuze commented Oct 18, 2022

Yeah this is a behavior of javac that is lenient for annotation not present in the classpath (no warning in that case) except for enum used in annotation attribute.

We suffered that with @Nonnull when attribute when JSR 305 dependency is not on the classpath and I have the feeling this is the same here with aQute.bnd.annotation.Resolution.OPTIONAL.

Sadly no other workaround than avoiding using such enum in annotation attributes when possible since this kind of warning is super annoying for developers.

@poutsma
Copy link
Author

poutsma commented Oct 19, 2022

To give some further info, the warning is due to the -Xlint:classfile argument we use for javac. I will disable this warning in the Spring Framework build for now, until this issue is resolved.

poutsma referenced this issue in spring-projects/spring-framework Oct 19, 2022
This commit upgrades Jackson to 2.14.0-rc2, and uses the new
ByteBufferFeeder in Jackson2Tokenizer.

Unfortunately, because of FasterXML/jackson-core#478,
we had to change the CompilerConventions to suppress class file warnings.

Closes gh-29343
@cowtowncoder
Copy link
Member

The problem here is that addition itself is a feature (#768 and follow-up #822) not bug. Not quite sure if it is possible to do both -- perhaps I will need to revert this, considering that Spring usage is more important than speculative OSGi benefits.

@cowtowncoder
Copy link
Member

Ok. I will revert these changes; and likely publish 2.14.0-rc3 for verification purposes.

@cowtowncoder
Copy link
Member

OSGi annotation changes reverted.

@poutsma
Copy link
Author

poutsma commented Oct 31, 2022

I can confirm that this is fixed in 2.14.0-rc3. Thanks!

poutsma added a commit to spring-projects/spring-framework that referenced this issue Oct 31, 2022
This commit upgrades Jackson to 2.14.0-rc3, which resolves two
outstanding issues Spring Framework had with rc2. This commit reverts
the changes made due to those issues, see
FasterXML/jackson-core#824, and
FasterXML/jackson-module-kotlin#582.

Closes gh-29405
@cowtowncoder
Copy link
Member

Good, thank you for verifying @poutsma.

@kriegfrj
Copy link

Yeah this is a behavior of javac that is lenient for annotation not present in the classpath (no warning in that case) except for enum used in annotation attribute.

That would seem to me to be a bug in javac. Is there a documented reason anywhere for this enum exception for compile-time retention in javac?

@sdeleuze
Copy link

Not sure if that's considered as a bug or a feature on OpenJDK side, but that's IMO unlikely to change and past and current versions of OpenJDK all have this behavior, so it look likes we have to live with that.

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

No branches or pull requests

4 participants