Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2013-10-28 10:45:30 +0000
committerEugene Tarassov2013-10-28 10:45:30 +0000
commit1a7e4e5a0bef4fc717c4c65b5be6fddb40ee6510 (patch)
treefde656186222151d87f829f58e5697db3b523e67 /plugins
parentc69efd1ddb9d177ce0b964873fa3b5fb2c2a0692 (diff)
downloadorg.eclipse.tcf-1a7e4e5a0bef4fc717c4c65b5be6fddb40ee6510.tar.gz
org.eclipse.tcf-1a7e4e5a0bef4fc717c4c65b5be6fddb40ee6510.tar.xz
org.eclipse.tcf-1a7e4e5a0bef4fc717c4c65b5be6fddb40ee6510.zip
TCF Core: fixed FindBugs warning: This class overrides equals(Object), but does not override hashCode()
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java41
1 files changed, 27 insertions, 14 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java
index 2dee01cb9..a51f7a05d 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,10 +33,24 @@ public class MemoryProxy implements IMemory {
new HashMap<MemoryListener,IChannel.IEventListener>();
private static class Range implements Comparable<Range> {
- int offs;
- int size;
- int stat;
- String msg;
+ final int offs;
+ final int size;
+ final int stat;
+ final String msg;
+
+ Range(int offs, int size, int stat, String msg) {
+ this.offs = offs;
+ this.size = size;
+ this.stat = stat;
+ this.msg = msg;
+ }
+
+ @Override
+ public int compareTo(Range o) {
+ if (offs < o.offs) return -1;
+ if (offs > o.offs) return +1;
+ return 0;
+ }
@Override
public boolean equals(Object o) {
@@ -44,10 +58,9 @@ public class MemoryProxy implements IMemory {
return false;
}
- public int compareTo(Range o) {
- if (offs < o.offs) return -1;
- if (offs > o.offs) return +1;
- return 0;
+ @Override
+ public int hashCode() {
+ return offs;
}
}
@@ -67,13 +80,13 @@ public class MemoryProxy implements IMemory {
int n = 0;
BigInteger addr_bi = JSON.toBigInteger(addr);
for (Map<String,Object> m : c) {
- Range r = new Range();
Number x = (Number)m.get(RANGE_KEY_ADDR);
BigInteger y = JSON.toBigInteger(x);
- r.offs = y.subtract(addr_bi).intValue();
- r.size = ((Number)m.get(RANGE_KEY_SIZE)).intValue();
- r.stat = ((Number)m.get(RANGE_KEY_STAT)).intValue();
- r.msg = Command.toErrorString(m.get(RANGE_KEY_MSG));
+ Range r = new Range(
+ y.subtract(addr_bi).intValue(),
+ ((Number)m.get(RANGE_KEY_SIZE)).intValue(),
+ ((Number)m.get(RANGE_KEY_STAT)).intValue(),
+ Command.toErrorString(m.get(RANGE_KEY_MSG)));
assert r.offs >= 0;
assert r.size >= 0;
this.ranges[n++] = r;

Back to the top