Community
Participate
Working Groups
Build Identifier: 20110916-0149 when i update the jsdt from 3.2.4 to 3.3.1,when i save a js file,the eclipse prompt me "Requesting JavaScript AST from selection" THE ERROR LOG is: !ENTRY org.eclipse.core.jobs 4 2 2011-09-26 17:51:40.766 !MESSAGE An internal error occurred during: "Requesting JavaScript AST from selection". !STACK 0 java.lang.NullPointerException at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:669) at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:674) at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:387) at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:443) at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.accept(CompilationUnitProblemFinder.java:174) at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForBinding(LookupEnvironment.java:279) at org.eclipse.wst.jsdt.internal.compiler.lookup.PackageBinding.getBinding(PackageBinding.java:156) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findBinding(Scope.java:802) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findType(Scope.java:821) at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.buildSuperType(CompilationUnitScope.java:413) at org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope.buildTypeBindings(CompilationUnitScope.java:382) at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.buildTypeBindings(LookupEnvironment.java:320) at org.eclipse.wst.jsdt.internal.core.CompilationUnitProblemFinder.accept(CompilationUnitProblemFinder.java:171) at org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment.askForBinding(LookupEnvironment.java:279) at org.eclipse.wst.jsdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:249) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2105) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2193) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2184) at org.eclipse.wst.jsdt.core.dom.DefaultBindingResolver.resolveName(DefaultBindingResolver.java:1044) at org.eclipse.wst.jsdt.core.dom.Name.resolveBinding(Name.java:89) at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.visit(OccurrencesFinder.java:149) at org.eclipse.wst.jsdt.core.dom.QualifiedName.accept0(QualifiedName.java:170) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.QualifiedName.accept0(QualifiedName.java:173) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2427) at org.eclipse.wst.jsdt.core.dom.TagElement.accept0(TagElement.java:282) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2427) at org.eclipse.wst.jsdt.core.dom.JSdoc.accept0(JSdoc.java:206) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.FunctionDeclaration.accept0(FunctionDeclaration.java:474) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.FunctionExpression.accept0(FunctionExpression.java:143) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.visit(OccurrencesFinder.java:217) at org.eclipse.wst.jsdt.core.dom.Assignment.accept0(Assignment.java:306) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.ExpressionStatement.accept0(ExpressionStatement.java:146) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2427) at org.eclipse.wst.jsdt.core.dom.JavaScriptUnit.accept0(JavaScriptUnit.java:225) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.perform(OccurrencesFinder.java:92) at org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor.updateOccurrenceAnnotations(JavaEditor.java:2876) at org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor$7.selectionChanged(JavaEditor.java:2905) at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:157) at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:134) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) !ENTRY org.eclipse.ui.workbench 4 2 2011-09-26 17:51:44.291 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench". !STACK 0 java.lang.NullPointerException at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findMemberType(Scope.java:520) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getMemberType(Scope.java:1785) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2232) at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2184) at org.eclipse.wst.jsdt.core.dom.DefaultBindingResolver.resolveName(DefaultBindingResolver.java:1044) at org.eclipse.wst.jsdt.core.dom.Name.resolveBinding(Name.java:89) at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.visit(OccurrencesFinder.java:149) at org.eclipse.wst.jsdt.core.dom.QualifiedName.accept0(QualifiedName.java:170) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.QualifiedName.accept0(QualifiedName.java:173) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2427) at org.eclipse.wst.jsdt.core.dom.TagElement.accept0(TagElement.java:282) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2427) at org.eclipse.wst.jsdt.core.dom.JSdoc.accept0(JSdoc.java:206) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.FunctionDeclaration.accept0(FunctionDeclaration.java:474) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.FunctionExpression.accept0(FunctionExpression.java:143) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.visit(OccurrencesFinder.java:217) at org.eclipse.wst.jsdt.core.dom.Assignment.accept0(Assignment.java:306) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChild(ASTNode.java:2401) at org.eclipse.wst.jsdt.core.dom.ExpressionStatement.accept0(ExpressionStatement.java:146) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2427) at org.eclipse.wst.jsdt.core.dom.JavaScriptUnit.accept0(JavaScriptUnit.java:225) at org.eclipse.wst.jsdt.core.dom.ASTNode.accept(ASTNode.java:2354) at org.eclipse.wst.jsdt.internal.ui.search.OccurrencesFinder.perform(OccurrencesFinder.java:92) at org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor.updateOccurrenceAnnotations(JavaEditor.java:2876) at org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor$ActivationListener.windowActivated(JavaEditor.java:1220) at org.eclipse.ui.internal.Workbench$14.run(Workbench.java:1002) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.ui.internal.Workbench.fireWindowActivated(Workbench.java:1000) at org.eclipse.ui.internal.WorkbenchWindow$28.shellActivated(WorkbenchWindow.java:3141) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:88) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1263) at org.eclipse.swt.widgets.Shell.filterProc(Shell.java:731) at org.eclipse.swt.widgets.Display.filterProc(Display.java:1543) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2276) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3207) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) Reproducible: Always Steps to Reproduce: 1.save a js file 2. 3.
Hmm, null classScope again. Can you attach the file you were working on?
Created attachment 204133 [details] the file which i am edit for
Created attachment 204136 [details] the edit file
when open this file in jsdt then, add the following code: XXCMP.url.xxxxx = function(123) { dd=123; return xxx; }; then save the file maybe get the "Requesting JavaScript AST from selection" ERROR but not every time you can get it..... just some times
Comment on attachment 204133 [details] the file which i am edit for this file is wrong...........just skip it:)
Comment on attachment 204133 [details] the file which i am edit for this file is wrong..... just forget it
*** Bug 359809 has been marked as a duplicate of this bug. ***
*** Bug 360224 has been marked as a duplicate of this bug. ***
*** Bug 350276 has been marked as a duplicate of this bug. ***
It seems like marking/selecting some random JS code, with Mark occurrences feature enabled, is causing exceptions. To reproduce an issue make sure you have that feature enabled: Toggle Mark Occurrences (Alt+Shift+O)
*** Bug 366428 has been marked as a duplicate of this bug. ***
I can confirm this on Windows 7, too (Version: Indigo Service Release 1 Build id: 20110916-0149). Not only Linux.
This bug is driving me nuts. Stupid error dialog is popping up every few seconds - makes the editor almost completely unusable.
I have the same problem under Mac OS X 10.7.3, Eclipse for PHP Developers version 3.0.2
Same problem here too. Windows XP. Eclipse IDE for JavaScript Web Developers. Version: Indigo Service Release 2. Build id: 20120216-1857
It can sometimes be replicated by these steps: Does not happen everytime though. function test(){ //step 1: add a space here return true; //step 2: move cursor to this line with return }
*** Bug 367268 has been marked as a duplicate of this bug. ***
I agree with August Li, it seems to be triggered by Mark Occurrences around "return" in a function in a js file. For instance, if you have "return false;", then add a white space after the ;, then delete that whitespace again, I get the error below. Immediately after you click ok on the error, it Mark Occurrences on the "return", which hints at the cause. An internal error occurred during: "Requesting JavaScript AST from selection". java.lang.NullPointerException. If I go to Window-->Preferences->Javascript-->Editor-->Mark Occurrences then untick 'Mark occurrences of the selected element in the current file', I don't seem to get the error anymore (so far...).
Same problem. Linux 32bit. Eclipse IDE for JavaScript Web Developers. Version: Indigo Service Release 2 Build id: 20120216-1857
My steps to reproduce are in #378585, which is probably a duplicate of this issue. Reproduced in Ubuntu 64-bit. The only difference is that it is triggered by a hover calculation in wrong place (IMHO, the hover shouldn't be calculated on string literals, but it does).
(In reply to comment #1) > Hmm, null classScope again. Can you attach the file you were working on? I believe that the problem is in org.eclipse.wst.jsdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(CompilationUnit) method which calls cleanUp() method on CompilationUnitDeclaration (which subsequently cleans up all the references/bindings as well as all the SourceTypeBindings collected). But later (in hover calculation in my case or or in occurrences finder in this issue's stacktrace) those SourceTypeBinding-s are still needed to resolve types, but they (SourceTypeBinding-s) are already cleared by ReconcileWorkingOperation, so they aren't usable anymore. Not sure would it be a problem if not to call cleanUp() method on unit declaration during reconciling operation (in ReconcileWorkingCopyOperation.makeConsistent() method), but excluding this call in my local workspace helps to prevent this NPE. So, probably the CompilationUnitDeclaration is not to be cleaned up by reconcile operation (and it's not in case the working copy is not consistent - see ReconcileWorkingCopyOperation.makeConsistent() method source).
Hello, I’ve run into this issue as well. There are several cases when this exception occurs in this bug report: https://github.com/vtst/ow/issues/62 Thanks!
Created attachment 216370 [details] The patch fixes the issue (As addition to comment #21) Java Reconciler, which actually invokes ReconcileWorkingCopyOperation operation, after its AST is created, marks the resulting AST as protected and read-only as well as doesn't clean ups its units (probably resolved at this moment) due to allow further usage of the resulting AST and units as well as all the bindings collected. So, I'm strong in my feeling that there should be NO calls to the following clean up methods from ReconcileWorkingCopyOperation.makeConsistent(...) method's finally block: if (unit != null) { unit.cleanUp(); if (unit.scope!=null) unit.scope.cleanup(); } The patch attached removes this clean up calls and allows the bindings collected to stay accessible after a reconciling operation.
Still present in Eclipse Java EE IDE for Web Developers. Version: Juno Release Build id: 20120322-1740 (Web Tools 3.4.0)
Is this bug getting fixed any time soon? It's driving me nuts and renders eclipse totally useless for any javascript development, which is very sad. I'm on Mac OS X Eclipse version: Version: Indigo Service Release 2 Build id: 20120216-1857
Created attachment 219198 [details] proposed patch for this issue This patch will fix this issue. The NPE occurs while Mark Occurrences finds exit points of a function. Mark Occurrences tries to resolve return expression to determine whether the function returns void. I think this behaviour comes from JDT(Java) and resolving is not required for JavaScript because there's no 'void' type in JavaScript. The 'throw' statement also causes NPE by similar reason. It tries to resolve type of exception value to match with catch clause. This is definitely Java style and is also unnecessary for JavaScript.
Thanks for the patch, but how do I apply it? Are there steps for applying a patch for a bug fix anywhere?
Checkout the source of JSDT and use 'patch' command with the patch file. Then build JSDT ui plugin to get the patched JSDT.
*** Bug 380535 has been marked as a duplicate of this bug. ***
This was a problem in Indigo 3.7, right? I still have this problem in 3.8 fully updated WTP. Am I missing something or is the patch not merged?
*** Bug 401398 has been marked as a duplicate of this bug. ***
*** Bug 378585 has been marked as a duplicate of this bug. ***
May want to look at Bug 378585 for other reproduce steps.
This appears to have been fixed in 3.5.1 indirectly by the updates here: http://git.eclipse.org/c/jsdt/webtools.jsdt.core.git/commit/?id=ec87a3b8e0a51fc2baec20756c00429d9e68a587 Fixing up the classScopes was addressed there.