[JBoss JIRA] (ROASTER-120) AnnotationImpl.getStringArrayValue() returns wrong value
by seven332 seven332 (JIRA)
[ https://issues.jboss.org/browse/ROASTER-120?page=com.atlassian.jira.plugi... ]
seven332 seven332 updated ROASTER-120:
--------------------------------------
Steps to Reproduce:
{code:java}
@Retention(RetentionPolicy.RUNTIME)
public @interface Test {
String[] test();
}
{code}
{code:java}
@Test (
test = {}
)
public class AnnotationTest {
public AnnotationTest() {}
}
{code}
{code:java}
public class Main {
public static void main(String[] args) throws IOException {
Test t = AnnotationTest.class.getAnnotation(Test.class);
String[] test1 = t.test();
System.out.println(test1.length);
JavaClassSource clazz = Roaster.parse(JavaClassSource.class, new File("path/to/AnnotationTest.java"));
Annotation a = clazz.getAnnotation(Test.class);
String[] test2 = a.getStringArrayValue("test");
System.out.println(test2.length);
if (test2.length > 0) {
System.out.println(test2[0].length());
}
}
}
{code}
Output:
0
1
0
Should be:
0
0
was:
{code:java}
@Retention(RetentionPolicy.RUNTIME)
public @interface Test {
String[] test();
}
{code}
{code:java}
@Test (
test = {}
)
public class AnnotationTest {
public AnnotationTest() {}
}
{code}
{code:java}
public class Main {
public static void main(String[] args) throws IOException {
Test t = AnnotationTest.class.getAnnotation(Test.class);
String[] test1 = t.test();
System.out.println(test1.length);
JavaClassSource clazz = Roaster.parse(JavaClassSource.class, new File("path/to/AnnotationTest.java"));
Annotation a = clazz.getAnnotation(Test.class);
String[] test2 = a.getStringArrayValue("test");
System.out.println(test2.length);
if (test2.length > 0) {
System.out.println(test2[0].length());
}
}
}
{code}
Output:
0
1
0
Should be:
0
> AnnotationImpl.getStringArrayValue() returns wrong value
> --------------------------------------------------------
>
> Key: ROASTER-120
> URL: https://issues.jboss.org/browse/ROASTER-120
> Project: Roaster
> Issue Type: Bug
> Components: JDT
> Affects Versions: 2.19.5.Final
> Reporter: seven332 seven332
>
> AnnotationImpl.getStringArrayValue() treats {} as an array with an empty string.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)