this.caseExpression
attribute in CtCase
is no longer needed
#4019
Labels
this.caseExpression
attribute in CtCase
is no longer needed
#4019
Reference: #4015 (comment)
Before Java 12, only one case expression was allowed per case, so spoon maintained an attribute
this.caseExpression
which would store the expression corresponding to the case. Java 12 introduced a feature to add multiple expressions to a single case, sothis.caseExpressions
was introduced, which would contain a list ofCtExpression
s. The second attribute,this.caseExpressions
, madethis.caseExpression
obsolete.I propose that we remove the attribute and modify its getters and setters to, instead, return the list's first element and clear the list and insert a single element, respectively. This would reduce redundancy. Another benefit is that some visitors like
CtScanner
do not even accessthis.caseExpression
. So if someone would have set the case expression usingthis.setCaseExpression
, they won't even see it in their pretty-printed string.The text was updated successfully, but these errors were encountered: