gwtproject / gwt

GWT Open Source Project

Home Page:http://www.gwtproject.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OutputStreamWriter - The method getBytes(String) in the type EmulatedCharset is not applicable for the arguments (char[], int, int)

freddyboucher opened this issue · comments

GWT version: HEAD-SNAPSHOT

Hi, since today I get the following compilation error in my Jenkins-like environment (Github Actions):

[INFO] --- gwt-maven-plugin:1.0.0:compile (default-compile) @ learnkeeper-client ---
[INFO] Compiling module com.learnkeeper.App
[INFO] Tracing compile failure path for type 'java.io.OutputStreamWriter'
[INFO] [ERROR] Errors in 'jar:file:/Users/boucfr01/.m2/repository/com/google/gwt/gwt-user/HEAD-SNAPSHOT/gwt-user-HEAD-SNAPSHOT.jar!/com/google/gwt/emul/java/io/OutputStreamWriter.java'
[INFO] [ERROR] Line 59: The method getBytes(String) in the type EmulatedCharset is not applicable for the arguments (char[], int, int)
[INFO] [ERROR] Aborting compile due to errors in some input files
[INFO] [ERROR] Error saving compilation unit to cache file: /Users/boucfr01/Private/Programming/LearnKeeper/learnkeeper-client/target/gwt-unitCache/gwt-unitCache-8eaa4a3840f6593db9b9513ecf167e7513615408-FF35F588CF7564DE259004F02565B00E-000001719137B04D
[INFO] java.io.IOException: Stream Closed
[INFO] at java.io.RandomAccessFile.seek0(Native Method)
[INFO] at java.io.RandomAccessFile.seek(RandomAccessFile.java:557)
[INFO] at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:161)
[INFO] at com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:73)
[INFO] at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1154)
[INFO] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[INFO] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[INFO] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[INFO] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
[INFO] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
[INFO] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[INFO] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[INFO] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[INFO] at java.util.ArrayList.writeObject(ArrayList.java:766)
[INFO] at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1154)
[INFO] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[INFO] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[INFO] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[INFO] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[INFO] at com.google.gwt.dev.javac.CachedCompilationUnit.writeObject(CachedCompilationUnit.java:231)
[INFO] at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1154)
[INFO] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[INFO] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[INFO] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[INFO] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[INFO] at com.google.gwt.dev.javac.PersistentUnitCacheDir$OpenFile.writeUnit(PersistentUnitCacheDir.java:373)
[INFO] at com.google.gwt.dev.javac.PersistentUnitCacheDir.writeUnit(PersistentUnitCacheDir.java:194)
[INFO] at com.google.gwt.dev.javac.PersistentUnitCache$BackgroundService$6.run(PersistentUnitCache.java:444)
[INFO] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[INFO] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[INFO] at java.lang.Thread.run(Thread.java:748)

So it occurs when running my GWTTestSuite that is part of my build process.
I guess, it's related to the recent change on GWT head: ba037e1

My Github Actions uses JAVA_HOME: /opt/hostedtoolcache/jdk/8.0.252/x64
I can also reproduce it in local (openjdk version "1.8.0_252").

Screen Shot 2020-04-19 at 5 00 16 PM

Downgrading to 2.9.0-RC1 fixed temporary my issue!

You must have your own EmulatedCharset that shadows GWT's own version, because that overload was added at the same time as the OutputStreamWriter emulation.

@tbroyer Nop I don't have my own EmulatedCharset.

@tbroyer
I setup a demo project to reproduce the issue:

  1. checkout branch gwt-9682 https://github.com/freddyboucher/gwt-storage-objectify/commits/gwt-9682
  2. run: mvn clean install

[INFO] --- gwt-maven-plugin:1.0.0:compile (default-compile) @ gwt-storage-objectify-client ---
[INFO] Compiling module com.project.App
[INFO] Tracing compile failure path for type 'java.io.OutputStreamWriter'
[INFO] [ERROR] Errors in 'jar:file:/Users/boucfr01/.m2/repository/com/google/gwt/gwt-user/HEAD-SNAPSHOT/gwt-user-HEAD-SNAPSHOT.jar!/com/google/gwt/emul/java/io/OutputStreamWriter.java'
[INFO] [ERROR] Line 59: The method getBytes(String) in the type EmulatedCharset is not applicable for the arguments (char[], int, int)
[INFO] [ERROR] Aborting compile due to errors in some input files
[INFO] [ERROR] Error saving compilation unit to cache file: /Users/boucfr01/Private/Programming/gwt-storage-objectify/gwt-storage-objectify-client/target/gwt-unitCache/gwt-unitCache-8eaa4a3840f6593db9b9513ecf167e7513615408-FF35F588CF7564DE259004F02565B00E-000001719216C7D7
[INFO] java.io.IOException: Stream Closed
[INFO] at java.io.RandomAccessFile.seek0(Native Method)
[INFO] at java.io.RandomAccessFile.seek(RandomAccessFile.java:557)
[INFO] at com.google.gwt.dev.util.DiskCache.transferToStream(DiskCache.java:161)
[INFO] at com.google.gwt.dev.util.DiskCacheToken.writeObject(DiskCacheToken.java:73)
[INFO] at sun.reflect.GeneratedMethodAccessor36.invoke(Unknown Source)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1154)
[INFO] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[INFO] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[INFO] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[INFO] at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
[INFO] at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:441)
[INFO] at com.google.gwt.dev.javac.CachedCompilationUnit.writeObject(CachedCompilationUnit.java:230)
[INFO] at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1154)
[INFO] at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
[INFO] at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[INFO] at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[INFO] at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[INFO] at com.google.gwt.dev.javac.PersistentUnitCacheDir$OpenFile.writeUnit(PersistentUnitCacheDir.java:373)
[INFO] at com.google.gwt.dev.javac.PersistentUnitCacheDir.writeUnit(PersistentUnitCacheDir.java:194)
[INFO] at com.google.gwt.dev.javac.PersistentUnitCache$BackgroundService$6.run(PersistentUnitCache.java:444)
[INFO] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[INFO] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[INFO] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[INFO] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[INFO] at java.lang.Thread.run(Thread.java:748)

There are 3.5-year-old EmulatedCharset copies in gwt-commons-lang3 and gwt-commons-validator.

@tbroyer As always I really appreciated your help!
I opened a gwt-commons-lang3 ticket
Thanks