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

The method $(Element) is ambiguous for the type GQuery #335

Closed
confile opened this issue Jan 11, 2015 · 17 comments
Closed

The method $(Element) is ambiguous for the type GQuery #335

confile opened this issue Jan 11, 2015 · 17 comments

Comments

@confile
Copy link

confile commented Jan 11, 2015

Compiling with Java8 I get the following error:

Tracing compile failure path for type 'com.google.gwt.query.client.GQuery'
      [ERROR] Errors in 'jar:file:/Users/mg/Documents/Grails/GGTS3.6.3/buddyis-mobile/lib/gwtquery-1.4.3-20141231.143602-16.jar!/com/google/gwt/query/client/GQuery.java'
         [ERROR] Line 229: The method $(Element) is ambiguous for the type GQuery
   [ERROR] Aborting compile due to errors in some input files
[ERROR] Error saving compilation unit to cache file: /Users/mg/Documents/Grails/GGTS3.6.3/buddyis-mobile/gwt-unitCache/gwt-unitCache-81446889a9995cb925eb6e53c8ba02636fcbf202-0000014ADA73C3BB
java.io.EOFException
    at java.io.RandomAccessFile.readInt(RandomAccessFile.java:786)
    at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:186)
    at com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:73)
    at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at java.util.ArrayList.writeObject(ArrayList.java:762)
    at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at com.google.gwt.dev.javac.CachedCompilationUnit.writeObject(CachedCompilationUnit.java:223)
    at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at com.google.gwt.dev.javac.PersistentUnitCacheDir$OpenFile.writeUnit(PersistentUnitCacheDir.java:371)
    at com.google.gwt.dev.javac.PersistentUnitCacheDir.writeUnit(PersistentUnitCacheDir.java:191)
    at com.google.gwt.dev.javac.PersistentUnitCache$BackgroundService$6.run(PersistentUnitCache.java:440)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
@manolo
Copy link
Contributor

manolo commented Jan 12, 2015

What version of gwtquery are you using? with 1.4.3-SNAPSHOT shouldn't happen, at least I have tried with both version of gwt Element and it works.

@confile
Copy link
Author

confile commented Jan 12, 2015

@manolo I am using your version of gquery which you recommended me for the touch gestures. I will try the latest snapshot.

@confile
Copy link
Author

confile commented Jan 12, 2015

@manolo I tried to compile the current 1.4.3-SNAPSHOT from the master branch in my GWT 2.8SNAPSHOT Project. I compiled with Java8 and got the following error (Note: It worked with GWT 2.7 and Java7):

   Tracing compile failure path for type 'com.google.gwt.query.client.GQuery'
      [ERROR] Errors in 'jar:file:/Users/mg/Documents/Grails/GGTS3.6.3/buddyis-mobile/lib/gwtquery-1.4.3-SNAPSHOT.jar!/com/google/gwt/query/client/GQuery.java'
         [ERROR] Line 226: The method $(Element) is ambiguous for the type GQuery
   Tracing compile failure path for type 'com.google.common.collect.Maps'
      [ERROR] Errors in 'jar:file:/Users/mg/Documents/Grails/GGTS3.6.3/buddyis-mobile/lib/guava-gwt-18.0.jar!/com/google/common/collect/super/com/google/common/collect/Maps.java'
         [ERROR] Line 592: Type mismatch: cannot convert from Comparator<? super capture#175-of ? super K> to Comparator<? super K>
   [ERROR] Aborting compile due to errors in some input files
[ERROR] Error saving compilation unit to cache file: /Users/mg/Documents/Grails/GGTS3.6.3/buddyis-mobile/gwt-unitCache/gwt-unitCache-81446889a9995cb925eb6e53c8ba02636fcbf202-0000014ADE1C47DA
java.io.EOFException
    at java.io.RandomAccessFile.readInt(RandomAccessFile.java:786)
    at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:186)
    at com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:73)
    at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at java.util.ArrayList.writeObject(ArrayList.java:762)
    at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at com.google.gwt.dev.javac.CachedCompilationUnit.writeObject(CachedCompilationUnit.java:223)
    at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:988)
    at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
    at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
    at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
    at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
    at com.google.gwt.dev.javac.PersistentUnitCacheDir$OpenFile.writeUnit(PersistentUnitCacheDir.java:371)
    at com.google.gwt.dev.javac.PersistentUnitCacheDir.writeUnit(PersistentUnitCacheDir.java:191)
    at com.google.gwt.dev.javac.PersistentUnitCache$BackgroundService$6.run(PersistentUnitCache.java:440)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

@manolo
Copy link
Contributor

manolo commented Jan 13, 2015

Could you test this branch? #336

@confile
Copy link
Author

confile commented Jan 13, 2015

@manolo I tested with manolo:mcm_fix_overload_java8 branch but still get the same error.

@manolo
Copy link
Contributor

manolo commented Jan 13, 2015

It's weird because $(Element) does not exist any more.
Is it easy to reproduce to me? I mean do you have any basic project to share that I can download an run with maven or something?
What happens if you cast your call to $(element) with $((Object)element) ?

@confile
Copy link
Author

confile commented Jan 13, 2015

@manolo I will try to create a simple project for you later this day.

@confile
Copy link
Author

confile commented Jan 13, 2015

@manolo Here is a sample project to show you the error while compilation: https://github.com/confile/GWTQueryJava8Test

@manolo
Copy link
Contributor

manolo commented Jan 13, 2015

There is no code in your project : https://github.com/confile/GWTQueryJava8Test/blob/master/src/test/client/Test.java

But anyway, I have imported it in a system with a recent installed eclipse-luna and java8, and write some code like:
Element e = document.getBody();
String s = $(e).toString();
console.log(e, s);

And I'm able to run it perfectly, with both 1.4.3-SNAPSHOT master and the patched version in my branch.

My java version is:
ava version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

Could you post some code which demonstrates the issue?

@jDramaix
Copy link
Contributor

@confile Maybe you have another version of GwtQuery in your classpath... That happens with transitive dependencies if you use Maven.

Could you check ?

@confile
Copy link
Author

confile commented Jan 13, 2015

@jDramaix I do not use maven

@jDramaix
Copy link
Contributor

ok so you confirm that there is only one version of GQuery in your
classpath ?

On Tue Jan 13 2015 at 5:40:34 PM Confile notifications@github.com wrote:

@jDramaix https://github.com/jDramaix I do not use maven


Reply to this email directly or view it on GitHub
#335 (comment).

@confile
Copy link
Author

confile commented Jan 13, 2015

@jDramaix yes. I have all the jars in this folder on my classpath: https://github.com/confile/GWTQueryJava8Test/tree/master/lib

@manolo
Copy link
Contributor

manolo commented Jan 13, 2015

@confile could you please import this project in your environment and see if it compiles? https://github.com/manolo/gwtquery-test

It's almost the same than yours but with all 3party dependencies removed, and a couple of lines of code
Probably you have to change the GWT lib settings.

@confile
Copy link
Author

confile commented Jan 13, 2015

I tested you project and it compiles without any errors.

@confile
Copy link
Author

confile commented Jan 14, 2015

I think you can close this issue. The error might be due to another lib.

@manolo
Copy link
Contributor

manolo commented Jan 14, 2015

Ok, thanks anyway, this made heads up to test java8, we are about to release 1.4.3

@manolo manolo closed this as completed Jan 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants