BUG:Requesting JavaScript AST from selection

来源:互联网 发布:模拟经营单机 知乎 编辑:程序博客网 时间:2024/04/30 13:21
用 Eclipse Helios或者Eclipse indigo 编写Javascript函数中出现 return 时。 
错误提示: 
An internal error occurred during: "Requesting JavaScript AST from selection".

java.lang.NullPointerException.

解决方法: 
修改 Mark Occurrences。快捷键:Alt+Shift+O。 
(Window-->Preferences->Javascript-->Editor-->Mark Occurrences) 取消选中该项
问题分析:
英文原文:
 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). 

理解:
光标放到某个地方,会出现一个Mark Occurence的类型变量
这个变量需要被ResourceTypeBindings来解析,而这个ResourceTypeBindings又被cleanup清除了
0 0
原创粉丝点击