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

Annotation-tools cannot insert anno to array variable with initializer #22

Open
lnsun opened this issue Apr 12, 2021 · 0 comments
Open

Comments

@lnsun
Copy link
Member

lnsun commented Apr 12, 2021

Annotation-tools cannot insert annotation to array variable with initializer, when the enclosing class is not the first in the file.

Java source:

class MyA {
}

class List{
    List() {
        Object[] t = new Object[10];
    }
}

Minimized JAIF:

package qual:
  annotation @Immutable:

package :
class List:

method <init>()V:
insert-annotation Method.body, Block.statement 0, Variable.type, ArrayType.type: @qual.Immutable
insert-annotation Method.body, Block.statement 0, Variable.initializer, NewArray.type 0: @qual.Immutable
insert-annotation Method.body, Block.statement 0, Variable.type: @qual.Immutable

The output does not contain any annotation after running insert-annotations-to-source, with a warning:

Warning: IndexFileSpecification did not find classfile for: List

Expected output:

class MyA {
}

class List{
    List() {
        @Immutable Object @Immutable [] t = new @Immutable Object[10];
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant