mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
Fixed bug on deannotating: when annotation tag removed, parent is also removed if the latter has no children. Added test.
This commit is contained in:
@@ -367,11 +367,11 @@ public class ExternalAnnotationsManagerImpl extends BaseExternalAnnotationsManag
|
||||
return processExistingExternalAnnotations(listOwner, annotationFQN, new Processor<XmlTag>() {
|
||||
@Override
|
||||
public boolean process(XmlTag annotationTag) {
|
||||
annotationTag.delete();
|
||||
PsiElement parent = annotationTag.getParent();
|
||||
annotationTag.delete();
|
||||
if (parent instanceof XmlTag) {
|
||||
if (((XmlTag)parent).getSubTags().length == 0) {
|
||||
annotationTag.delete();
|
||||
parent.delete();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='p.TestDeannotation java.lang.String get()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<root>
|
||||
<item name='p.TestDeannotation1 java.lang.String get(java.lang.String) 0'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
</root>
|
||||
@@ -137,12 +137,14 @@ public class AddAnnotationFixTest extends UsefulTestCase {
|
||||
addLibrary();
|
||||
myFixture.configureByFiles("lib/p/TestPrimitive.java", "content/anno/p/annotations.xml");
|
||||
doDeannotate("lib/p/TestDeannotation.java", "Annotate method 'get' as @NotNull", "Annotate method 'get' as @Nullable");
|
||||
myFixture.checkResultByFile("content/anno/p/annotations.xml", "content/anno/p/annotationsDeannotation_after.xml", false);
|
||||
}
|
||||
|
||||
public void testDeannotation1() throws Throwable {
|
||||
addLibrary();
|
||||
myFixture.configureByFiles("lib/p/TestPrimitive.java", "content/anno/p/annotations.xml");
|
||||
doDeannotate("lib/p/TestDeannotation1.java", "Annotate parameter 'ss' as @NotNull", "Annotate parameter 'ss' as @Nullable");
|
||||
myFixture.checkResultByFile("content/anno/p/annotations.xml", "content/anno/p/annotationsDeannotation1_after.xml", false);
|
||||
}
|
||||
|
||||
private void doDeannotate(@NonNls final String testPath, String hint1, String hint2) throws Throwable {
|
||||
|
||||
Reference in New Issue
Block a user