ArcBees / gwtquery

A jQuery clone for GWT, and much more.
MIT License
85 stars 38 forks source link

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

Closed confile closed 9 years ago

confile commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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

confile commented 9 years ago

@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 commented 9 years ago

Could you test this branch? https://github.com/ArcBees/gwtquery/pull/336

confile commented 9 years ago

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

manolo commented 9 years ago

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 commented 9 years ago

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

confile commented 9 years ago

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

manolo commented 9 years ago

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 commented 9 years ago

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

Could you check ?

confile commented 9 years ago

@jDramaix I do not use maven

jDramaix commented 9 years ago

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 https://github.com/ArcBees/gwtquery/issues/335#issuecomment-69774804.

confile commented 9 years ago

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

manolo commented 9 years ago

@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 commented 9 years ago

I tested you project and it compiles without any errors.

confile commented 9 years ago

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

manolo commented 9 years ago

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