better nullability

This commit is contained in:
Egor.Ushakov
2017-01-24 18:54:58 +03:00
parent 729b9f8b7b
commit 66e4979f43
2 changed files with 13 additions and 11 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -86,7 +86,7 @@ public class JavaStackFrame extends XStackFrame {
myEqualityObject = update ? NodeManagerImpl.getContextKeyForFrame(myDescriptor.getFrameProxy()) : null;
myDebugProcess = ((DebugProcessImpl)descriptor.getDebugProcess());
myNodeManager = myDebugProcess.getXdebugProcess().getNodeManager();
myXSourcePosition = myDescriptor.getSourcePosition() != null ? DebuggerUtilsEx.toXSourcePosition(myDescriptor.getSourcePosition()) : null;
myXSourcePosition = DebuggerUtilsEx.toXSourcePosition(myDescriptor.getSourcePosition());
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -716,15 +716,17 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
}
@Nullable
public static XSourcePosition toXSourcePosition(@NotNull SourcePosition position) {
VirtualFile file = position.getFile().getVirtualFile();
if (file == null) {
file = position.getFile().getOriginalFile().getVirtualFile();
public static XSourcePosition toXSourcePosition(@Nullable SourcePosition position) {
if (position != null) {
VirtualFile file = position.getFile().getVirtualFile();
if (file == null) {
file = position.getFile().getOriginalFile().getVirtualFile();
}
if (file != null) {
return new JavaXSourcePosition(position, file);
}
}
if (file == null) {
return null;
}
return new JavaXSourcePosition(position, file);
return null;
}
private static class JavaXSourcePosition implements XSourcePosition, ExecutionPointHighlighter.HighlighterProvider {