You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given the following foo.jaif (attached):
---------------------------------------
package java.lang:
annotation @SuppressWarnings:
String[] value
package pkg:
class foo:
field a: @SuppressWarnings({"bar"})
field b: @SuppressWarnings({"bar"})
---------------------------------------
and the following pkg/foo.java (attached):
---------------------------------------
package pkg;
public class foo
{
volatile int a, b;
}
---------------------------------------
I would expect the call to
insert-annotations-to-source -i foo.jaif pkg/foo.java
(synced on April 2, 2014 and run on Fedora 19 64-bit)
to produce
----------------------------------
package pkg;
import java.lang.SuppressWarnings;
public class foo
{
@SuppressWarnings({"bar"})
volatile int a, b;
}
----------------------------------
Instead, the following output is produced, which results in the following
compilation error:
"foo.java:6: error: duplicate annotation"
------------------------------------------------------------------------
package pkg;
import java.lang.SuppressWarnings;
public class foo
{
volatile @SuppressWarnings({"bar"}) @SuppressWarnings({"bar"}) int a, b;
}
------------------------------------------------------------------------
Original issue reported on code.google.com by [email protected] on 10 Apr 2014 at 5:21
Naturally we should also check that non-duplicate annotations, such as
field a: @SuppressWarnings({"a"})
field b: @SuppressWarnings({"b"})
are not all concatenated at the beginning of the line as follows
volatile @SuppressWarnings({"a"}) @SuppressWarnings({"b"}) int a, b;
Note that even if only a single annotation is added, the multiple declarations
must be split up.
If we have:
Object a, b;
Adding an annotation to a should give:
@TA Object a;
Object b;
Otherwise, the type of variable b would be changed by the change to a.
Original issue reported on code.google.com by
[email protected]
on 10 Apr 2014 at 5:21Attachments:
The text was updated successfully, but these errors were encountered: