On Fri, Sep 16, 2022 at 1:37 PM 'Chris Hegarty' via jackson-dev <jackson-dev@googlegroups.com> wrote: > > Hi, > > I'm encountering an issue when compiling against the latest Jackson > 2.14.0-SNAPSHOT. The issue only arises when lint warnings are enabled - it's > quite common to enable some or all lint warnings and also treat warnings as > errors (which we do in Elasticsearch). > > The issue relates to the use of the > `aQute.bnd.annotation.spi.ServiceProvider` annotation in `JsonFactory`. I've > included inline a trivial minimal test that demonstrates the issue, along > with the warning message. > > For now, I'm working around this issue by disabling `classfile` lint > warnings, with `-Xlint:-classfile`. [1] > > ``` > $ cat T.java > public class T { > com.fasterxml.jackson.core.JsonFactory jsonFactory = null; > } > > ``` > > ``` > $ binaries/jdk-17.0.2.jdk/Contents/Home/bin/javac \ > -cp > .gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.14.0-SNAPSHOT/3f27917aee3d16732aa59a78ee5104cc7bd24fef/jackson-core-2.14.0-SNAPSHOT.jar > \ > -Xlint:all \ > T.java > > .gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.14.0-SNAPSHOT/3f27917aee3d16732aa59a78ee5104cc7bd24fef/jackson-core-2.14.0-SNAPSHOT.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 > 1 warning > ``` > > Thanks, > -Chris. > > [1] https://github.com/elastic/elasticsearch/pull/88057
Ok, so this annotation was added for better OSGi support as per: https://github.com/FasterXML/jackson-core/issues/768 but would not want to add a requirement for non-OSGi users to have a dependency to OSGi annotations. Is there some actual problem here, or just general concern it might be problematic? My understanding of Java annotation handling is that JVM, JDK and class loaders must assume that annotation definitions may well not be available in many cases. And so missing should not be considered an error condition. -+ Tatu +- -- You received this message because you are subscribed to the Google Groups "jackson-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-dev/CAL4a10jy16jBfMPcHYNyjLaAgBs0Cw1%3D3eLPKNBqZLmweKzAQQ%40mail.gmail.com.