NullPointerException when using Arrow Functions in dead code
rohanpadhye opened this issue · 1 comments
rohanpadhye commented
Affects: v20180204 and current SNAPSHOT
Test-case was automatically generated using JQF.
Input for SIMPLE_OPTIMIZATIONS
:
x=>y
Throws:
23: java.lang.NullPointerException: NAME y 1 [length: 1] [source_file: Input_0]
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:900)
at com.google.javascript.jscomp.RemoveUnusedCode.getVarForNameNode(RemoveUnusedCode.java:668)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNameNode(RemoveUnusedCode.java:530)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:405)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1117)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:414)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1117)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseFunction(RemoveUnusedCode.java:1238)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:297)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1117)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseCall(RemoveUnusedCode.java:580)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:327)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1117)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:414)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1117)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:414)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseChildren(RemoveUnusedCode.java:1117)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseNode(RemoveUnusedCode.java:414)
at com.google.javascript.jscomp.RemoveUnusedCode.access$1200(RemoveUnusedCode.java:91)
at com.google.javascript.jscomp.RemoveUnusedCode$Continuation.apply(RemoveUnusedCode.java:1530)
at com.google.javascript.jscomp.RemoveUnusedCode.traverseAndRemoveUnusedReferences(RemoveUnusedCode.java:248)
at com.google.javascript.jscomp.RemoveUnusedCode.process(RemoveUnusedCode.java:229)
at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:303)
at com.google.javascript.jscomp.PhaseOptimizer$Loop.process(PhaseOptimizer.java:448)
at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:230)
at com.google.javascript.jscomp.Compiler.performOptimizations(Compiler.java:2552)
at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:844)
at com.google.javascript.jscomp.Compiler$3.call(Compiler.java:840)
at com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread(CompilerExecutor.java:128)
at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:872)
at com.google.javascript.jscomp.Compiler.stage2Passes(Compiler.java:839)
at com.google.javascript.jscomp.Compiler.compile(Compiler.java:733)
at com.google.javascript.jscomp.webservice.backend.CompilerInvokerImpl.compile(CompilerInvokerImpl.java:48)
at com.google.javascript.jscomp.webservice.backend.ServerController.executeRequest(ServerController.java:181)
at com.google.javascript.jscomp.webservice.backend.CompilationRequestHandler.serviceParsedRequest(CompilationRequestHandler.java:180)
at com.google.javascript.jscomp.webservice.backend.CompilationRequestHandler.service(CompilationRequestHandler.java:162)
at com.google.javascript.jscomp.webservice.frontend.CompilationServlet.doPost(CompilationServlet.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772)
at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.google.apphosting.runtime.jetty9.SaveSessionFilter.doFilter(SaveSessionFilter.java:37)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.google.apphosting.utils.servlet.JdbcMySqlConnectionCleanupFilter.doFilter(JdbcMySqlConnectionCleanupFilter.java:60)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:48)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at com.google.apphosting.runtime.jetty9.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:297)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
at org.eclipse.jetty.server.Server.handle(Server.java:534)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at com.google.apphosting.runtime.jetty9.RpcConnection.handle(RpcConnection.java:202)
at com.google.apphosting.runtime.jetty9.RpcConnector.serviceRequest(RpcConnector.java:81)
at com.google.apphosting.runtime.jetty9.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:108)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchServletRequest(JavaRuntime.java:680)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.dispatchRequest(JavaRuntime.java:642)
at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:612)
at com.google.apphosting.runtime.JavaRuntime$NullSandboxRequestRunnable.run(JavaRuntime.java:806)
at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:274)
at java.lang.Thread.run(Thread.java:745)
Original Post Data:
output_format=json&output_info=compiled_code&output_info=warnings&output_info=errors&output_info=statistics&compilation_level=SIMPLE_OPTIMIZATIONS&warning_level=default&output_file_name=default.js&js_code=x%3D%3Ey
lauraharker commented
Looks like we're failing to report an undefined variable error for y
in VarCheck. I'm guessing that VarCheck can handle x => { return y; }
but not the unnormalized x => y
.