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

ADVANCED mode java.lang.IllegalStateException #3944

Open
VanoGit opened this issue May 17, 2022 · 6 comments
Open

ADVANCED mode java.lang.IllegalStateException #3944

VanoGit opened this issue May 17, 2022 · 6 comments
Assignees

Comments

@VanoGit
Copy link

VanoGit commented May 17, 2022

Version: v20220502
I use closure-compiler in ADVANCED mode and get java.lang.IllegalStateException

0 error(s), 223 warning(s), 60.6% typed java.lang.IllegalStateException at com.google.common.base.Preconditions.checkState(Preconditions.java:486) at com.google.javascript.rhino.Node.getOnlyChild(Node.java:563) at com.google.javascript.jscomp.NodeUtil.getRValueOfLValue(NodeUtil.java:5190) at com.google.javascript.jscomp.PureFunctionIdentifier.populateFunctionDefinitions(PureFunctionIdentifier.java:423) at java.util.Map.forEach(Map.java:661) at com.google.javascript.jscomp.PureFunctionIdentifier.populateDatastructuresForAnalysisTraversal(PureFunctionIdentifier.java:399) at com.google.javascript.jscomp.PureFunctionIdentifier.process(PureFunctionIdentifier.java:157) at com.google.javascript.jscomp.OptimizeCalls.process(OptimizeCalls.java:124) at com.google.javascript.jscomp.PureFunctionIdentifier$Driver.process(PureFunctionIdentifier.java:1364) at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:267) at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:186) at com.google.javascript.jscomp.Compiler.performTranspilationAndOptimizations(Compiler.java:2572) at com.google.javascript.jscomp.Compiler.lambda$stage2Passes$5(Compiler.java:936) at com.google.javascript.jscomp.CompilerExecutor.lambda$runInCompilerThread$0(CompilerExecutor.java:101) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.lang.Thread.run(Thread.java:829) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:597) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:194)

Have no idea how to debug this problem and is there any problems in my code (12000 lines of code)
I will be grateful for your help

@ribrdb
Copy link

ribrdb commented May 17, 2022

FYI I used https://github.com/wala/jsdelta to find a reduced version of my crash. It was very fast and simplified it from 500k to only a few lines.

@lvelden
Copy link

lvelden commented May 18, 2022

Can you provide the exact command you've been using and potentially the reduced input that @ribrdb mentioned?

@concavelenz
Copy link
Contributor

This code in NodeUtil.getRValueOfLValue doesn't make sense to me.

      case OBJECTLIT:
      case CLASS_MEMBERS:
        return n.getOnlyChild();

Both OBJECTLIT and CLASS_MEMBERS generally expect to have multiple children

@jtarrio
Copy link

jtarrio commented May 20, 2022

I encountered the same error and managed to reduce it to this:

class Data {
  dt;
  constructor(data) {
    this.dt = data;
  }
  value() {
    return this.dt;
  }
}

let j = new Data(3);
console.log(j.value());

The culprit seems to be the uninitialized instance field declaration and the fact that it's accessed inside the value() function.

If I remove the field or initialize it to undefined or remove the access in value(), the error goes away.

@concavelenz
Copy link
Contributor

concavelenz commented May 20, 2022

Ah, this is an issue with public field handling. Thanks for the report.

@VanoGit
Copy link
Author

VanoGit commented May 21, 2022

yes, the problem is the uninitialized instance field declaration

@VanoGit VanoGit closed this as completed May 22, 2022
@VanoGit VanoGit reopened this May 22, 2022
tatethurston added a commit to tatethurston/ProtoScript that referenced this issue Jul 11, 2022
This enables compilation with google's closure compiler by working around google/closure-compiler#3944.

Adds example for using closure compiler.
tatethurston added a commit to tatethurston/ProtoScript that referenced this issue Jul 11, 2022
This enables compilation with google's closure compiler by working around google/closure-compiler#3944.

Adds example for using closure compiler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants