enable closure compiler

490 views
Skip to first unread message

Deepak Singh

unread,
Aug 26, 2012, 12:35:26 PM8/26/12
to google-we...@googlegroups.com
Hi All,

I migrated to GWT 2.5Rc1 and now i want to know the benefits of closure-compiler which can now be passed as a compiler option.

Along with i am using gwtquery. Will it be beneficial to enable closureCompiler ?

Thanks
Deepak Singh

Sergey

unread,
Aug 26, 2012, 5:24:36 PM8/26/12
to google-we...@googlegroups.com
use -XenableClosureCompiler option.

Deepak Singh

unread,
Aug 26, 2012, 5:59:09 PM8/26/12
to google-we...@googlegroups.com
enabling the closure compiler gives following exception (GWT2.5Rc1)

     [ERROR] Unexpected internal compiler error
java.lang.IllegalStateException: Expected non-empty string. Reference node STRING 
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator$1.handleViolation(AstValidator.java:51)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.violation(AstValidator.java:763)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateNonEmptyString(AstValidator.java:328)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLiteralKeyName(AstValidator.java:739)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLitStringKey(AstValidator.java:726)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLitKey(AstValidator.java:683)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLit(AstValidator.java:670)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateExpression(AstValidator.java:252)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLitStringKey(AstValidator.java:727)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLitKey(AstValidator.java:683)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateObjectLit(AstValidator.java:670)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateExpression(AstValidator.java:252)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateAssignmentExpression(AstValidator.java:603)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateExpression(AstValidator.java:219)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateVar(AstValidator.java:399)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateStatement(AstValidator.java:123)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateBlock(AstValidator.java:280)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateFunctionExpression(AstValidator.java:363)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateExpression(AstValidator.java:268)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateCall(AstValidator.java:377)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateExpression(AstValidator.java:260)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateExprStmt(AstValidator.java:476)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateStatement(AstValidator.java:126)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateBlock(AstValidator.java:280)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateFunctionStatement(AstValidator.java:355)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateStatement(AstValidator.java:102)
at com.google.gwt.thirdparty.javascript.jscomp.AstValidator.validateScript(AstValidator.java:89)
at com.google.gwt.dev.js.ClosureJsAstTranslator.translate(ClosureJsAstTranslator.java:127)
at com.google.gwt.dev.js.ClosureJsRunner.createClosureJsAst(ClosureJsRunner.java:273)
at com.google.gwt.dev.js.ClosureJsRunner.createClosureModule(ClosureJsRunner.java:284)
at com.google.gwt.dev.js.ClosureJsRunner.createClosureModules(ClosureJsRunner.java:293)
at com.google.gwt.dev.js.ClosureJsRunner.compile(ClosureJsRunner.java:185)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.generateJavaScriptCode(JavaToJavaScriptCompiler.java:1035)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:462)
at com.google.gwt.dev.jjs.UnifiedAst.compilePermutation(UnifiedAst.java:134)
at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:195)
at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:49)
at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:73)
at java.lang.Thread.run(Thread.java:619)
      [ERROR] Unrecoverable exception, shutting down
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.javac.CompilationProblemReporter.logAndTranslateException(CompilationProblemReporter.java:96)
at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:503)
at com.google.gwt.dev.jjs.UnifiedAst.compilePermutation(UnifiedAst.java:134)
at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:195)
at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:49)
at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:73)
at java.lang.Thread.run(Thread.java:619)
      [ERROR] Not all permutation were compiled , completed (2/6)


On Mon, Aug 27, 2012 at 2:54 AM, Sergey <gwtuse...@gmail.com> wrote:
use -XenableClosureCompiler option.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/0eIURq10NvwJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

Alex opn

unread,
Aug 27, 2012, 10:13:24 AM8/27/12
to google-we...@googlegroups.com
After reading this I thought I'd give it a try, too and got the same error:


[ERROR] Unexpected internal compiler error
[INFO]          java.lang.IllegalStateException: Expected non-empty string. Reference node STRING

Any hints? : )
use -XenableClosureCompiler option.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

Thomas Broyer

unread,
Aug 27, 2012, 11:32:03 AM8/27/12
to google-we...@googlegroups.com


On Monday, August 27, 2012 4:13:24 PM UTC+2, Alex opn wrote:
After reading this I thought I'd give it a try, too and got the same error:

[ERROR] Unexpected internal compiler error
[INFO]          java.lang.IllegalStateException: Expected non-empty string. Reference node STRING

Any hints? : )

The issue seems to only happen if you have a switch/case in JSNI with an empty string as a 'case' value (see http://code.google.com/p/gwtquery/source/detail?r=1035)

Alex opn

unread,
Aug 27, 2012, 11:53:40 AM8/27/12
to google-we...@googlegroups.com
Thanks for pointing this out! Google didn't come up with the issue. Trying with the new GQuery-Snapshot now.

Deepak Singh

unread,
Aug 27, 2012, 2:52:45 PM8/27/12
to google-we...@googlegroups.com, gwtquery
Can i also have the new Gwtquery-snapshot to avoid this error ?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/oDSZBHOG6_EJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

Alex opn

unread,
Aug 27, 2012, 4:14:46 PM8/27/12
to google-we...@googlegroups.com, gwtquery
You can get it here:

http://code.google.com/p/gwtquery/wiki/Downloads?tm=2

Direct Download:

https://oss.sonatype.org/content/repositories/snapshots/com/googlecode/gwtquery/gwtquery/1.1.1-SNAPSHOT/gwtquery-1.1.1-20120724.210322-26.jar

Maven users of the SNAPSHOT version you have to add these lines:
      <repositories>
       
    <repository>
         
    <id>sonatype-snapshots</id>
         
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
         
    <snapshots><enabled>true</enabled></snapshots>
         
    <releases><enabled>false</enabled></releases>
       
    </repository>
     
    <repositories>

     
    <dependencies>
       
    <dependency>
         
    <groupId>com.googlecode.gwtquery</groupId>
         
    <artifactId>gwtquery</artifactId>
         
    <version>1.1.1-SNAPSHOT</version>
         
    <scope>provided</scope>
       
    </dependency>
     
    </dependencies>


Am Montag, 27. August 2012 20:52:45 UTC+2 schrieb Deepak Singh:
Can i also have the new Gwtquery-snapshot to avoid this error ?

On Mon, Aug 27, 2012 at 9:23 PM, Alex opn <opn...@gmail.com> wrote:
Thanks for pointing this out! Google didn't come up with the issue. Trying with the new GQuery-Snapshot now.

Am Montag, 27. August 2012 17:32:03 UTC+2 schrieb Thomas Broyer:


On Monday, August 27, 2012 4:13:24 PM UTC+2, Alex opn wrote:
After reading this I thought I'd give it a try, too and got the same error:

[ERROR] Unexpected internal compiler error
[INFO]          java.lang.IllegalStateException: Expected non-empty string. Reference node STRING

Any hints? : )

The issue seems to only happen if you have a switch/case in JSNI with an empty string as a 'case' value (see http://code.google.com/p/gwtquery/source/detail?r=1035)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/oDSZBHOG6_EJ.

To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

Alex opn

unread,
Aug 27, 2012, 4:16:30 PM8/27/12
to google-we...@googlegroups.com, gwtquery
Sorry for double post : ) Forgot to say that using the snapshot indeed solved the problem.

Deepak Singh

unread,
Aug 27, 2012, 5:08:07 PM8/27/12
to gwtq...@googlegroups.com, google-we...@googlegroups.com
So what's benefit of this closure compiler ?

You received this message because you are subscribed to the Google Groups "gwtquery" group.
To view this discussion on the web visit https://groups.google.com/d/msg/gwtquery/-/aNRPR-97yCcJ.

To post to this group, send email to gwtq...@googlegroups.com.
To unsubscribe from this group, send email to gwtquery+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwtquery?hl=en.



--
Deepak Singh

Thomas Broyer

unread,
Aug 27, 2012, 5:39:47 PM8/27/12
to google-we...@googlegroups.com, gwtq...@googlegroups.com


On Monday, August 27, 2012 11:08:53 PM UTC+2, Deepak Singh wrote:
So what's benefit of this closure compiler ?

opn

unread,
Aug 27, 2012, 5:56:06 PM8/27/12
to gwtq...@googlegroups.com, google-we...@googlegroups.com
In my case the generated javascript is about 10% smaller now. Can't tell exactly because I just made a quick test and the compileReport flag is ignored with the closure compiler enabled.

 I read on g+ some time ago that some people had even better results (I think up to 20% and more code size reduction? Can't find the post with the comments anymore).
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



--
Deepak Singh

--
You received this message because you are subscribed to the Google Groups "gwtquery" group.
To view this discussion on the web visit https://groups.google.com/d/msg/gwtquery/-/aNRPR-97yCcJ.

To post to this group, send email to gwtq...@googlegroups.com.
To unsubscribe from this group, send email to gwtquery+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gwtquery?hl=en.



--
Deepak Singh

Manuel Carrasco Moñino

unread,
Sep 3, 2012, 6:38:19 AM9/3/12
to gwtq...@googlegroups.com, google-we...@googlegroups.com
Hi all,

FYI: gquery 1.2.0 has been released, it has the issue fixed.

About the advantages of using the closure compiler apart from the size
of the js, I'll add the optimization of jsni blocks in your app, for
instance I tend to embed 3party code (like cordova.js etc) in jsni
blocks to optimize it.
>>>>>> google-web-tool...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Deepak Singh
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "gwtquery" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/gwtquery/-/aNRPR-97yCcJ.
>>>
>>> To post to this group, send email to gwtq...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> gwtquery+u...@googlegroups.com.
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/gwtquery?hl=en.
>>
>>
>>
>>
>> --
>> Deepak Singh
>
> --
> You received this message because you are subscribed to the Google Groups
> "gwtquery" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/gwtquery/-/-It2Bo0eUacJ.

Alex opn

unread,
Sep 4, 2012, 7:28:07 AM9/4/12
to google-we...@googlegroups.com, gwtq...@googlegroups.com
Yep. You got it : )

Am Dienstag, 28. August 2012 10:45:53 UTC+2 schrieb Henrik Aasted Sørensen:
Alex,

Could it be this post? https://plus.google.com/110412141990454266397/posts/ACHHv2KSBCD

 Regards
 Henrik
> To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages