Micrometer: Using 1.1.1 with Scala causes "parsing annotations" warnings

Created on 8 Jan 2019  路  3Comments  路  Source: micrometer-metrics/micrometer

We are happily using micrometer 1.1.1 from Scala 2.12.8. Everything runs fine except that we get the following compile error:

[warn] While parsing annotations in /...https/repo1.maven.org/maven2/io/micrometer/micrometer-core/1.1.0/micrometer-core-1.1.0.jar(io/micrometer/core/lang/Nullable.class), could not find MAYBE in enum <none>.
[warn] This is likely due to an implementation restriction: an annotation argument cannot refer to a member of the annotated class (scala/bug#7014).
[warn] one warning found

Of course it looks like a bug in the scala compiler and might not be related to this project I was just wondering if we can still fix it somehow in micrometer of it makes sense to do that? I would be willing to help with a PR if any hints into the right direction could be given.

question

Most helpful comment

I have tried adding the dependency and it works, the warning goes away. Thanks.

All 3 comments

@fkoehler I don't have much expertise on Scala but looking into it a bit, Scala doesn't seem to ignore missing meta-annotated classes when it's used on return types (it seems okay when it's used on parameters) unlike Java. Micrometer's @Nullable implementation is the same as the implementation of the Spring framework. So if you use StringUtils.quoteIfString() from the Spring framework, you will see the same warning.

It's a warning, not an error, so you can simply ignore it or if it bothers you, you can add the following optional dependency as a workaround:

libraryDependencies += "com.google.code.findbugs" % "jsr305" % "3.0.2" % Optional

Someone who is a Scala developer might give you a better advice.

I have tried adding the dependency and it works, the warning goes away. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samanthacatania picture samanthacatania  路  4Comments

kuceram picture kuceram  路  5Comments

wilkinsona picture wilkinsona  路  3Comments

jonatan-ivanov picture jonatan-ivanov  路  3Comments

jkschneider picture jkschneider  路  3Comments