Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WHITESPACE_ONLY/SIMPLE_OPTIMIZATIONS without sourcemaps -> Closure happy, JS broken #134

Open
xamde opened this issue Mar 4, 2022 · 1 comment
Labels
bug Something isn't working closure Related to the closure-compiler

Comments

@xamde
Copy link
Contributor

xamde commented Mar 4, 2022

WHITESPACE_ONLY/SIMPLE_OPTIMIZATIONS without sourcemaps -> broken js, but Closure is happy

  • j2cl build runs fine
  • the resulting js does not load in a browser, console says Uncaught SyntaxError: Unexpected token '!' in line 6320.
    The offending line is (added line breaks for readability)
ctor.prototype.$implements__javax_annotation_processing_Generated=true};

Generated.$isInstance=function(instance){
    return instance!=null&&!!instance.$implements__javax_annotation_processing_Generated
};
Generated.$loadModules=function(){};
Generated.$markImplementor(Generated);
$Util.$setClassMetadataForInterface(Generated,"javax.annotation.processing.Generated");
exports=Generated;
return exports});

goog.loadModule(
    function(exports){"use strict";
        goog.module("javax.annotation.processing.Generated");
        goog.require("java.lang.annotation.Annotation");
        goog.require("nativebootstrap.Util");
        var Generated=goog.require("javax.annotation.processing.Generated$impl");
        exports=Generated;
        return exports
});
var global$$module$C_$Users$xamde$_m2$repository$com$vertispan$j2cl$bootstrap$0_10_SNAPSHOT$bootstrap_0_10_SNAPSHOT_jszip_zip!$closure$goog$goog=goog.global;
var require$$module$C_$Users$xamde$_m2$repository$com$vertispan$j2cl$bootstrap$0_10_SNAPSHOT$bootstrap_0_10_SNAPSHOT_jszip_zip!$closure$goog$goog=goog.require;
var define$$module$C_$Users$xamde$_m2$repository$com$vertispan$j2cl$bootstrap$0_10_SNAPSHOT$bootstrap_0_10_SNAPSHOT_jszip_zip!$closure$goog$goog=goog.define;

Running again with SIMPLE_OPTIMIZATIONS leads to the same results. A slightly different js, this time the error is in line 7820.
The browser complains exactly about the ! in NAPSHOT$bootstrap_0_10_SNAPSHOT_jszip_zip!$closure$goog$goog=.
The whole line looks very similar to the one produced from WHITESPACE_ONLY.

Closure logs for both runs end with "success" (marked by maven plugin) and

[INFO]  0 error(s), 0 warning(s)

Full Closure logs for SIMPLE_OPTIMIZATIONS attached in output.log

@niloc132 niloc132 added the closure Related to the closure-compiler label Mar 8, 2022
@niloc132 niloc132 added the bug Something isn't working label Jun 23, 2022
@niloc132
Copy link
Member

Okay, this is almost certainly a non-issue in 0.20 and beyond, since we no longer deal with jszips, but unpack them into a directory to handle them. This was necessary to use some features of closure-compiler, since apparently jszips don't work with features like typedast and others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closure Related to the closure-compiler
Projects
None yet
Development

No branches or pull requests

2 participants