From 4e2c4100d92b9eb5b0bb933c005a72c339c2ec9d Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 18 Sep 2018 14:16:06 +0200 Subject: [PATCH] mark PsiSubstitutor methods as pure to highlight unused results --- .../src/com/intellij/psi/PsiSubstitutor.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java b/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java index 2b8817632f1e..e5a891523ffb 100644 --- a/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java +++ b/java/java-psi-api/src/com/intellij/psi/PsiSubstitutor.java @@ -17,6 +17,7 @@ package com.intellij.psi; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.KeyWithDefaultValue; +import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,6 +51,7 @@ public interface PsiSubstitutor { * @return the mapping for the type parameter, or {@code null} for a raw type. */ @Nullable + @Contract(pure = true) PsiType substitute(@NotNull PsiTypeParameter typeParameter); /** @@ -59,10 +61,12 @@ public interface PsiSubstitutor { * @param type the type to substitute the type parameters for. * @return the result of the substitution. */ + @Contract(pure = true) PsiType substitute(@Nullable PsiType type); //Should be used with great care, be sure to prevent infinite recursion that could arise // from the use of recursively bounded type parameters + @Contract(pure = true) PsiType substituteWithBoundsPromotion(@NotNull PsiTypeParameter typeParameter); /** @@ -74,6 +78,7 @@ public interface PsiSubstitutor { * @return the new substitutor instance. */ @NotNull + @Contract(pure = true) PsiSubstitutor put(@NotNull PsiTypeParameter classParameter, PsiType mapping); /** @@ -85,6 +90,7 @@ public interface PsiSubstitutor { * @return the new substitutor instance. */ @NotNull + @Contract(pure = true) PsiSubstitutor putAll(@NotNull PsiClass parentClass, PsiType[] mappings); /** @@ -95,6 +101,7 @@ public interface PsiSubstitutor { * @return the new substitutor instance. */ @NotNull + @Contract(pure = true) PsiSubstitutor putAll(@NotNull PsiSubstitutor another); /** @@ -103,6 +110,7 @@ public interface PsiSubstitutor { * @return the substitution map instance. */ @NotNull + @Contract(pure = true) Map getSubstitutionMap(); /** @@ -111,6 +119,7 @@ public interface PsiSubstitutor { * @return true if all types are valid, false otherwise. * @see PsiType#isValid() */ + @Contract(pure = true) boolean isValid(); /**