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
guava 10.0.1 import javax.annotation.Nullable #776
Comments
Original comment posted by pondruska+o...@csas.cz on 2011-10-28 at 09:27 PM deprecated guava-r09.zip:guava-r09/guava-r09-gwt.jar containst javax.annotation package. Please fix it in guava 10 |
Original comment posted by wasserman.louis on 2011-11-07 at 07:29 PM javax.annotation.Nullable is available from JSR 305, which is listed as a Guava dependency in the Maven POM: |
Original comment posted by pondruska+o...@csas.cz on 2011-11-08 at 05:22 AM Thanks Louis, I do not use Maven (and do not know how to use it either). So if that is the only way to go(?) I have to do some homework and learn new stuff :-) |
Original comment posted by pondruska+o...@csas.cz on 2011-11-08 at 10:06 AM OK, just get jsr305-1.3.9.jar from http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22jsr305%22 and place onto build path and everything is fine. Thanks. |
Original comment posted by raymond.rishty on 2011-11-08 at 10:52 AM So what happened to this note Kevin had posted on SO a few months back? "You are absolutely positively 100% NOT supposed to need to go off hunting for a jsr305 jar yourself! guava-gwt.jar is supposed to just work for you out of the box..." |
Original comment posted by kevinb@google.com on 2011-11-09 at 03:16 PM I agree with that. |
Original comment posted by andy.dennie on 2011-11-10 at 04:14 PM I've added jsr305-1.3.9.jar to my classpath and it hasn't resolved the issue for me. I'm stumped as to why not. FWIW, my symptom is I am able to eliminate the problem by downgrading to v09 of guava and guava-gwt jars, and changing my code to account for the fact that in v09, Equivalence was an interface rather than a class. But I'd like to make this work with v10 if possible. |
Original comment posted by andy.dennie on 2011-11-10 at 04:29 PM apparently I'm not the only one for whom adding jsr305 has not fixed the issue. See this SO question: |
Original comment posted by kevinb@google.com on 2011-11-15 at 10:04 PM (No comment entered for this change.) Status: |
Original comment posted by cpovirk@google.com on 2011-12-02 at 10:42 PM Issue #765 has been merged into this issue. |
Original comment posted by cpovirk@google.com on 2011-12-02 at 11:26 PM Can anyone upload a project demonstrating this problem? My attempts to reproduce it have failed. |
Original comment posted by yrfselrahc on 2011-12-05 at 06:35 PM (No comment entered for this change.) Labels: - |
Original comment posted by trupanka on 2012-01-09 at 09:58 PM This code compiles: This code doen't compile without adding <super-source path="path/to/JSR-305/source"> or <source path="path/to/JSR-305/source">: I think the issue is about how GWT Compiler resolves and ignores unrecognized annotation types. |
Original comment posted by bdleitner80 on 2012-01-22 at 08:00 AM I'm also having this issue. I have guava-11.0.1/jar, guava-gwt-11.0.1.jar AND jsr305-1.3.9.jar in my classpath, but I get: [ERROR] Errors in 'jar:file:/D:/Projects/Java/appengine/jnddb/war/WEB-INF/lib/guava-gwt-11.0.1.jar!/com/google/common/base/CharMatcher.java' and later etc. My module has: in it. |
Original comment posted by wasserman.louis on 2012-01-22 at 08:07 AM I'll repeat cpovirk's plea: "Can anyone upload a project demonstrating this problem? My attempts to reproduce it have failed." |
Original comment posted by victor.ott on 2012-01-24 at 11:22 AM I'm also having this issue, and am pretty disappointed. Attached you'll find the requested demo project:
Compiling module com.test.gwtguava.GwtGuava |
Original comment posted by victor.ott on 2012-01-24 at 12:33 PM PS |
Original comment posted by cpovirk@google.com on 2012-01-24 at 05:25 PM victor.ott, Thanks very much for the sample project. andy.dennie, bdleitner80, Does adding the jsr305 jar to your WEB-INF/lib solve the problem, or is this what you already did when you said that you added it to your CLASSPATH? All, Our goal is to keep our dependencies minimal, but we have allowed JSR 305 in, and we may pick up JSR 330 soon. We switched from Ant to Maven in order to minimize the hassle of adding dependencies. It sounds like Eclipse GWT support and Maven aren't closely integrated, which dumps dependency management back in the laps of users. Does anyone know whether there's a way for us to supply enough metadata with guava-gwt (ideally in the pom.xml) to tell Eclipse "Please also include these jars?" Is there some additional Eclipse plugin that users could install to make this possible? |
Original comment posted by pondruska+o...@csas.cz on 2012-01-24 at 05:44 PM I did not add jsr305 jar to WEB-INF/lib as it is only needed to be available on classpath (Eclipse's build path) during GWT compile. That works, actually I have modified my guava-gwt library to include jsr305jar in addition to guava-gwt-..jar and that fixes the problem. |
Original comment posted by raymond.rishty on 2012-01-24 at 05:46 PM Chris, Personally, I don't think it's a problem to have to get and include JSR 305, if that's the solution. I've gone out and found the jar myself, included it in my projects, and everything worked great. I've also found it very useful to use those annotations myself and reap the benefits from FindBugs. That said, I think it would be helpful to have a clear and consistent instruction from the Guava team. Since we've heard that we don't need that jar, we assume there's something wrong. But if all that's needed is to get the jar, just making that explicit would be helpful (as well as, perhaps, a link to the jar?) As far as additional metadata... I think this is where we run into different people using different technologies. Some of us are using Ant, some Maven, some use OSGi... I doubt there is a one-size-fits-all solution. Thanks |
Original comment posted by victor.ott on 2012-01-24 at 06:34 PM More information: I've now spent good 1+ hour to find out why our Ant build script still doesn't GWT compile, although jsr305-2.0.0.jar is included. The difference is: "-strict". |
Original comment posted by cpovirk@google.com on 2012-02-08 at 09:35 PM Victor, Thanks for bailing me out again. I can reproduce the problem with -strict. My current understanding is that we need to provide a javax/annotation/Annotation.gwt.xml. This will inform GWT that it should look for source files under that path in the jar. We don't see this problem internally because our build system generates the .gwt.xml automatically. Currently I'm here: Compiling module com.test.gwtguava.GwtGuava I'm not yet sure why we aren't seeing that error internally. Labels: - |
Original comment posted by cpovirk@google.com on 2012-02-08 at 09:53 PM Setting aside the question of why we don't get the error internally, I can at least eliminate it: <module> This is slightly more than we need to exclude, since it's only the nested Checker classes in those files that cause a problem, but it's probably good enough to get Guava working. |
Original comment posted by cpovirk@google.com on 2012-02-27 at 10:59 PM I've spoken to someone from the GWT team, and he thinks that the problem is with the Google Plugin for Eclipse -- specifically, that it's not setting up the classpath for the compiler correctly, so the compiler can't find the annotation types. (In the end, it shouldn't need the sources at all.) He's going to try to verify with someone more familiar with the plugin. |
Original comment posted by victor.ott on 2012-02-27 at 11:16 PM In comment #22 I wrote that I was analyzing why our ANT script did not |
Original comment posted by cpovirk@google.com on 2012-02-27 at 11:21 PM Victor, Sorry, I forgot about that part. I'll make sure that I get instructions for the proper Ant compile to go along with whatever we recommend for the Eclipse compile. My guess is that the fix will be the same -- "include jsr305.jar in the compiler's classpath" -- but I'll report back. |
Original comment posted by cpovirk@google.com on 2012-02-27 at 11:22 PM (The GWT guy got it running by setting up a manual gwtc configuration, rather than relying on the plugin's or Ant's.) |
Original comment posted by dusan.maliarik on 2012-03-07 at 11:54 AM Adding jsr305.jar did not solve it for me. I'm running dev mode from IDEA. Before adding JSR305, the symptom was: The import javax.annotation.Nullable cannot be resolved After adding it, it changed to: The type new Predicate<String>(){} must implement the inherited abstract method Predicate<String>.apply(Object) |
Original comment posted by dusan.maliarik on 2012-03-07 at 12:13 PM And the workaround was to create javax/annotation/Annotation.gwt.xml (with source path="") and inherit it. |
Original comment posted by cpovirk@google.com on 2012-03-07 at 01:08 PM
Interesting. In my tests, that hasn't been good enough, at least with -strict. Are you using -strict? (And thanks for the information.) |
Original comment posted by cpovirk@google.com on 2012-03-23 at 06:00 PM RE: Eclipse: We're getting some attention from the GWT team now, so I'm hoping that they'll be able to fix up the Eclipse plugin to avoid this. RE: Ant: I haven't been able to reproduce this problem with Ant, even with -strict, at least once I include jsr305.jar in my classpath. I've attached a project (based on Victor's Eclipse project) that works for me, which you can run with something like |
Original comment posted by HendrikU...@nexgo.de on 2012-05-17 at 12:19 PM
This worked for me in Eclipse |
Original comment posted by gentijo on 2012-05-27 at 05:28 AM Help, I just Incorporated Guava 12.0 into my GWT project and I am getting the error where Nullable can not be resolved. I added guava-12.0.jar, guava-gwt-12.0.jar, and jsr305-2.0.0.jar in my war/WEB-INF/lib and included the jars in the build properties / libs I also created a javax.annotations package in my source tree and created Annotations.gwt.xml with source path="" and inherited it in my gwt project file. I even upgraded to Jdk1.7 from Oracle in case this is a System Mac JDK issue. All == No Luck.. Dev environment = |
Original comment posted by gentijo on 2012-05-27 at 07:19 AM I got it to compile by copying the source of jsr305 into my project and creating a gmt.xml file for it.. Although when it compiles now, I get an error on one of the custom serializers. I don't use that function so I don't think it's causing an issue, just wanted to point it out.. I expect my extreme fix may be part of the cause somehow.. Validating newly compiled units |
Original comment posted by kevinb@google.com on 2012-05-30 at 07:49 PM (No comment entered for this change.) Labels: - |
Original comment posted by kevinb@google.com on 2012-06-22 at 06:57 PM (No comment entered for this change.) Labels: |
Original comment posted by ljw1001 on 2012-09-18 at 11:57 AM Also having this problem with Guava-gwt-13. Is this likely to see a resolution soon or should I punt on Guava in my GWT code? |
Original comment posted by cbonami on 2012-09-18 at 12:24 PM I cannot make decisions in your place, but :
This worked for me in Eclipse, IntelliJ and in our ANT builds (GWT compiler). We've not upgraded since, but I'm planning to. |
Original comment posted by cgruber@google.com on 2013-02-20 at 02:22 PM So here's the question. Is the listed workaround sufficient to resolve this issue? Looking at this whole thread, is this even rightly a Guava issue? It seems like it's an upstream dependency issue which is resolvable by the listed workaround... which seems not like a workaround, but the actually correct solution to a dependency issue. That is, if you're going to use Guava, in GWT, you need to have a javax/annotation/Annotation.gwt.xml that pulls in the correct source. Is there anything further Guava needs to do in terms of what we supply or how our builds are configured? Or is this a documentation issue at this point ("using Guava with GWT" etc.)? |
Original comment posted by cgruber@google.com on 2013-07-29 at 07:17 PM (No comment entered for this change.) Status: |
Original comment posted by RogerMHand on 2014-07-17 at 07:51 PM Not sure why this was marked obsolete ... I just spent over an hour getting Guava version 17 to work in GWT, and I had to do the Annotation.gwt.xml trick. |
Can anyone upload a project demonstrating this problem? My attempts to reproduce it have failed. |
Original issue created by pondruska+o...@csas.cz on 2011-10-28 at 09:22 PM
What steps will reproduce the problem?
What is the expected output? What do you see instead?
Compiling module ***
Validating newly compiled units
[ERROR] Errors in 'jar:file:/***/guava/guava-gwt-10.0.1.jar!/com/google/common/base/CharMatcher.java'
[ERROR] Line 29: The import javax.annotation.CheckReturnValue cannot be resolved
[ERROR] Line 871: CheckReturnValue cannot be resolved to a type
[ERROR] Line 908: CheckReturnValue cannot be resolved to a type
Also complains not being able to find javax.annotation.Nullable
What version of the product are you using? On what operating system?
guava 10.0.1, gwt 2.4.0, java se 1.6
Please provide any additional information below.
There are "fixed" issues against guava r09 but clearly referring to javax.annotation.Nullable and CheckReturnValue in guava which does not provide them (and not docs mention where to get those).
The text was updated successfully, but these errors were encountered: