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

Deprecate StringConcatenateAssignmentNode #183

Merged
merged 20 commits into from
Mar 23, 2022

Conversation

al3xliu
Copy link
Collaborator

@al3xliu al3xliu commented Feb 27, 2022

No description provided.

tree.getExpression());
Node operNode = new StringConcatenateNode(operTree, targetRHS, value);
extendWithNode(operNode);
AssignmentNode r = new AssignmentNode(tree, targetLHS, operNode);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's rename it to assignNode for consistency

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done.

@zcai1
Copy link
Collaborator

zcai1 commented Feb 28, 2022

Please update the constructor and docs in AssignmentNode, thanks!

Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Please also deprecate the now unused class (and uses) and update the manual.

Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -159,6 +159,7 @@ public R visitBitwiseXor(BitwiseXorNode n, P p) {
}

// Compound assignments
@Deprecated()
Copy link
Member

Choose a reason for hiding this comment

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

Just use @Deprecated, without the empty parenthesis.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@@ -18,6 +18,7 @@
*
* <pre>
* <em>variable</em> = <em>expression</em>
* <em>String variable+</em> = <em>expression</em>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <em>String variable+</em> = <em>expression</em>
* <em>variable</em> += <em>expression</em>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@@ -26,6 +27,8 @@
*
* <p>Some desugarings create additional assignments to synthetic local variables. Such assignment
* nodes are marked as synthetic to allow special handling in transfer functions.
*
* <p>StringConcatenateAssignmentNode is parsed as an Assignment node now.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <p>StringConcatenateAssignmentNode is parsed as an Assignment node now.
* <p>String concatenation compound assignments are desugared to an assignment and a concatenation.

Copy link
Member

Choose a reason for hiding this comment

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

Don't focus on the change, document what is. Don't use a class that doesn't exist anymore in the documentation.
What is the proper term for it?

Copy link
Member

Choose a reason for hiding this comment

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

The examples and this text don't mention that other compound-assignments are also desugared. Might be better to also fix that problem now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

* A node for the string concatenation compound assignment:
*
* <pre>
* @deprecated Use {@code #AssignmentNode()} instead. A node for the string concatenation compound
Copy link
Member

Choose a reason for hiding this comment

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

The @deprecated part is the last thing in the javadoc block, separate from the rest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@@ -13,6 +13,8 @@
import org.checkerframework.dataflow.analysis.RegularTransferResult;
import org.checkerframework.dataflow.analysis.TransferInput;
import org.checkerframework.dataflow.analysis.TransferResult;
// TODO: remove this line after merging StringConcatenateAssignmentNode completely.
import org.checkerframework.dataflow.cfg.node.*;
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, a format check fails because of this.
Is there no cleaner way to suppress the deprecation warning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@@ -9,7 +9,6 @@ void test1() {
String local = null;
// There was a bug in data flow where
// the type of local was @H1Bot @H2Bot after this
// StringConcatenateAssignmentNode,
Copy link
Member

Choose a reason for hiding this comment

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

The sentence doesn't make sense if you remove the class name. What is this saying?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed.

@wmdietl wmdietl assigned al3xliu and unassigned al3xliu Mar 9, 2022
Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Please add a notice in docs/CHANGELOG.md under Implementation details.

Adding SKIP-REQUIRE-JAVADOC for this PR is fine, we don't want to document NodeVisitor here.

@@ -1344,7 +1338,8 @@ \subsubsection{Desugaring}

\item Once we decided to make conversion nodes explicit it made
sense to desugar compound assignments. A compound assignment
like \begin{verbatim}Integer i; i += 3;\end{verbatim} performs
like \begin{verbatim}Integer i; i += 3;\end{verbatim} or
\begin{verbatim}String s; s += "a";\end{verbatim} performs
Copy link
Member

Choose a reason for hiding this comment

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

This sentence talks about boxing of i, which doesn't make sense in the string example.
Maybe string compound concatenation should be a separate item in this list?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, will start a new item here, I think it is a suitable place.

Comment on lines 34 to 35
* <p>Number concatenation compound assignments are desugared to an assignment and a number
* concatenation.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <p>Number concatenation compound assignments are desugared to an assignment and a number
* concatenation.
* <p>Numeric concatenation compound assignments are desugared to an assignment and a numeric
* concatenation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks!

@@ -15,7 +15,10 @@
* <pre>
* <em>variable</em> += <em>expression</em>
* </pre>
*
* @deprecated Use {@code #AssignmentNode()} instead.
Copy link
Member

Choose a reason for hiding this comment

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

Nobody has to use AssignmentNode instead and this seems like a reference to a constructor, which doesn't exist in this class. Say that StringConcatenateAssignmentNode isn't generated any more in CFGs and that instead an assignment and concatenation is generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, thanks!

Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks! A few small things left.

Comment on lines 1343 to 1350
all compound assignments greatly reduced the total number of
node classes.

\item Also, we desugared string concatenation assignments. A string
concatenation assignment like \begin{verbatim}String s; s += "str";
\end{verbatim} is represented as \begin{verbatim}String s; s = s + "str";
\end{verbatim} in CFGs.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
all compound assignments greatly reduced the total number of
node classes.
\item Also, we desugared string concatenation assignments. A string
concatenation assignment like \begin{verbatim}String s; s += "str";
\end{verbatim} is represented as \begin{verbatim}String s; s = s + "str";
\end{verbatim} in CFGs.
all compound assignments greatly reduced the total number of
node classes.
\item String concatenation assignments are also desugared. A string
concatenation assignment like
\begin{verbatim}String s; s += "str";\end{verbatim} is represented as
\begin{verbatim}String s; s = s + "str";\end{verbatim} in CFGs.
This avoids duplicating the same logic that is necessary in assignment
and concatenation nodes, which was error prone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done.

Comment on lines 34 to 35
* <p>Numeric concatenation compound assignments are desugared to an assignment and a numeric
* concatenation.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <p>Numeric concatenation compound assignments are desugared to an assignment and a numeric
* concatenation.
* <p>Numeric compound assignments are desugared to an assignment and a numeric operation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done.

Comment on lines 19 to 20
* @deprecated StringConcatenateAssignmentNode is not generated anymore in CFG nodes, and that
* instead an assignment and concatenation is generated.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @deprecated StringConcatenateAssignmentNode is not generated anymore in CFG nodes, and that
* instead an assignment and concatenation is generated.
* @deprecated StringConcatenateAssignmentNode is no longer used in CFGs.
* Instead, an assignment and a concatenation node are generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done.

Comment on lines 16 to 17
`CFGTranslationPhaseOne` now generates an assignment and concatenation instead.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`CFGTranslationPhaseOne` now generates an assignment and concatenation instead.
`CFGTranslationPhaseOne` now generates an assignment and a concatenation node instead.
This avoids error prone duplication of logic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done.

@@ -12,6 +12,9 @@ Changed `CFAbstractTransfer.insertIntoStores` from public to protected
visibility. It is only meant as a utility method for use within a
transfer function.

Deprecated class `StringConcatenateAssignmentNode` and its related usage.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Deprecated class `StringConcatenateAssignmentNode` and its related usage.
Deprecated class `StringConcatenateAssignmentNode` and its usages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, done.

@wmdietl wmdietl changed the title Remove StringConcatenateAssignmentNode Deprecate StringConcatenateAssignmentNode Mar 23, 2022
Copy link
Member

@wmdietl wmdietl left a comment

Choose a reason for hiding this comment

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

Thanks!

@wmdietl wmdietl enabled auto-merge (squash) March 23, 2022 18:16
@wmdietl wmdietl merged commit 605eb41 into eisop:master Mar 23, 2022
al3xliu added a commit to al3xliu/checker-framework that referenced this pull request Mar 27, 2022
al3xliu added a commit to al3xliu/checker-framework that referenced this pull request Mar 28, 2022
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