| Summary: | Redundant caching call in DefaultOppositeEndFinder | ||
|---|---|---|---|
| Product: | [Modeling] OCL | Reporter: | Axel Uhl <eclipse> |
| Component: | Core | Assignee: | OCL Inbox <mdt-ocl-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ed |
| Version: | 3.1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
+1 Since it's a simple private method, perhaps it could be flattened. Inlined as suggested and committed. Closing |
What should have been a side effect free getter (getLoadedPackages()) performs a side effect on the packages member variable and redundantly calls cachePackage(...). This shouldn't be the case. The following patch fixes this: @@ -130,14 +130,14 @@ public class DefaultOppositeEndFinder } private Set<EPackage> getLoadedPackages() { + Set<EPackage> result = new HashSet<EPackage>(); for (Object key : registry.values()) { // if it's not a package descriptor indicating a not yet loaded package, add it if (key instanceof EPackage) { - packages.add((EPackage) key); - cachePackage((EPackage) key); + result.add((EPackage) key); } } - return packages; + return result; } protected DefaultOppositeEndFinder(Registry registry) {