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

fix: CtExpressionImpl#setTypeCasts(null) calls change listener now #2612

Merged
merged 1 commit into from
Oct 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ public <C extends CtTypedElement> C setType(CtTypeReference<T> type) {

@Override
public <C extends CtExpression<T>> C setTypeCasts(List<CtTypeReference<?>> casts) {
getFactory().getEnvironment().getModelChangeListener().onListDeleteAll(this, CAST, this.typeCasts, new ArrayList<>(this.typeCasts));
if (casts == null || casts.isEmpty()) {
this.typeCasts = CtElementImpl.emptyList();
return (C) this;
}
if (this.typeCasts == CtElementImpl.<CtTypeReference<?>>emptyList()) {
this.typeCasts = new ArrayList<>(CASTS_CONTAINER_DEFAULT_CAPACITY);
}
getFactory().getEnvironment().getModelChangeListener().onListDeleteAll(this, CAST, this.typeCasts, new ArrayList<>(this.typeCasts));
this.typeCasts.clear();
for (CtTypeReference<?> cast : casts) {
addTypeCast(cast);
Expand Down