-
Notifications
You must be signed in to change notification settings - Fork 34
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
insert-annotations-to-source
inserting annotations from Constructor at the field where it was non-present
#216
Comments
/cc @mernst |
insert-annotations-to-source
) transferring/inserting non-present @SideEffectFreeinsert-annotations-to-source
) transferring/inserting non-present @SideEffectFree
insert-annotations-to-source
) transferring/inserting non-present @SideEffectFreeinsert-annotations-to-source
inserting non-present @SideEffectFree on a field
Could you please minimize the test case? |
insert-annotations-to-source
inserting non-present @SideEffectFree on a fieldinsert-annotations-to-source
inserting non-present modifier and @SideEffectFree at the wrong location
insert-annotations-to-source
inserting non-present modifier and @SideEffectFree at the wrong locationinsert-annotations-to-source
inserting @SideEffectFree at the wrong location
Done Thanks. |
insert-annotations-to-source
inserting @SideEffectFree at the wrong locationinsert-annotations-to-source
inserting Annotations on Constructor at the field where it was non-present
insert-annotations-to-source
inserting Annotations on Constructor at the field where it was non-presentinsert-annotations-to-source
inserting annotations from Constructor at the field where it was non-present
This is a very useful minimization! Thanks. |
Thanks for the feedback. |
I saw your message after I had started to work on the issue (because I didn't want you to get blocked). |
Thank you very much for fixing the bug. |
This is till present in field that are initialized at definition. To reproduce:Test.java(Annotated) import org.checkerframework.dataflow.qual.SideEffectFree;
class Test {
Object value;
Object value2= new Object();
@SideEffectFree
public Test(){
}
}
Test.jaif
Test.java(Unannotated) class Test {
Object value;
Object value2= new Object();
public Test(){
}
}
Result import org.checkerframework.dataflow.qual.SideEffectFree;
class Test {
Object value;
Object value2= new @SideEffectFree Object();
public Test(){
}
} |
/cc @mernst |
@mernst This is still present for the following: To reproduce:Test.java(Annotated) import org.checkerframework.dataflow.qual.SideEffectFree;
public class Test {
Test t = this;
@SideEffectFree
public Test() {}
}
Test.jaif
Test.java(Unannotated) public class Test {
Test t = this;
public Test() {}
}
Result import org.checkerframework.dataflow.qual.SideEffectFree;
public class Test {
Test t = @SideEffectFree this;
public Test() {}
} |
@mernst New full Test-Case To reproduce:Test.java(Annotated) import org.checkerframework.dataflow.qual.SideEffectFree;
public class Test {
Object[] stackTrace = new Object[0];
Object value;
Object value2= new Object();
Test t = this;
@SideEffectFree
public Test() {
}
}
Test.jaif
Test.java(Unannotated) public class Test {
Object[] stackTrace = new Object [0];
Object value;
Object value2= new Object();
Test t = this;
public Test() {
}
}
Result import org.checkerframework.dataflow.qual.SideEffectFree;
public class Test {
Object[] stackTrace = new Object @SideEffectFree [0];
Object value;
Object value2= new Object();
Test t = this;
public Test() {
}
} |
This last variant is hard to fix. The others could be worked around, but this exposes the fundamentally bad design of having a set of |
insert-annotation-to-source
is inserting annotation that was present on Constructors to field where is was non-present."Step to reproduce" uses
@SideEffectFree
but using@RequiresNonNull
or@Deprecated
instead of@SideEffectFree
also yields the same result i.e. Annotation at the wrong place. This means this bug is not isolated to just@SideEffectFree
To reproduce:
Test.java(Annotated)
Test.jaif
Test.java(Unannotated)
Result
Note:- This problem is only caused if
@SideEffectFree
is on Constructor. That is if there is@SideEffectFree
on method there will be no error.Example: (There will be no error in this case)
The text was updated successfully, but these errors were encountered: