XSourcePosition (@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); } } return null; }