Quantcast

Dojo build via Node+Closure Compiler produces a Java exception

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dojo build via Node+Closure Compiler produces a Java exception

sindilevich
Hello,

Dojo: 1.12.1.
Machine: Windows 7 SP1 x64, i5-6500, 16GB

Dojo build via Node+Closure Compiler produces a Java exception. The exception is written at the end of the build-report.txt file.

The exception is:


JavaException: java.lang.IllegalArgumentException: Can not set final com.google.javascript.jscomp.CompilerExecutor field com.google.javascript.jscomp.Compiler.compilerExecutor to java.lang.Class
java.lang.IllegalArgumentException: Can not set final com.google.javascript.jscomp.CompilerExecutor field com.google.javascript.jscomp.Compiler.compilerExecutor to java.lang.Class
        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
        at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
        at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
        at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(Unknown Source)
        at java.lang.reflect.Field.get(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
        at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
        at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
        at org.mozilla.javascript.gen.c1._c5(Unknown Source)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
        at org.mozilla.javascript.gen.c1._c0(Unknown Source)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
        at org.mozilla.javascript.gen.c1.call(Unknown Source)
        at org.mozilla.javascript.gen.c1.exec(Unknown Source)
        at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:526)
        at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:448)
        at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:414)
        at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:405)
        at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
        at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
        at org.mozilla.javascript.Context.call(Context.java:499)
        at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
        at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
        at org.mozilla.javascript.tools.shell.Main.main(Main.java:140)



The POC project consists of a single file, src/app/arrayHelper.js, with the contents as follows:


define(["dojo/_base/declare"], function(declare) {
    "use strict";
   
    return declare("array.helper", [], {
        getLength: function(array) {
            return array.length;
        }
    });
});


The build profile is:


var profile = (function () {
        return {
                basePath: "./src",
                releaseDir: "../../app",
                releaseName: "lib",
                action: "release",
                layerOptimize: "closure.keepLines",
                optimize: "closure.keepLines",
                localeList: "he",
                cssOptimize: "comments.keepLines",
                mini: true,
                stripConsole: "warn",
                optimizeOptions: {
                        languageIn: "ECMASCRIPT6",
                        languageOut: "ECMASCRIPT5"
                },
                defaultConfig: {
                        hasCache: {
                                "dojo-bidi": true,
                                "dojo-undef-api": true,
                                "dojo-built": 1,
                                "dojo-loader": 1,
                                "dom": 1,
                                "host-browser": 1
                        },
                        async: 1
                },
                packages: [{
                        name: "dojo",
                        location: "dojo"
                }, {
                        name: "app",
                        location: "app"
                }]
        };
})();


On the other hand, when running Dojo build via Java -- no exception is written.

Any help is much appreciated!

Thank you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dojo build via Node+Closure Compiler produces a Java exception

dylanks
A few questions and things to note:

1. declare did not get official support for strict mode until
https://github.com/dojo/dojo/pull/249 landed, which was for Dojo 1.13.
You may choose to backport this patch to 1.12 of course, but it is
considered a change in functionality and won't be backported with an
official release.
2. Which version of Node.js are you using?
3. If you remove the optimizeOptions settings, is this still failing?
4. The first parameter (a named declared class) is generally
discouraged... it's there for legacy loader support, and should only
really be used by the build system).
5. Have you tried your POC in a manner that does not extend a native
prototype, but rather an object?

Regards,
-Dylan

on 2/12/17, 11:42 (GMT-07:00) sindilevich said the following:

> Hello,
>
> Dojo: 1.12.1.
> Machine: Windows 7 SP1 x64, i5-6500, 16GB
>
> Dojo build via Node+Closure Compiler produces a Java exception. The
> exception is written at the end of the *build-report.txt* file.
>
> The exception is:
>
> /
> JavaException: java.lang.IllegalArgumentException: Can not set final
> com.google.javascript.jscomp.CompilerExecutor field
> com.google.javascript.jscomp.Compiler.compilerExecutor to java.lang.Class
> java.lang.IllegalArgumentException: Can not set final
> com.google.javascript.jscomp.CompilerExecutor field
> com.google.javascript.jscomp.Compiler.compilerExecutor to java.lang.Class
> at
> sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown
> Source)
> at
> sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown
> Source)
> at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(Unknown Source)
> at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.get(Unknown Source)
> at java.lang.reflect.Field.get(Unknown Source)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
> at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
> at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
> at org.mozilla.javascript.gen.c1._c5(Unknown Source)
> at org.mozilla.javascript.gen.c1.call(Unknown Source)
> at
> org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
> at org.mozilla.javascript.gen.c1._c0(Unknown Source)
> at org.mozilla.javascript.gen.c1.call(Unknown Source)
> at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
> at org.mozilla.javascript.gen.c1.call(Unknown Source)
> at org.mozilla.javascript.gen.c1.exec(Unknown Source)
> at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:526)
> at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:448)
> at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:414)
> at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:405)
> at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:179)
> at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:100)
> at org.mozilla.javascript.Context.call(Context.java:499)
> at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
> at org.mozilla.javascript.tools.shell.Main.exec(Main.java:162)
> at org.mozilla.javascript.tools.shell.Main.main(Main.java:140)
> /
>
>
> The POC project consists of a single file, *src/app/arrayHelper.js*, with
> the contents as follows:
>
> /
> define(["dojo/_base/declare"], function(declare) {
>     "use strict";
>    
>     return declare("array.helper", [], {
>         getLength: function(array) {
>             return array.length;
>         }
>     });
> });
> /
>
> The build profile is:
>
> /
> var profile = (function () {
>         return {
>                 basePath: "./src",
>                 releaseDir: "../../app",
>                 releaseName: "lib",
> action: "release",
> layerOptimize: "closure.keepLines",
> optimize: "closure.keepLines",
> localeList: "he",
> cssOptimize: "comments.keepLines",
> mini: true,
> stripConsole: "warn",
> optimizeOptions: {
> languageIn: "ECMASCRIPT6",
> languageOut: "ECMASCRIPT5"
> },
> defaultConfig: {
> hasCache: {
> "dojo-bidi": true,
> "dojo-undef-api": true,
> "dojo-built": 1,
> "dojo-loader": 1,
> "dom": 1,
> "host-browser": 1
> },
> async: 1
> },
> packages: [{
> name: "dojo",
> location: "dojo"
> }, {
> name: "app",
> location: "app"
> }]
> };
> })();
> /
>
> On the other hand, when running Dojo build via Java -- no exception is
> written.
>
> Any help is much appreciated!
>
> Thank you.
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojo-build-via-Node-Closure-Compiler-produces-a-Java-exception-tp4007132.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dojo build via Node+Closure Compiler produces a Java exception

sindilevich
I reworked my POC, using the Dojo boilerplate project as the POC. I only updated it to using Dojo 1.12.1 and added a simple .cmd file to bootstrap the build more conveniently.

Thus:
1. No strict mode in the POC
2. I use node v7.5.0
3. I removed the optimizeOptions settings, but the same exception was thrown, when running the build with Node
4. Got rid of the named declared class parameter
5. Now, I extend dijit/Dialog instead
6. I forgot to mention, I use Java v1.8.0_121
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dojo build via Node+Closure Compiler produces a Java exception

dylanks
In general, only the even number releases of Node.js are considered to
be stable whereas the odd releases are more experimental and problematic.

Do you have the same issue with the latest 6.x, as I'm certain we've not
tried this out with 7.x.

Regards,
-Dylan

on 2/13/17, 10:11 (GMT-07:00) sindilevich said the following:

> I reworked my POC, using the  Dojo boilerplate project
> <https://github.com/csnover/dojo-boilerplate>   as the POC. I only updated
> it to using Dojo 1.12.1 and added a simple /.cmd/ file to bootstrap the
> build more conveniently.
>
> Thus:
> 1. No /strict mode/ in the POC
> 2. I use /node v7.5.0/
> 3. I removed the /optimizeOptions/ settings, but the same exception was
> thrown, when running the build with Node
> 4. Got rid of the /named declared class/ parameter
> 5. Now, I extend /dijit/Dialog/ instead
> 6. I forgot to mention, I use /Java v1.8.0_121/
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojo-build-via-Node-Closure-Compiler-produces-a-Java-exception-tp4007132p4007135.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dojo build via Node+Closure Compiler produces a Java exception

sindilevich
I've just clean-installed the latest LTS node - v6.9.5. Unfortunately, the same exception is present in the build-report.txt file.
Loading...