Strange GWT compile error possibly caused by Base64Coder.java

14 views
Skip to first unread message

Raphael André Bauer

unread,
May 20, 2011, 9:27:17 AM5/20/11
to em...@googlegroups.com
Hi Emite list,


first of all thanks a lot for your efforts :) (yes - it's my first post).
Emite is really a pleasure to use and we hope we can contribute back
in the future - great project!

And - we got a problem here. Somehow it seems (not yet 100% sure) that
class Base64Coder.java of Emite causes the GWT compiler to break. We
are using GWT 2.3.0 and it seems to break predictably (I attached the
stack trace below).

I also asked the same question on the GWT list [1]. Plus there is a
bug that might be related to the issue (also not 100% sure) [2].


Any suggestions are heavily welcome. The main problem for me is that
it's not that easy to debug the problem.


Thanks a lot for your efforts :)

Best,

Raphael

[1] http://groups.google.com/group/google-web-toolkit/browse_thread/thread/55841360a4f2f2b7
[2] http://code.google.com/p/google-web-toolkit/issues/detail?id=2478

Stack trace:

[INFO] Compiling 18 permutations
[INFO] Compiling permutation 0...
[INFO] Process output
[INFO] Compiling
[INFO] Compiling permutation 1...
[INFO] [ERROR] An internal compiler exception occurred
[INFO] com.google.gwt.dev.jjs.InternalCompilerException: Unexpected
error during visit.
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.translateException(JVisitor.java:108)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:277)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:266)
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:115)
[INFO] at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:
82)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:362)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:274)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:266)
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:115)
[INFO] at com.google.gwt.dev.jjs.ast.JWhileStatement.traverse(JWhileStatement.java:44
)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVi
sitor.java:170)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JMod
Visitor.java:337)
[INFO] at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:83)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:362)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:274)
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:136)
[INFO] at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:132)
[INFO] at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:82)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:362)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:274)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:266)
[INFO] at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:329)
[INFO] at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:297)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVi
sitor.java:170)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JMod
Visitor.java:337)
[INFO] at com.google.gwt.dev.jjs.ast.JClassType.traverse(JClassType.java:80)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:362)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:288)
[INFO] at com.google.gwt.dev.jjs.ast.JProgram.traverse(JProgram.java:1124)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:362)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:274)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:266)
[INFO] at com.google.gwt.dev.jjs.impl.EqualityNormalizer.execImpl(EqualityNormalizer.
java:223)
[INFO] at com.google.gwt.dev.jjs.impl.EqualityNormalizer.exec(EqualityNormalizer.java
:208)
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJa
vaScriptCompiler.java:302)
[INFO] at com.google.gwt.dev.jjs.UnifiedAst.compilePermutation(UnifiedAst.java:136)
[INFO] at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:192)
[INFO] at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWork
er.compile(ThreadedPermutationWorkerFactory.java:49)
[INFO] at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(Permut
ationWorkerFactory.java:73)
[INFO] at java.lang.Thread.run(Thread.java:680)
[INFO] Caused by: java.lang.ClassCastException:
com.google.gwt.dev.jjs.ast.JPrimitiveType cannot be cast to
com.google.gwt.dev.jjs.ast.JReferenceType
[INFO] at com.google.gwt.dev.jjs.impl.EqualityNormalizer$BreakupAssignOpsVisitor.endV
isit(EqualityNormalizer.java:85)
[INFO] at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:
84)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:362)
[INFO] at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:274)
[INFO] ... 38 more
[INFO] [ERROR] at Base64Coder.java(73): in[iLen - 1] == '='
[INFO] com.google.gwt.dev.jjs.ast.JBinaryOperation
[INFO] [ERROR] at Base64Coder.java(73): iLen > 0 && in[iLen -
1] == '='
[INFO] com.google.gwt.dev.jjs.ast.JBinaryOperation
[INFO] [ERROR] at Base64Coder.java(73): while (iLen > 0 &&
in[iLen - 1] == '=') {
[INFO] --iLen;
[INFO] }
[INFO] com.google.gwt.dev.jjs.ast.JWhileStatement
[INFO] [ERROR] at Base64Coder.java(68): {
[INFO] int iLen = in.length;
[INFO] if (iLen % 4 != 0) {
[INFO] throw new IllegalArgumentException("Length of Base64
encoded input string is not a multiple of 4.");
[INFO] }
[INFO] while (iLen > 0 && in[iLen - 1] == '=') {
[INFO] --iLen;
[INFO] }
[INFO] final int oLen = Cast.narrow_int(iLen * 3 / 4);
[INFO] final byte[] out = Array.initDim(byte[].class, {27:1}, -1, oLen, 1);
[INFO] int ip = 0;
[INFO] int op = 0;
[INFO] while (ip < iLen) {
[INFO] final int i0 = in[ip++];
[INFO] final int i1 = in[ip++];
[INFO] final int i2 = ip < iLen ? in[ip++] : 'A';
[INFO] final int i3 = ip < iLen ? in[ip++] : 'A';
[INFO] if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) {
[INFO] throw new IllegalArgumentException("Illegal character in
Base64 encoded data.");
[INFO] }
[INFO] final int b0 = Base64Coder.map2[i0];
[INFO] final int b1 = Base64Coder.map2[i1];
[INFO] final int b2 = Base64Coder.map2[i2];
[INFO] final int b3 = Base64Coder.map2[i3];
[INFO] if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) {
[INFO] throw new IllegalArgumentException("Illegal character in
Base64 encoded data.");
[INFO] }
[INFO] final int o0 = b0 << 2 | b1 >>> 4;
[INFO] final int o1 = (b1 & 15) << 4 | b2 >>> 2;
[INFO] final int o2 = (b2 & 3) << 6 | b3;
[INFO] out[op++] = Cast.narrow_byte(o0);
[INFO] op < oLen && (out[op++] = Cast.narrow_byte(o1));
[INFO] op < oLen && (out[op++] = Cast.narrow_byte(o2));
[INFO] }
[INFO] return out;
[INFO] }
[INFO] com.google.gwt.dev.jjs.ast.JBlock
[INFO] [ERROR] at Base64Coder.java(68): {
[INFO] int iLen = in.length;
[INFO] if (iLen % 4 != 0) {
[INFO] throw new IllegalArgumentException("Length of Base64
encoded input string is not a multiple of 4.");
[INFO] }
[INFO] while (iLen > 0 && in[iLen - 1] == '=') {
[INFO] --iLen;
[INFO] }
[INFO] final int oLen = Cast.narrow_int(iLen * 3 / 4);
[INFO] final byte[] out = Array.initDim(byte[].class, {27:1}, -1, oLen, 1);
[INFO] int ip = 0;
[INFO] int op = 0;
[INFO] while (ip < iLen) {
[INFO] final int i0 = in[ip++];
[INFO] final int i1 = in[ip++];
[INFO] final int i2 = ip < iLen ? in[ip++] : 'A';
[INFO] final int i3 = ip < iLen ? in[ip++] : 'A';
[INFO] if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127) {
[INFO] throw new IllegalArgumentException("Illegal character in
Base64 encoded data.");
[INFO] }
[INFO] final int b0 = Base64Coder.map2[i0];
[INFO] final int b1 = Base64Coder.map2[i1];
[INFO] final int b2 = Base64Coder.map2[i2];
[INFO] final int b3 = Base64Coder.map2[i3];
[INFO] if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0) {
[INFO] throw new IllegalArgumentException("Illegal character in
Base64 encoded data.");
[INFO] }
[INFO] final int o0 = b0 << 2 | b1 >>> 4;
[INFO] final int o1 = (b1 & 15) << 4 | b2 >>> 2;
[INFO] final int o2 = (b2 & 3) << 6 | b3;
[INFO] out[op++] = Cast.narrow_byte(o0);
[INFO] op < oLen && (out[op++] = Cast.narrow_byte(o1));
[INFO] op < oLen && (out[op++] = Cast.narrow_byte(o2));
[INFO] }
[INFO] return out;
[INFO] }
[INFO] com.google.gwt.dev.jjs.ast.JMethodBody
[INFO] [ERROR] at Base64Coder.java(68): public static final
byte[] decode(null in);
[INFO]
[INFO] com.google.gwt.dev.jjs.ast.JMethod
[INFO] [ERROR] at Base64Coder.java(28): final class
Base64Coder extends Object
[INFO] com.google.gwt.dev.jjs.ast.JClassType
[INFO] [ERROR] at com.google.gwt.dev.jjs.ast.JProgram(0): <JProgram>
[INFO] com.google.gwt.dev.jjs.ast.JProgram
[INFO] [ERROR] Unrecoverable exception, shutting down
[INFO] com.google.gwt.core.ext.UnableToCompleteException: (see
previous log entries)
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.logAndTranslateException(Ja
vaToJavaScriptCompiler.java:1149)
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJa
vaScriptCompiler.java:460)
[INFO] at com.google.gwt.dev.jjs.UnifiedAst.compilePermutation(UnifiedAst.java:136)
[INFO] at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:192)
[INFO] at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWork
er.compile(ThreadedPermutationWorkerFactory.java:49)
[INFO] at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(Permut
ationWorkerFactory.java:73)
[INFO] at java.lang.Thread.run(Thread.java:680)
[INFO] [ERROR] Not all permutation were compiled , completed (0/18)
[INFO] [WARN] Lost

dani

unread,
May 20, 2011, 9:39:20 AM5/20/11
to em...@googlegroups.com
Hi Raphael!

Grad to hear your comments...

And about the issue... in fact, I don't have any idea of where it come
fromes... I will investigate...
Bests,
Dani

> --
> You received this message because you are subscribed to the Google Groups "emite" group.
> To post to this group, send email to em...@googlegroups.com.
> To unsubscribe from this group, send email to emite+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/emite?hl=en.
>
>

Raphael André Bauer

unread,
May 20, 2011, 9:40:44 AM5/20/11
to em...@googlegroups.com
On Fri, May 20, 2011 at 3:39 PM, dani <dan...@gmail.com> wrote:
> Hi Raphael!
>
> Grad to hear your comments...
>
> And about the issue... in fact, I don't have any idea of where it come
> fromes... I will investigate...

Great :)
Let me know if I can help to debug stuff...

Thanks!


Raphael

Raphael André Bauer

unread,
May 25, 2011, 4:51:13 AM5/25/11
to em...@googlegroups.com

Just a quick follow-up:
- Bug 2478 seems to be related and I added a description of our
problem (http://code.google.com/p/google-web-toolkit/issues/detail?id=2478#c11)
- Hotfix: If you run into the error you can change the char[] to
Character[] in Base64Coder.java - and the error goes away magically.

So far,

Raphael

Reply all
Reply to author
Forward
0 new messages