yf0994 / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Uses of @Nullable in guava-gwt:13.0.1 causes errors #1152

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I switched from guava-gwt 12.0.1 to 13.0.1 and get a huge amount of error 
messages of the type:
[ERROR] Errors in 
'jar:file:/<snip>/.m2/repository/com/google/guava/guava-gwt/13.0.1/guava-gwt-13.
0.1.jar!/com/google/common/collect/ForwardingMultimap.java'
[INFO]       [ERROR] Line 26:  The import javax.annotation.Nullable cannot be 
resolved
[INFO]       [ERROR] Line 57:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 57:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 62:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 67:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 77:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 112:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 112:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 117:  Nullable cannot be resolved to a type
[INFO]       [ERROR] Line 136:  Nullable cannot be resolved to a type'

I personally does not use @Nullable in any form in my program and there are 
many of these errors (for example for Maps.java, MapDifference.java, 
MapConstraints.java, ...)

When I add the dependency 
      <dependency>
            <groupId>net.sourceforge.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>1.3.2</version>
      </dependency>
into the project these errors disapear. But I does not use @Nullable in my 
code. 

Original issue reported on code.google.com by marcus.g...@gmail.com on 19 Sep 2012 at 1:32

GoogleCodeExporter commented 9 years ago
Man, for a simple annotation, @Nullable is sure causing a lot of problems in 
the wild....

This sounds like a different problem than issue 776 (which I think is a Google 
Plugin for Eclipse problem with GWT projects) and a different problem than 
issue 1095 (which is a Scala problem).  It, like the Scala problem, occurs 
because we changed the GWT dependency to <provided> recently.  In the Scala 
case, we blame Scala, and we could fairly blame GWT here.  However, the Scala 
problem may one day be fixed, but I'm not sure that's likely for the GWT 
problem:  Since GWT has to compile from source, it would have to ignore all 
unrecognized annotations and their imports.  Additionally, we could add the 
jsr305 dependency to guava-gwt, rather than to guava itself.  This would mean 
that only the people who use GWT would need it, unlike in the Scala case, where 
we would have to add the dependency to guava and thus foist it on everyone.

All *that* said, we need to improve our Guava GWT compilation tests to the 
point that we can reproduce this error.  I think I might be manually adding in 
the jsr305 jar now.  It's still possible that we might want for users to do 
that, but even if we do, it should be documented.

Original comment by cpov...@google.com on 19 Sep 2012 at 2:15

GoogleCodeExporter commented 9 years ago
Will jsr305 be added for this version or for 13.0.2?

Original comment by marcus.g...@gmail.com on 24 Sep 2012 at 12:47

GoogleCodeExporter commented 9 years ago
If we make the dependency change, we wouldn't modify the existing release, so 
it would go in a new one.

Original comment by cpov...@google.com on 24 Sep 2012 at 2:31

GoogleCodeExporter commented 9 years ago
Thanks for the fast reply.
Am 24.09.2012 16:31 schrieb <guava-libraries@googlecode.com>:

Original comment by marcus.g...@gmail.com on 24 Sep 2012 at 2:33

GoogleCodeExporter commented 9 years ago
Similarly, I had:

     [echo] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
     [echo]    [ERROR] Errors in 'jar:file:/Users/ray/.m2/repository/com/google/guava/guava-gwt/13.0.1/guava-gwt-13.0.1.jar!/com/google/common/base/Joiner.java'
     [echo]       [ERROR] Line 31:  The import javax.annotation.CheckReturnValue cannot be resolved
     [echo]       [ERROR] Line 263:  CheckReturnValue cannot be resolved to a type
     [echo]       [ERROR] Line 286:  CheckReturnValue cannot be resolved to a type
     [echo]       [ERROR] Line 326:  CheckReturnValue cannot be resolved to a type
     [echo]       [ERROR] Line 531:  CheckReturnValue cannot be resolved to a type
     [echo]    [ERROR] Cannot proceed due to previous errors

Adding the manual dependency for jsr305 fixed me up.

Original comment by r...@bogocorp.com on 4 Oct 2012 at 9:03

GoogleCodeExporter commented 9 years ago
Fix submitted. I am on the fence about whether to push a new release for this, 
given that there's a workaround and that it has taken us so long. Opinions?

http://code.google.com/p/guava-libraries/source/detail?r=fedcbe374bd92d99b27f4c3
98b16fa01292adb78

Original comment by cpov...@google.com on 10 Oct 2012 at 4:07

GoogleCodeExporter commented 9 years ago
To catch this kind of problem in the future, we've added a GWT compilation test 
that runs against public Guava. 
http://code.google.com/p/guava-libraries/source/detail?r=133ffd3dd0d4967cb7f2d6f
745b6661585c67b6b

Original comment by cpov...@google.com on 5 Dec 2012 at 9:59

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:13

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08