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

Report the name of missing property on compile errror #9807

Closed
wants to merge 1 commit into from

Conversation

zbynek
Copy link
Contributor

@zbynek zbynek commented Mar 14, 2023

Fixes #9806

Wraps cryptic NullPointerException in internal compile exception to provide more context.

I didn't find any tests that would verify correct error messages from compiling invalid modules, if you think this needs a test please give me a pointer.

@niloc132
Copy link
Contributor

Can you share the new stack trace for the bug you were hunting when you discovered this?

@zbynek
Copy link
Contributor Author

zbynek commented Mar 15, 2023

 [ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Problem replacing 'org.gwtproject.safecss.ForceCheckValidStyles'
        at com.google.gwt.dev.jjs.impl.ResolvePermutationDependentValues$ValueReplacer.endVisit(ResolvePermutationDependentValues.java:77)
        at com.google.gwt.dev.jjs.ast.JPermutationDependentValue.traverse(JPermutationDependentValue.java:112)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118)
        at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:87)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118)
        at com.google.gwt.dev.jjs.ast.JBinaryOperation.traverse(JBinaryOperation.java:89)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:118)
        at com.google.gwt.dev.jjs.ast.JExpressionStatement.traverse(JExpressionStatement.java:42)
        at com.google.gwt.dev.jjs.ast.JModVisitor$ListContext.traverse(JModVisitor.java:88)
        at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemove(JModVisitor.java:331)
        at com.google.gwt.dev.jjs.ast.JBlock.traverse(JBlock.java:94)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:139)
        at com.google.gwt.dev.jjs.ast.JVisitor.accept(JVisitor.java:135)
        at com.google.gwt.dev.jjs.ast.JMethodBody.traverse(JMethodBody.java:83)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        at com.google.gwt.dev.jjs.ast.JMethod.visitChildren(JMethod.java:786)
        at com.google.gwt.dev.jjs.ast.JMethod.traverse(JMethod.java:778)
        at com.google.gwt.dev.jjs.ast.JModVisitor$ListContextImmutable.traverse(JModVisitor.java:169)
        at com.google.gwt.dev.jjs.ast.JModVisitor.acceptWithInsertRemoveImmutable(JModVisitor.java:336)
        at com.google.gwt.dev.jjs.ast.JClassType.traverse(JClassType.java:147)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        at com.google.gwt.dev.jjs.ast.JProgram.visitModuleTypes(JProgram.java:1284)
        at com.google.gwt.dev.jjs.ast.JProgram.traverse(JProgram.java:1249)
        at com.google.gwt.dev.jjs.ast.JModVisitor.traverse(JModVisitor.java:361)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:273)
        at com.google.gwt.dev.jjs.ast.JModVisitor.accept(JModVisitor.java:265)
        at com.google.gwt.dev.jjs.impl.ResolvePermutationDependentValues.execImpl(ResolvePermutationDependentValues.java:168)
        at com.google.gwt.dev.jjs.impl.ResolvePermutationDependentValues.exec(ResolvePermutationDependentValues.java:118)
        at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:333)
        at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.compilePermutation(JavaToJavaScriptCompiler.java:272)
        at com.google.gwt.dev.CompilePerms.compile(CompilePerms.java:198)
        at com.google.gwt.dev.ThreadedPermutationWorkerFactory$ThreadedPermutationWorker.compile(ThreadedPermutationWorkerFactory.java:50)
        at com.google.gwt.dev.PermutationWorkerFactory$Manager$WorkerThread.run(PermutationWorkerFactory.java:74)
        at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.NullPointerException
        at com.google.gwt.thirdparty.guava.common.base.Preconditions.checkNotNull(Preconditions.java:212)
        at com.google.gwt.thirdparty.guava.common.base.Joiner.toString(Joiner.java:447)
        at com.google.gwt.thirdparty.guava.common.base.Joiner.appendTo(Joiner.java:110)
        at com.google.gwt.thirdparty.guava.common.base.Joiner.appendTo(Joiner.java:154)
        at com.google.gwt.thirdparty.guava.common.base.Joiner.join(Joiner.java:197)
        at com.google.gwt.thirdparty.guava.common.base.Joiner.join(Joiner.java:186)
        at com.google.gwt.dev.jjs.impl.ResolvePermutationDependentValues$ValueReplacer.propertyValueExpression(ResolvePermutationDependentValues.java:84)
        at com.google.gwt.dev.jjs.impl.ResolvePermutationDependentValues$ValueReplacer.endVisit(ResolvePermutationDependentValues.java:74)
        ... 48 more
               [ERROR] at SafeStylesHostedModeUtils.java(285): <source info not available>
                  com.google.gwt.dev.jjs.ast.JPermutationDependentValue
               [ERROR] at SafeStylesHostedModeUtils.java(285): <source info not available>
                  com.google.gwt.dev.jjs.ast.JPermutationDependentValue
               [ERROR] at SafeStylesHostedModeUtils.java(285): <source info not available>
                  com.google.gwt.dev.jjs.ast.JBinaryOperation
               [ERROR] at SafeStylesHostedModeUtils.java(285): <source info not available>
                  com.google.gwt.dev.jjs.ast.JBinaryOperation
               [ERROR] at SafeStylesHostedModeUtils.java(285): <source info not available>
                  com.google.gwt.dev.jjs.ast.JExpressionStatement
               [ERROR] at SafeStylesHostedModeUtils.java(284): <source info not available>
                  com.google.gwt.dev.jjs.ast.JBlock
               [ERROR] at SafeStylesHostedModeUtils.java(284): <source info not available>
                  com.google.gwt.dev.jjs.ast.JMethodBody
               [ERROR] at SafeStylesHostedModeUtils.java(284): org.gwtproject.safecss.shared.SafeStylesHostedModeUtils.setForceCheckValidStyleFromProperty()V
                  com.google.gwt.dev.jjs.ast.JMethod
               [ERROR] at SafeStylesHostedModeUtils.java(30): org.gwtproject.safecss.shared.SafeStylesHostedModeUtils (extends Object)
                  com.google.gwt.dev.jjs.ast.JClassType
               [ERROR] at Unknown(0): <JProgram>
                  com.google.gwt.dev.jjs.ast.JProgram

@zbynek zbynek marked this pull request as draft March 15, 2023 11:33
@niloc132
Copy link
Contributor

Thanks for checking, at least we see the SafeStylesHostedModeUtils.setForceCheckValidStyleFromProperty, maybe we can figure out why that isn't giving us more specifics...

That method isnt JSNI or something, so it should have been possible to get sources:
https://github.com/gwtproject/gwt-safehtml/blob/99d2afbec0e035e37e5c9c8dfa49115ba31a7c14/gwt-safecss/src/main/java/org/gwtproject/safecss/shared/SafeStylesHostedModeUtils.java#L277-L286

GWT's UnifyAst.handleSystemGetProperty() created this as a replacement for the System.getProperty magic method.

It should probably also check "true".equals(...) instead of just != null to fix this and to handle an actual "false" value set deliberately.

That said, the method is never even called. Tests and prod must prune it before it gets a chance to be called, but I find it hard to believe that no one is using this in SDM (elemento, domino-ui, etc).

@zbynek
Copy link
Contributor Author

zbynek commented Mar 15, 2023

Closing this in favor of @niloc132 's upcoming PR.

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

Successfully merging this pull request may close these issues.

NPE when configuration property missing in SuperDevMode
2 participants