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

NPE when trying to do open declaration #815

Closed
keertip opened this issue Dec 12, 2011 · 3 comments
Closed

NPE when trying to do open declaration #815

keertip opened this issue Dec 12, 2011 · 3 comments

Comments

@keertip
Copy link
Contributor

keertip commented Dec 12, 2011

Editor Feedback:

!ENTRY org.eclipse.ui 4 4 2011-12-09 11:57:14.403
!MESSAGE "Open Declaration" did not complete normally. Please see the log for more information.

!ENTRY org.eclipse.ui 4 0 2011-12-09 11:57:14.403
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
       at com.google.dart.tools.core.utilities.ast.DartElementLocator.searchWithin(DartElementLocator.java:167)
       at com.google.dart.tools.ui.actions.OpenAction.run(OpenAction.java:168)
       at com.google.dart.tools.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:240)
       at com.google.dart.tools.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:118)
       at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
       at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185)
       at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109)
       at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
       at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
       at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
       at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
       at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
       at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
       at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
       at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
       at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
       at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
       at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1069)
       at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4124)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
       at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
       at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1494)
       at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1490)
       at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:463)
       at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1051)
       at org.eclipse.swt.widgets.Display.windowProc(Display.java:5560)
       at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
       at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:68)
       at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:587)
       at org.eclipse.swt.widgets.Display.windowProc(Display.java:5470)
       at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
       at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
       at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2092)
       at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2255)
       at org.eclipse.swt.widgets.Display.windowProc(Display.java:5532)
       at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
       at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4986)
       at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5135)
       at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
       at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3607)
       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 com.google.dart.tools.deploy.DartIDEApplication.start(DartIDEApplication.java:44)
       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(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       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)

!ENTRY com.google.dart.tools.ui 4 10001 2011-12-09 11:57:14.434
!MESSAGE Internal Error
!STACK 1
Dart Model Exception: Core Exception [code 0] Failed to parse editor.dart
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:760)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:740)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:704)
       at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2010)
       at com.google.dart.tools.ui.internal.text.editor.DartTextHover.getHoverInfo(DartTextHover.java:46)
       at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)
Caused by: java.lang.NullPointerException
       at com.google.dart.compiler.DartCompiler.analyzeLibrary(DartCompiler.java:1204)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:775)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:438)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:93)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:758)
       ... 5 more
Caused by: org.eclipse.core.runtime.CoreException: Failed to parse editor.dart
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:761)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:740)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:704)
       at com.google.dart.tools.ui.internal.text.editor.DartEditor.getAST(DartEditor.java:2010)
       at com.google.dart.tools.ui.internal.text.editor.DartTextHover.getHoverInfo(DartTextHover.java:46)
       at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)
Caused by: java.lang.NullPointerException
       at com.google.dart.compiler.DartCompiler.analyzeLibrary(DartCompiler.java:1204)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:775)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:438)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:93)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:758)
       ... 5 more
!SUBENTRY 1 com.google.dart.tools.core 4 0 2011-12-09 11:57:14.435
!MESSAGE Failed to parse editor.dart
!STACK 0
java.lang.NullPointerException
       at com.google.dart.compiler.DartCompiler.analyzeLibrary(DartCompiler.java:1204)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:775)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:438)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:93)

@bwilkerson
Copy link
Member

Unfortunately, we do not have a test case to reproduce this bug. Nevertheless, I'm hoping to convince you to add guard code to analyzeLibrary. It is possible for the library unit computed by compiler.updateAndResolve() (on line 1197) to be null. The code should guard against this possibility.

The key exception here is:

Caused by: java.lang.NullPointerException
       at com.google.dart.compiler.DartCompiler.analyzeLibrary(DartCompiler.java:1204)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.secureAnalyzeLibrary(DartCompilerUtilities.java:775)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$ResolverRunnable.run(DartCompilerUtilities.java:438)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities$CompilerRunner.runSafe(DartCompilerUtilities.java:93)
       at com.google.dart.tools.core.utilities.compiler.DartCompilerUtilities.resolveUnit(DartCompilerUtilities.java:758)


Removed Area-Editor label.
Added Area-Compiler label.

@DartBot
Copy link

DartBot commented Dec 13, 2011

This comment was originally written by [email protected]


Set owner to [email protected].

@DartBot
Copy link

DartBot commented Dec 14, 2011

This comment was originally written by [email protected]


https://code.google.com/p/dart/source/detail?r=2429


Added Fixed label.

copybara-service bot pushed a commit that referenced this issue Nov 3, 2022
…t, test_process, webdev

Revisions updated by `dart tools/rev_sdk_deps.dart`.

browser_launcher (https://github.com/dart-lang/browser_launcher/compare/981ca88..5fa0bd6):
  5fa0bd6  2022-11-01  Kevin Moore  Update lints, require Dart 2.17, add dependabot (#34)

dartdoc (https://github.com/dart-lang/dartdoc/compare/3273437..179ada0):
  179ada02  2022-11-02  Sam Rawlins  Change _HashableChildLibraryElementVisitor to be a RecursiveElementVisitor (#3242)
  a6e7d908  2022-11-02  Sam Rawlins  Make Inheritable.isOverride late final non-nullable (#3235)
  c4f52cf9  2022-11-02  Sam Rawlins  Test records support in typedefs (#3239)
  f74e129f  2022-11-02  Sam Rawlins  Make Accessor.documentationComment late final non-nullable (#3240)
  ad50bfbc  2022-10-31  dependabot[bot]  Bump github/codeql-action from 2.1.28 to 2.1.29 (#3238)

http (https://github.com/dart-lang/http/compare/738a55b..6339026):
  6339026  2022-11-02  Brian Quinlan  Make timeout and cache controllable per-request. (#815)
  51dbca2  2022-10-31  Brian Quinlan  Add a streaming request example. (#813)

mime (https://github.com/dart-lang/mime/compare/bf041aa..d80f4d0):
  d80f4d0  2022-11-02  Liu YuanYuan  Add .avif to extension map (#70)
  3a6b14e  2022-11-01  dependabot[bot]  Bump actions/checkout from 3.0.2 to 3.1.0 (#72)

string_scanner (https://github.com/dart-lang/string_scanner/compare/10435a4..4a5cbc5):
  4a5cbc5  2022-10-31  Kevin Moore  Make code in readme consistent with example (#49)

test (https://github.com/dart-lang/test/compare/b82fc0b..173a36f):
  173a36f2  2022-11-01  Jacob MacDonald  prep packages to publish (#1780)
  fd8e2b68  2022-10-31  Devon Carew  fix an issue with the github reporter (#1779)

test_process (https://github.com/dart-lang/test_process/compare/068f9f8..1774aa7):
  1774aa7  2022-11-01  dependabot[bot]  Bump actions/checkout from 3.0.2 to 3.1.0 (#36)

webdev (https://github.com/dart-lang/webdev/compare/c350055..069b870):
  069b870  2022-11-01  Elliott Brooks (she/her)  Prepare webdev for release to v.2.7.12 (#1775)
  cb06447  2022-11-01  Elliott Brooks (she/her)  Prep DWDS for release (#1774)
  daa154d  2022-11-01  Elliott Brooks (she/her)  Reset MV3 extension to nice starting point (#1773)
  98a6142  2022-11-01  Jakub Vrána  Remove // ignore: unsafe_html. (#1759)
  939e285  2022-10-31  Elliott Brooks (she/her)  Update documentation for Webdev release process (#1771)
  0428ffb  2022-10-31  Elliott Brooks (she/her)  Update package:file to latest version (#1770)

Change-Id: I5020d718f6c009bca4f9b5e69232dc425b9d3409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267761
Commit-Queue: Kevin Moore <[email protected]>
Reviewed-by: Kevin Moore <[email protected]>
Commit-Queue: Devon Carew <[email protected]>
Auto-Submit: Devon Carew <[email protected]>
copybara-service bot pushed a commit that referenced this issue Nov 27, 2023
…th, watcher

Revisions updated by `dart tools/rev_sdk_deps.dart`.

ecosystem (https://github.com/dart-lang/ecosystem/compare/dda7886..805ab4f):
  805ab4f  2023-11-22  Moritz  Add retries to `pub.dev/api/` calls (#199)
  4cc2cb4  2023-11-20  Devon Carew  add PR stats to the 'bin/report.dart weekly' command (#198)

matcher (https://github.com/dart-lang/matcher/compare/3d03fa1..fcbd361):
  fcbd361  2023-11-21  Nate Bosch  Add more advice away from predicate (#233)

native (https://github.com/dart-lang/native/compare/5dca10e..0051e78):
  0051e78d  2023-11-27  Hossein Yousefi  Generate getters for `static final` strings (#825)
  de505461  2023-11-27  Liam Appelbe  [ffigen] Update the ObjC and swift examples for the v10 code gen (#830)
  c371539d  2023-11-24  Simon Binder  ffigen: Don't generate setters for constant globals (#828)
  13b6b7e7  2023-11-24  Luke Rogers  Fixed a typo in the warn if private log message. (#824)
  9f29edc7  2023-11-21  Prerak Mann  [ffigen] Add config `ignore-source-errors`  (#810)
  6dc1c84c  2023-11-21  Hossein Yousefi  [infra] Add an issue template for jnigen (#820)
  3153a354  2023-11-21  Hossein Yousefi  [jnigen] Fix flaky tests (#814)
  8d4a241c  2023-11-21  Daco Harkes  [native_assets_cli] Add note to bump protocol version (#819)
  6c6a3d6c  2023-11-21  Daco Harkes  [infra] script to change deps to path dependencies (#817)
  893433ee  2023-11-20  Daco Harkes  [infra] Set `breaking-change` to false again (#816)
  992a563f  2023-11-20  Daco Harkes  [infra] Try to use `carryforward` (#815)
  7d9fbf38  2023-11-20  Daco Harkes  [infra] Try fix coveralls (#813)
  44861422  2023-11-20  Hossein Yousefi  [jnigen] Update links and paths to use dart-lang/native (#811)

protobuf (https://github.com/dart-lang/protobuf/compare/dcec2ed..cf43230):
  cf43230  2023-11-23  Ömer Sinan Ağacan  Update getList and getMap return types (#903)
  4e0bdff  2023-11-23  Ömer Sinan Ağacan  Make wrapped lists in PbList monomorphic (#902)

sse (https://github.com/dart-lang/sse/compare/0f6ca11..1df63f2):
  1df63f2  2023-11-21  Kevin Moore  Fix incorrect cast causing wasm failure, prepare v4.1.4 (#96)

test (https://github.com/dart-lang/test/compare/8ba0940..a0a4d1e):
  a0a4d1ee  2023-11-22  Kevin Moore  Update to latest version of lints (#2140)

vector_math (https://github.com/google/vector_math.dart/compare/294896d..e4066cc):
  e4066cc  2023-11-27  Lukas Klingsbo  Some general Vector4 optimizations (#295)
  d340ab0  2023-11-27  Lukas Klingsbo  Some general Vector3 optimizations (#294)
  571d3d0  2023-11-25  Lukas Klingsbo  fix: Revert Vector2 constructor changes (#304)

watcher (https://github.com/dart-lang/watcher/compare/b2b278a..6ac67f1):
  6ac67f1  2023-11-22  Danny Tuppeny  Enable file watcher tests on Windows (#156)

Change-Id: I0014566b05e852099bc4b82f854820e9d9992358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338423
Commit-Queue: Devon Carew <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
This issue was closed.
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

No branches or pull requests

3 participants