IJ-CR-95222 Add testdata

GitOrigin-RevId: e27404aae9ffba6b130397df05f818877082d7af
This commit is contained in:
Kirill Smelov
2022-10-05 11:15:53 +02:00
committed by intellij-monorepo-bot
parent 07c36ffcd9
commit 8ef6e27839
3 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
public class Map extends com.intellij.codeInspection.LocalQuickFix {
java.util.Map<com.intellij.psi.PsiElement, com.intellij.psi.PsiElement> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">pe</warning>;
java.util.Map<com.intellij.psi.PsiReference, com.intellij.psi.PsiElement> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">r</warning>;
java.util.Map<java.util.Map<com.intellij.psi.PsiReference, com.intellij.psi.PsiReference>, com.intellij.psi.PsiReference> <warning descr="Do not use PsiReference as a field in quick fix">r1</warning>;
java.util.Map r2;
java.util.Map<Integer, Long> r3;
java.util.Collection<java.util.Map<com.intellij.psi.PsiElement, com.intellij.psi.PsiElement>> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">r4</warning>;
java.util.Map<com.intellij.psi.PsiElement, Long> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">r7</warning>;
java.util.Map<Integer, com.intellij.psi.PsiElement> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">r8</warning>;
}

View File

@@ -0,0 +1,9 @@
public class Ref extends com.intellij.codeInspection.LocalQuickFix {
com.intellij.openapi.util.Ref<com.intellij.psi.PsiElement> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">pe</warning>;
com.intellij.openapi.util.Ref<com.intellij.psi.PsiReference> <warning descr="Do not use PsiReference as a field in quick fix">r</warning>;
com.intellij.openapi.util.Ref<com.intellij.openapi.util.Ref<com.intellij.psi.PsiReference>> <warning descr="Do not use PsiReference as a field in quick fix">r1</warning>;
com.intellij.openapi.util.Ref r2;
com.intellij.openapi.util.Ref<Integer> r3;
com.intellij.openapi.util.Ref<com.intellij.openapi.util.Ref<com.intellij.psi.PsiElement>> <warning descr="Potential memory leak: don't hold PsiElement, use SmartPsiElementPointer instead See also LocalQuickFixOnPsiElement">r4</warning>;
com.intellij.openapi.project.Project <warning descr="Do not use Project as a field in quick fix">p</warning>;
}

View File

@@ -19,6 +19,7 @@ public class StatefulEpInspectionTest extends PluginModuleTestCase {
myFixture.addClass("package com.intellij.psi; public class PsiReference {}");
myFixture.addClass("package com.intellij.codeInspection; public class LocalQuickFix {}");
myFixture.addClass("package com.intellij.openapi.components; public interface ProjectComponent {}");
myFixture.addClass("package com.intellij.openapi.util; public class Ref<T> {}");
myFixture.enableInspections(new StatefulEpInspection());
}
@@ -63,4 +64,12 @@ public class StatefulEpInspectionTest extends PluginModuleTestCase {
public void testCollection() {
myFixture.testHighlighting("Collection.java");
}
public void testMap() {
myFixture.testHighlighting("Map.java");
}
public void testRef() {
myFixture.testHighlighting("Ref.java");
}
}