-
Notifications
You must be signed in to change notification settings - Fork 19
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
Conversation
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Show resolved
Hide resolved
tree.getExpression()); | ||
Node operNode = new StringConcatenateNode(operTree, targetRHS, value); | ||
extendWithNode(operNode); | ||
AssignmentNode r = new AssignmentNode(tree, targetLHS, operNode); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
Please update the constructor and docs in |
There was a problem hiding this 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.
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
dataflow/src/main/java/org/checkerframework/dataflow/cfg/builder/CFGTranslationPhaseOne.java
Show resolved
Hide resolved
@@ -159,6 +159,7 @@ public R visitBitwiseXor(BitwiseXorNode n, P p) { | |||
} | |||
|
|||
// Compound assignments | |||
@Deprecated() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <em>String variable+</em> = <em>expression</em> | |
* <em>variable</em> += <em>expression</em> |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <p>StringConcatenateAssignmentNode is parsed as an Assignment node now. | |
* <p>String concatenation compound assignments are desugared to an assignment and a concatenation. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.*; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
There was a problem hiding this 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.
dataflow/manual/content.tex
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
* <p>Number concatenation compound assignments are desugared to an assignment and a number | ||
* concatenation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks!
There was a problem hiding this 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.
dataflow/manual/content.tex
Outdated
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. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
* <p>Numeric concatenation compound assignments are desugared to an assignment and a numeric | ||
* concatenation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* <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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
* @deprecated StringConcatenateAssignmentNode is not generated anymore in CFG nodes, and that | ||
* instead an assignment and concatenation is generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
...ow/src/main/java/org/checkerframework/dataflow/cfg/node/StringConcatenateAssignmentNode.java
Outdated
Show resolved
Hide resolved
docs/CHANGELOG.md
Outdated
`CFGTranslationPhaseOne` now generates an assignment and concatenation instead. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
docs/CHANGELOG.md
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecated class `StringConcatenateAssignmentNode` and its related usage. | |
Deprecated class `StringConcatenateAssignmentNode` and its usages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
dataflow/src/main/java/org/checkerframework/dataflow/cfg/node/NodeVisitor.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/common/value/ValueTransfer.java
Outdated
Show resolved
Hide resolved
framework/src/main/java/org/checkerframework/framework/flow/CFAbstractTransfer.java
Outdated
Show resolved
Hide resolved
dataflow/src/main/java/org/checkerframework/dataflow/cfg/node/AbstractNodeVisitor.java
Outdated
Show resolved
Hide resolved
dataflow/src/main/java/org/checkerframework/dataflow/cfg/node/NodeVisitor.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
No description provided.