Creating self-closing tag when annotation arguments list is not null, but empty. Added test.

This commit is contained in:
Evgeny Gerashchenko
2012-09-06 20:46:01 +04:00
parent 37ceccb1eb
commit cfb2a511e9
3 changed files with 14 additions and 1 deletions
@@ -607,7 +607,7 @@ public class ExternalAnnotationsManagerImpl extends BaseExternalAnnotationsManag
@NotNull
private static String createAnnotationTag(@NotNull String annotationFQName, @Nullable PsiNameValuePair[] values) {
@NonNls String text;
if (values != null) {
if (values != null && values.length != 0) {
text = " <annotation name=\'" + annotationFQName + "\'>\n";
text += StringUtil.join(values, new Function<PsiNameValuePair, String>() {
@NonNls
@@ -0,0 +1,11 @@
<root>
<item name='p.TestDeannotation java.lang.String get()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='p.TestDeannotation1 java.lang.String get(java.lang.String) 0'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
<item name='p.Test java.lang.String get()'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
</root>
@@ -106,6 +106,8 @@ public class AddAnnotationFixTest extends UsefulTestCase {
final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(psiElement, PsiModifierListOwner.class);
assertNotNull(listOwner);
assertNotNull(ExternalAnnotationsManager.getInstance(project).findExternalAnnotation(listOwner, AnnotationUtil.NOT_NULL));
myFixture.checkResultByFile("content/anno/p/annotations.xml", "content/anno/p/annotationsAnnotateLibrary_after.xml", false);
}
public void testPrimitive() throws Throwable {