diff options
| author | Andrew Johnson | 2019-11-13 16:32:58 +0000 |
|---|---|---|
| committer | Andrew Johnson | 2019-11-13 16:32:58 +0000 |
| commit | 4d93284448475171f903be4892cb5f40bdfd0768 (patch) | |
| tree | 11846dd22f7ce6cbb24a1da6c9af8c8edb25f0d0 | |
| parent | 295c89c1ef6c6b22e714977bcdbe1debe5f92dec (diff) | |
| download | org.eclipse.mat-4d93284448475171f903be4892cb5f40bdfd0768.tar.gz org.eclipse.mat-4d93284448475171f903be4892cb5f40bdfd0768.tar.xz org.eclipse.mat-4d93284448475171f903be4892cb5f40bdfd0768.zip | |
552879: OQL enhancements for sub-selects, maps, context providers
fix some FindBugs warnings
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=552879
Change-Id: I4b8931b9b3a639ec8c70f00d91e417bcfa2e6722
| -rw-r--r-- | plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/oql/OQLQueryImpl.java | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/oql/OQLQueryImpl.java b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/oql/OQLQueryImpl.java index b06401be..a9e8fa8e 100644 --- a/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/oql/OQLQueryImpl.java +++ b/plugins/org.eclipse.mat.parser/src/org/eclipse/mat/parser/internal/oql/OQLQueryImpl.java @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -161,23 +162,22 @@ public class OQLQueryImpl implements IOQLQuery Set<Entry<String, Object>> set = new LinkedHashSet<Entry<String, Object>>();
for (int col = 0; col < isr.getColumns().length; ++col)
{
- set.add(new SimpleEntry<String, Object>(isr.getColumns()[col].getLabel(), null) {
- /**
- *
- */
- private static final long serialVersionUID = 378783918135046563L;
+ String key = isr.getColumns()[col].getLabel();
+ set.add(new Entry<String, Object>() {
final Object NULL_VALUE = new Object();
+ Object value;
+
public Object getValue()
{
- Object o = super.getValue();
+ Object o = value;
if (o == NULL_VALUE)
return null;
else if (o != null)
return o;
o = get(getKey());
- super.setValue(o);
+ value = o;
return o;
}
@@ -185,6 +185,30 @@ public class OQLQueryImpl implements IOQLQuery {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String getKey()
+ {
+ return key;
+ }
+
+ public int hashCode()
+ {
+ return Objects.hash(getKey(), getValue());
+ }
+
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof Entry<?,?>))
+ {
+ Entry<?,?>ox = (Entry<?,?>)o;
+ return Objects.equals(getKey(), ox.getKey()) &&
+ Objects.equals(getValue(), ox.getValue());
+ }
+ {
+ return false;
+ }
+ }
});
}
return Collections.unmodifiableSet(set);
@@ -1852,8 +1876,6 @@ public class OQLQueryImpl implements IOQLQuery {
List<Object> r = new ArrayList<Object>();
IStructuredResult irt = (IStructuredResult)result;
- Column cols[] = irt.getColumns();
- int colCount = cols.length;
List<?>elements = irt instanceof IResultTree ? ((IResultTree)irt).getElements() : null;
int count = irt instanceof IResultTable ? ((IResultTable)irt).getRowCount() : elements.size();
for (int ii = 0; ii < count; ii++)
|
