summaryrefslogtreecommitdiff
path: root/platform/core-api/src/com/intellij/psi
diff options
context:
space:
mode:
Diffstat (limited to 'platform/core-api/src/com/intellij/psi')
-rw-r--r--platform/core-api/src/com/intellij/psi/PsiElementResolveResult.java2
-rw-r--r--platform/core-api/src/com/intellij/psi/PsiFileFactory.java4
-rw-r--r--platform/core-api/src/com/intellij/psi/PsiWalkingState.java7
-rw-r--r--platform/core-api/src/com/intellij/psi/ReferenceRange.java15
4 files changed, 19 insertions, 9 deletions
diff --git a/platform/core-api/src/com/intellij/psi/PsiElementResolveResult.java b/platform/core-api/src/com/intellij/psi/PsiElementResolveResult.java
index 205bf27fe1c0..4a2343ce2983 100644
--- a/platform/core-api/src/com/intellij/psi/PsiElementResolveResult.java
+++ b/platform/core-api/src/com/intellij/psi/PsiElementResolveResult.java
@@ -87,7 +87,7 @@ public class PsiElementResolveResult implements ResolveResult{
}
@NotNull
- public static ResolveResult[] createResults(@Nullable PsiElement[] elements) {
+ public static ResolveResult[] createResults(@Nullable PsiElement... elements) {
if (elements == null || elements.length == 0) return EMPTY_ARRAY;
final ResolveResult[] results = new ResolveResult[elements.length];
diff --git a/platform/core-api/src/com/intellij/psi/PsiFileFactory.java b/platform/core-api/src/com/intellij/psi/PsiFileFactory.java
index b31c03b6640a..e77ed1c3a4fb 100644
--- a/platform/core-api/src/com/intellij/psi/PsiFileFactory.java
+++ b/platform/core-api/src/com/intellij/psi/PsiFileFactory.java
@@ -63,6 +63,10 @@ public abstract class PsiFileFactory {
public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text);
+ public PsiFile createFileFromText(@NotNull Language language, @NotNull CharSequence text) {
+ return createFileFromText("foo.bar", language, text);
+ }
+
public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text,
boolean eventSystemEnabled, boolean markAsCopy);
diff --git a/platform/core-api/src/com/intellij/psi/PsiWalkingState.java b/platform/core-api/src/com/intellij/psi/PsiWalkingState.java
index b6207e8bf364..6418a0b60804 100644
--- a/platform/core-api/src/com/intellij/psi/PsiWalkingState.java
+++ b/platform/core-api/src/com/intellij/psi/PsiWalkingState.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -52,7 +52,10 @@ public abstract class PsiWalkingState extends WalkingState<PsiElement> {
}
protected PsiWalkingState(@NotNull PsiElementVisitor delegate) {
- super(PsiTreeGuide.instance);
+ this(delegate, PsiTreeGuide.instance);
+ }
+ protected PsiWalkingState(@NotNull PsiElementVisitor delegate, @NotNull TreeGuide<PsiElement> guide) {
+ super(guide);
myVisitor = delegate;
}
diff --git a/platform/core-api/src/com/intellij/psi/ReferenceRange.java b/platform/core-api/src/com/intellij/psi/ReferenceRange.java
index cfb1f49a71e7..1ac18336abcb 100644
--- a/platform/core-api/src/com/intellij/psi/ReferenceRange.java
+++ b/platform/core-api/src/com/intellij/psi/ReferenceRange.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -20,6 +20,7 @@
package com.intellij.psi;
import com.intellij.openapi.util.TextRange;
+import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collections;
@@ -29,14 +30,16 @@ public class ReferenceRange {
private ReferenceRange() {
}
- public static List<TextRange> getRanges(PsiReference ref) {
+ @NotNull
+ public static List<TextRange> getRanges(@NotNull PsiReference ref) {
if (ref instanceof MultiRangeReference) {
return ((MultiRangeReference)ref).getRanges();
}
return Collections.singletonList(ref.getRangeInElement());
}
- public static List<TextRange> getAbsoluteRanges(PsiReference ref) {
+ @NotNull
+ public static List<TextRange> getAbsoluteRanges(@NotNull PsiReference ref) {
final PsiElement elt = ref.getElement();
final List<TextRange> relativeRanges = getRanges(ref);
final List<TextRange> answer = new ArrayList<TextRange>(relativeRanges.size());
@@ -47,7 +50,7 @@ public class ReferenceRange {
return answer;
}
- public static TextRange getRange(PsiReference ref) {
+ public static TextRange getRange(@NotNull PsiReference ref) {
if (ref instanceof MultiRangeReference) {
final List<TextRange> ranges = ((MultiRangeReference)ref).getRanges();
return new TextRange(ranges.get(0).getStartOffset(), ranges.get(ranges.size() - 1).getEndOffset());
@@ -56,7 +59,7 @@ public class ReferenceRange {
return ref.getRangeInElement();
}
- public static boolean containsOffsetInElement(PsiReference ref, int offset) {
+ public static boolean containsOffsetInElement(@NotNull PsiReference ref, int offset) {
if (ref instanceof MultiRangeReference) {
for (TextRange range : ((MultiRangeReference)ref).getRanges()) {
if (range.containsOffset(offset)) return true;
@@ -68,7 +71,7 @@ public class ReferenceRange {
return rangeInElement != null && rangeInElement.containsOffset(offset);
}
- public static boolean containsRangeInElement(PsiReference ref, TextRange rangeInElement) {
+ public static boolean containsRangeInElement(@NotNull PsiReference ref, @NotNull TextRange rangeInElement) {
if (ref instanceof MultiRangeReference) {
for (TextRange range : ((MultiRangeReference)ref).getRanges()) {
if (range.contains(rangeInElement)) return true;