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: derived properties return unmodifiable collections #1923

Merged
merged 1 commit into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
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 @@ -76,7 +76,7 @@ public List<CtAnonymousExecutable> getAnonymousExecutables() {
anonymousExecutables.add((CtAnonymousExecutable) typeMember);
}
}
return anonymousExecutables;
return Collections.unmodifiableList(anonymousExecutables);
}

@Override
Expand Down Expand Up @@ -107,7 +107,7 @@ public Set<CtConstructor<T>> getConstructors() {
constructors.add((CtConstructor<T>) typeMember);
}
}
return constructors;
return Collections.unmodifiableSet(constructors);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public List<CtField<?>> getFields() {
List<CtField<?>> result = new ArrayList<>();
result.addAll(getEnumValues());
result.addAll(super.getFields());
return result;
return Collections.unmodifiableList(result);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public List<CtField<?>> getFields() {
fields.add((CtField<?>) typeMember);
}
}
return fields;
return Collections.unmodifiableList(fields);
}

@Override
Expand Down Expand Up @@ -457,7 +457,7 @@ public Set<CtType<?>> getNestedTypes() {
nestedTypes.add((CtType<?>) typeMember);
}
}
return nestedTypes;
return Collections.unmodifiableSet(nestedTypes);
}

@Override
Expand Down Expand Up @@ -828,7 +828,7 @@ public Set<CtMethod<?>> getMethods() {
methods.add((CtMethod<?>) typeMember);
}
}
return methods;
return Collections.unmodifiableSet(methods);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public CtTypeReference<?> getSuperclass() {
public Set<CtTypeReference<?>> getSuperInterfaces() {
CtType<?> t = getDeclaration();
if (t != null) {
return t.getSuperInterfaces();
return Collections.unmodifiableSet(t.getSuperInterfaces());
} else {
Class<?> c = getActualClass();
Class<?>[] sis = c.getInterfaces();
Expand All @@ -518,7 +518,7 @@ public Set<CtTypeReference<?>> getSuperInterfaces() {
for (Class<?> si : sis) {
set.add(getFactory().Type().createReference(si));
}
return set;
return Collections.unmodifiableSet(set);
}
}
return Collections.emptySet();
Expand Down