Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicating annotations for multiple variables declared on the same line #79

Open
GoogleCodeExporter opened this issue Jul 3, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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 jtha...@cs.washington.edu on 10 Apr 2014 at 5:21

Attachments:

@dbrosoft
Copy link
Contributor

Test FieldMultiple has been corrected and disabled until there is a fix.

@mernst mernst added this to the Medium milestone Jan 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants