arunnair85 / jsdt-jquery

Automatically exported from code.google.com/p/jsdt-jquery
0 stars 0 forks source link

NPE during type inferencing #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
User is created the issue for WTP JSDT, but stacktrace points to 3rd-party 
product like jsdt-jquery. See: 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=444518 - Bug 444518 - error 
during type inferencing.

What steps will reproduce the problem?

-- No steps to reproduce provided, but it looks like the issue occurs while 
inferring types on reconciling after a JavaScript is changed in JavaScript 
editor. 

What is the expected output? What do you see instead?

There is no example source provided, but no exceptions expected at reconciling.
The following exception appears in user's log:

java.lang.NullPointerException
    at org.eclipselabs.jsdt.jquery.api.infer.QueryDeferredInferrer.isDeferred(QueryDeferredInferrer.java:69)
    at org.eclipselabs.jsdt.jquery.api.infer.QueryDeferredInferrer.isDeferredConstructorCall(QueryDeferredInferrer.java:62)
    at org.eclipselabs.jsdt.jquery.api.infer.QueryDeferredInferrer.visit(QueryDeferredInferrer.java:52)
    at org.eclipse.wst.jsdt.internal.compiler.DelegateASTVisitor.visit(DelegateASTVisitor.java:526)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.traverse(Assignment.java:240)
    at org.eclipse.wst.jsdt.internal.compiler.ast.ListExpression.traverse(ListExpression.java:89)
    at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:627)
    at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:607)
    at org.eclipselabs.jsdt.jquery.api.infer.JQueryInferEngine.doInfer(JQueryInferEngine.java:44)
    at org.eclipse.wst.jsdt.internal.compiler.parser.Parser.inferTypes(Parser.java:7108)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.accept(CompilationUnitProblemFinder.java:168)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForBinding(LookupEnvironment.java:287)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:132)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:815)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.getResolvedType(LookupEnvironment.java:766)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getJavaLangFunction(Scope.java:1806)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.FunctionTypeBinding.<init>(FunctionTypeBinding.java:26)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.MethodBinding.createFunctionTypeBinding(MethodBinding.java:712)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.MethodScope.createMethod(MethodScope.java:250)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.MethodScope.createMethod(MethodScope.java:184)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding.buildFunctions(SourceTypeBinding.java:596)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding.buildFieldsAndMethods(SourceTypeBinding.java:259)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.SourceTypeBinding.buildFieldsAndMethods(SourceTypeBinding.java:195)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.buildFieldsAndMethods(CompilationUnitScope.java:246)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:431)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:480)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.accept(CompilationUnitProblemFinder.java:175)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForBinding(LookupEnvironment.java:287)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:132)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.getType(LookupEnvironment.java:815)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.getResolvedType(LookupEnvironment.java:766)
    at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getJavaLangString(Scope.java:1796)
    at org.eclipse.wst.jsdt.internal.compiler.ast.StringLiteral.literalType(StringLiteral.java:56)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Literal.resolveType(Literal.java:48)
    at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:171)
    at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:161)
    at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:431)
    at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:462)
    at org.eclipse.wst.jsdt.internal.compiler.Compiler.resolve(Compiler.java:668)
    at org.eclipse.wst.jsdt.internal.compiler.Compiler.resolve(Compiler.java:710)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:263)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:335)
    at org.eclipse.wst.jsdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:197)
    at org.eclipse.wst.jsdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:96)
    at org.eclipse.wst.jsdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:742)
    at org.eclipse.wst.jsdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
    at org.eclipse.wst.jsdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1272)
    at org.eclipse.wst.jsdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:95)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.wst.jsdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:76)
    at org.eclipse.wst.jsdt.internal.ui.text.java.JavaReconcilingStrategy.initialReconcile(JavaReconcilingStrategy.java:170)
    at org.eclipse.wst.jsdt.internal.ui.text.CompositeReconcilingStrategy.initialReconcile(CompositeReconcilingStrategy.java:113)
    at org.eclipse.wst.jsdt.internal.ui.text.JavaCompositeReconcilingStrategy.initialReconcile(JavaCompositeReconcilingStrategy.java:120)
    at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:105)
    at org.eclipse.wst.jsdt.internal.ui.text.JavaReconciler.initialProcess(JavaReconciler.java:360)
    at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:173)

What version of the product are you using? On what operating system?

- User provided the following configuration details:

Product: Eclipse 4.4.0.20140612-0500 (org.eclipse.epp.package.php.product)
Installed Features:
 org.eclipse.platform 4.4.0.v20140606-1558

Please provide any additional information below.

See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=444518 - Bug 444518 - error 
during type inferencing

Original issue reported on code.google.com by victor.r...@gmail.com on 19 Mar 2015 at 2:06

GoogleCodeExporter commented 9 years ago
The patch jboss-jquery-issue14.diff attached due to fix the issue.

The problem is that it's possible to have a null value for a selector in 
anonymous  function call, but there was a null-check for a selector that is 
passed to isDeferred(char[] selector) method. The patch adds such a check.

Original comment by victor.r...@gmail.com on 20 Mar 2015 at 2:03

Attachments:

GoogleCodeExporter commented 9 years ago
The simple code snippet that allows to reproduce the issue:

var a = "";
a =  (function(){var b = ""; return b;})();

Original comment by victor.r...@gmail.com on 20 Mar 2015 at 2:14

GoogleCodeExporter commented 9 years ago
Fixed in 1.8.0

Original comment by philippe...@gmail.com on 10 Apr 2015 at 11:47