Skip to content

Conversation

@t-rasmud
Copy link
Owner

@t-rasmud t-rasmud commented Dec 6, 2020

This PR adds an annotation @SideEffectsOnly to the set of dataflow qualifiers. For a method with this annotation, dataflow analysis unrefines just those expressions that are specified as annotation values of @SideEffectsOnly instead of the more conservative alternative of unrefining all expressions.

Copy link
Collaborator

@mernst mernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this pull request is doing. Could you please clarify?

@mernst mernst assigned t-rasmud and unassigned mernst Feb 28, 2021
@t-rasmud
Copy link
Owner Author

The @SideEffectsOnly makes a claim that the body of the annotated method only mutates certain values. The checker ought to issue a warning if @SideEffectsOnly is written on a method that makes more changes than the annotation permits.

Added this check in the latest commit.

@t-rasmud t-rasmud assigned mernst and unassigned t-rasmud Oct 21, 2021
Copy link
Collaborator

@mernst mernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this code. I have a few questions and suggestions.

* For methods annotated with {@link SideEffectsOnly}, computes expressions that are side-effected
* but not permitted by the annotation.
*/
public class SideEffectsOnlyAnnoChecker {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why this is a brand-new class rather than a modification to the existing mutation checker.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware of a mutation checker and couldn’t find it in the manual either. Could you please point me to that class?
Although I think the PurityChecker can be modified to add all the functionality in the SideEffectsOnlyAnnoChecker. Do you think that's more appropriate?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By "mutation checker" I meant PurityChecker. I'm sorry for being sloppy in my terminology. Thank you for setting me straight. Yes, I was thinking that merging the functionality in one place (maybe controlled by a switch) would be shorter, easier to understand, and less prone to code drift, compared to the two separate implementations. At least, I think that is worth trying to see whether it works out.

Thank you!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestions. I tried merging the two functionalities into PurityChecker but wasn’t successful because of the following reason:
SideEffectsOnlyAnnoChecker (a part of the Checker Framework repository) needs to import org.checkerframework.common.basetype.BaseTypeChecker, which is not visible in the dataflow project (dataflow project contains the PurityChecker). Is there any other way around this?

@mernst mernst assigned t-rasmud and unassigned mernst Oct 27, 2021
@t-rasmud
Copy link
Owner Author

Thanks for the feedback Mike. I just have one question regarding your comment about the mutation checker.

@t-rasmud t-rasmud assigned mernst and unassigned t-rasmud Nov 11, 2021
@mernst mernst assigned t-rasmud and unassigned mernst Nov 11, 2021
@t-rasmud t-rasmud assigned mernst and unassigned t-rasmud Nov 23, 2021
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

Successfully merging this pull request may close these issues.

3 participants