Navigation Menu

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

Function interface mismatch causes failure at runtime #765

Closed
gissuebot opened this issue Oct 31, 2014 · 10 comments
Closed

Function interface mismatch causes failure at runtime #765

gissuebot opened this issue Oct 31, 2014 · 10 comments
Labels
status=duplicate type=defect Bug, not working as expected

Comments

@gissuebot
Copy link

Original issue created by Todd.Schiller on 2011-10-19 at 05:43 AM


I define a Function of the form:

new Function<MyType, String>(){
  @Override
  public String apply(MyType arg0){
     return ...;
  }
}

, which compiles in Eclipse as expected. However, at runtime in hosted mode, I receive the following errors:

[ERROR] [MyProject] - Line XXX: The type new Function<MyType,String>(){} must implement the inherited abstract method Function<MyType,String>.apply(Object)

[ERROR] [MyProject] - Line YYY: The method apply(MyType) of type new Function<MyType,String>(){} must override or implement a supertype method

What version of the product are you using? On what operating system?

Guava GWT 10.0.1

Please provide any additional information below.

GWT 2.4.0
Guava 10.0.1
Eclipse 3.7.1
JavaSE-1.6
Fedora Core 14 (2.6.35.14-96.fc14.i686.PAE)

@gissuebot
Copy link
Author

Original comment posted by Todd.Schiller on 2011-10-19 at 06:03 AM


A similar issue also arises with the Predicate interface:

[ERROR] [MyProject] - Line XXX: The type new Predicate<MyType>(){} must implement the inherited abstract method Predicate<MyType>.apply(Object)

[ERROR] [MyProject] - Line YYY: The method apply(MyType) of type new Predicate<MyType>(){} must override or implement a supertype method

@gissuebot
Copy link
Author

Original comment posted by wasserman.louis on 2011-10-19 at 06:10 PM


This is caused by Java 5/Java 6 issues, not Guava. (Specifically, JDK 5 refuses to accept @Override annotation on interface methods, where JDK 6 handles it fine. I think you're supposed to be able to compile with JDK 6, execute with JDK 5?)

@gissuebot
Copy link
Author

Original comment posted by wasserman.louis on 2011-10-19 at 06:18 PM


(No comment entered for this change.)


Status: Triaged

@gissuebot
Copy link
Author

Original comment posted by cpovirk@google.com on 2011-10-20 at 11:47 PM


I wouldn't have guessed it was an @Override problem, since the compiler doesn't seem to recognize that there's an apply() implementation at all. I'm actually wondering if it's a GWT bug.

@gissuebot
Copy link
Author

Original comment posted by Todd.Schiller on 2011-10-21 at 02:08 AM


@wasserman.louis: I'm not mixing JDK 5 and JDK 6. I'm using 1.6 both for compilation and for the runtime environment.

Attempting to run with a 1.5 JRE gives the warning: "WARNING: Use on a JRE prior to version 1.6 is deprecated", and then everything dies.

With JDK 6, I'm also getting the following errors during validation, which I thought were supposed to be fixed since R9:

[ERROR] [MyProject] - Errors in 'jar:file:/.../MyProject/war/WEB-INF/lib/guava-gwt-10.0.jar!/com/google/common/base/Predicate.java'
[ERROR] [MyProject] - Line 21: The import javax.annotation.Nullable cannot be resolved
[ERROR] [MyProject] - Line 45: Nullable cannot be resolved to a type
[ERROR] [MyProject] - Line 58: Nullable cannot be resolved to a type

@gissuebot
Copy link
Author

Original comment posted by andy.dennie on 2011-11-10 at 04:25 PM


I'm having the same "Nullable" errors as described in comment 4, except that mine are reported with respect to Equivalence:

[ERROR] [myproject] - Errors in 'jar:file:.../myproject/war/WEB-INF/lib/guava-gwt-10.0.1.jar!/com/google/common/base/Equivalence.java'

@gissuebot
Copy link
Author

Original comment posted by kevinb@google.com on 2011-11-15 at 10:11 PM


We believe this is a GWT issue, but if there's something specific we can do let us know.


Status: WontFix

@gissuebot
Copy link
Author

Original comment posted by andy.dennie on 2011-11-16 at 02:21 PM


In comparing guava 9 (which doesn't exhibit the problem) to guava 10, I suspect that the cause has something to do with the fact that the javax.annotation.* packages were included in 9 but not in 10. See the attached screenshot. Could you confer with the GWT team to confirm?

@gissuebot
Copy link
Author

gissuebot commented Oct 31, 2014

Original comment posted by pondruska+o...@csas.cz on 2011-11-20 at 09:45 PM


Yes, this looks like javax.annotation.* is missing in guava 10 (but present in guava 9). See #776 as that is similar.

@gissuebot
Copy link
Author

Original comment posted by cpovirk@google.com on 2011-12-02 at 10:42 PM


(No comment entered for this change.)


Status: Duplicate
Merged Into: #776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status=duplicate type=defect Bug, not working as expected
Projects
None yet
Development

No branches or pull requests

1 participant