Skip to content

Commit 6e138e1

Browse files
committed
ICU-23054 some Eclipse cleanup, mostly adding Override
1 parent 43afd6f commit 6e138e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+575
-352
lines changed

icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/Counter.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
public class Counter<T> implements Iterable<T>, Comparable<Counter<T>> {
2424
Map<T,RWLong> map;
2525
Comparator<T> comparator;
26-
26+
2727
public Counter() {
2828
this(null);
2929
}
30-
30+
3131
public Counter(Comparator<T> comparator) {
3232
if (comparator != null) {
3333
this.comparator = comparator;
@@ -36,7 +36,7 @@ public Counter(Comparator<T> comparator) {
3636
map = new LinkedHashMap<T, RWLong>();
3737
}
3838
}
39-
39+
4040
static private final class RWLong implements Comparable<RWLong> {
4141
// the uniqueCount ensures that two different RWIntegers will always be different
4242
static int uniqueCount;
@@ -48,6 +48,7 @@ static private final class RWLong implements Comparable<RWLong> {
4848
}
4949
}
5050

51+
@Override
5152
public int compareTo(RWLong that) {
5253
if (that.value < value) return -1;
5354
if (that.value > value) return 1;
@@ -57,6 +58,7 @@ public int compareTo(RWLong that) {
5758
}
5859
return 1; // the forceUnique values must be different, so this is the only remaining case
5960
}
61+
@Override
6062
public String toString() {
6163
return String.valueOf(value);
6264
}
@@ -94,7 +96,7 @@ public long getTotal() {
9496
public int getItemCount() {
9597
return size();
9698
}
97-
99+
98100
private static class Entry<T> {
99101
RWLong count;
100102
T value;
@@ -105,15 +107,16 @@ public Entry(RWLong count, T value, int uniqueness) {
105107
this.uniqueness = uniqueness;
106108
}
107109
}
108-
110+
109111
private static class EntryComparator<T> implements Comparator<Entry<T>>{
110112
int countOrdering;
111113
Comparator<T> byValue;
112-
114+
113115
public EntryComparator(boolean ascending, Comparator<T> byValue) {
114116
countOrdering = ascending ? 1 : -1;
115117
this.byValue = byValue;
116118
}
119+
@Override
117120
public int compare(Entry<T> o1, Entry<T> o2) {
118121
if (o1.count.value < o2.count.value) return -countOrdering;
119122
if (o1.count.value > o2.count.value) return countOrdering;
@@ -127,7 +130,7 @@ public int compare(Entry<T> o1, Entry<T> o2) {
127130
public Set<T> getKeysetSortedByCount(boolean ascending) {
128131
return getKeysetSortedByCount(ascending, null);
129132
}
130-
133+
131134
public Set<T> getKeysetSortedByCount(boolean ascending, Comparator<T> byValue) {
132135
Set<Entry<T>> count_key = new TreeSet<Entry<T>>(new EntryComparator<T>(ascending, byValue));
133136
int counter = 0;
@@ -161,7 +164,8 @@ public Set<T> keySet() {
161164
return map.keySet();
162165
}
163166

164-
public Iterator<T> iterator() {
167+
@Override
168+
public Iterator<T> iterator() {
165169
return map.keySet().iterator();
166170
}
167171

@@ -173,7 +177,8 @@ public int size() {
173177
return map.size();
174178
}
175179

176-
public String toString() {
180+
@Override
181+
public String toString() {
177182
return map.toString();
178183
}
179184

@@ -183,15 +188,16 @@ public Counter<T> addAll(Collection<T> keys, int delta) {
183188
}
184189
return this;
185190
}
186-
191+
187192
public Counter<T> addAll(Counter<T> keys) {
188193
for (T key : keys) {
189194
add(key, keys.getCount(key));
190195
}
191196
return this;
192197
}
193198

194-
public int compareTo(Counter<T> o) {
199+
@Override
200+
public int compareTo(Counter<T> o) {
195201
Iterator<T> i = map.keySet().iterator();
196202
Iterator<T> j = o.map.keySet().iterator();
197203
while (true) {
@@ -220,10 +226,12 @@ public boolean containsKey(T key) {
220226
return map.containsKey(key);
221227
}
222228

229+
@Override
223230
public boolean equals(Object o) {
224231
return map.equals(o);
225232
}
226233

234+
@Override
227235
public int hashCode() {
228236
return map.hashCode();
229237
}

icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/ExceptionHandler.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
*/
3030
public abstract class ExceptionHandler implements SerializableTestUtility.Handler
3131
{
32+
@Override
3233
public boolean hasSameBehavior(Object a, Object b)
3334
{
3435
Exception ea = (Exception) a;
@@ -39,74 +40,80 @@ public boolean hasSameBehavior(Object a, Object b)
3940

4041
static class ArabicShapingExceptionHandler extends ExceptionHandler
4142
{
43+
@Override
4244
public Object[] getTestObjects()
4345
{
4446
Locale locales[] = SerializableTestUtility.getLocales();
4547
ArabicShapingException exceptions[] = new ArabicShapingException[locales.length];
46-
48+
4749
for (int i = 0; i < locales.length; i += 1) {
4850
exceptions[i] = new ArabicShapingException(locales[i].toString());
4951
}
50-
52+
5153
return exceptions;
5254
}
5355
}
54-
56+
5557
static class StringPrepParseExceptionHandler extends ExceptionHandler
5658
{
59+
@Override
5760
public Object[] getTestObjects()
5861
{
5962
Locale locales[] = SerializableTestUtility.getLocales();
6063
String rules = "This is a very odd little set of rules, just for testing, you know...";
6164
StringPrepParseException exceptions[] = new StringPrepParseException[locales.length];
62-
65+
6366
for (int i = 0; i < locales.length; i += 1) {
6467
exceptions[i] = new StringPrepParseException(locales[i].toString(), i, rules, i);
6568
}
66-
69+
6770
return exceptions;
6871
}
6972
}
70-
73+
7174
static class UResourceTypeMismatchExceptionHandler extends ExceptionHandler
7275
{
76+
@Override
7377
public Object[] getTestObjects()
7478
{
7579
Locale locales[] = SerializableTestUtility.getLocales();
7680
UResourceTypeMismatchException exceptions[] = new UResourceTypeMismatchException[locales.length];
77-
81+
7882
for (int i = 0; i < locales.length; i += 1) {
7983
exceptions[i] = new UResourceTypeMismatchException(locales[i].toString());
8084
}
81-
85+
8286
return exceptions;
8387
}
8488
}
85-
89+
8690
static class InvalidFormatExceptionHandler extends ExceptionHandler
8791
{
92+
@Override
8893
public Object[] getTestObjects()
8994
{
9095
Locale locales[] = SerializableTestUtility.getLocales();
9196
InvalidFormatException exceptions[] = new InvalidFormatException[locales.length];
92-
97+
9398
for (int i = 0; i < locales.length; i += 1) {
9499
exceptions[i] = new InvalidFormatException(locales[i].toString());
95100
}
96-
101+
97102
return exceptions;
98103
}
99104
}
100105

101106
static class IllformedLocaleExceptionHandler extends ExceptionHandler
102107
{
108+
@Override
103109
public Object[] getTestObjects()
104110
{
105111
IllformedLocaleException[] exceptions = new IllformedLocaleException[2];
106112
exceptions[0] = new IllformedLocaleException("msg1");
107113
exceptions[1] = new IllformedLocaleException("msg2", 5);
108114
return exceptions;
109115
}
116+
@Override
110117
public boolean hasSameBehavior(Object a, Object b)
111118
{
112119
IllformedLocaleException ifeA = (IllformedLocaleException) a;
@@ -120,13 +127,15 @@ public boolean hasSameBehavior(Object a, Object b)
120127

121128
static class LocaleSyntaxExceptionHandler extends ExceptionHandler
122129
{
130+
@Override
123131
public Object[] getTestObjects()
124132
{
125133
LocaleSyntaxException[] exceptions = new LocaleSyntaxException[2];
126134
exceptions[0] = new LocaleSyntaxException("msg1");
127135
exceptions[1] = new LocaleSyntaxException("msg2", 5);
128136
return exceptions;
129137
}
138+
@Override
130139
public boolean hasSameBehavior(Object a, Object b)
131140
{
132141
LocaleSyntaxException ifeA = (LocaleSyntaxException) a;
@@ -140,6 +149,7 @@ public boolean hasSameBehavior(Object a, Object b)
140149

141150
static class IllegalIcuArgumentExceptionHandler extends ExceptionHandler
142151
{
152+
@Override
143153
public Object[] getTestObjects()
144154
{
145155
IllegalIcuArgumentException[] exceptions = {
@@ -151,6 +161,7 @@ public Object[] getTestObjects()
151161

152162
static class SkeletonSyntaxExceptionHandler extends ExceptionHandler
153163
{
164+
@Override
154165
public Object[] getTestObjects()
155166
{
156167
SkeletonSyntaxException[] exceptions = {

icu4j/main/core/src/main/java/com/ibm/icu/impl/FormattedValueStringBuilderImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public static class SpanFieldPlaceholder implements FormattedStringBuilder.Field
3737
public int start;
3838
public int length;
3939

40+
@Override
4041
public Field unwrap() {
4142
return normalField;
4243
}

icu4j/main/core/src/main/java/com/ibm/icu/impl/ImmutableEntry.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@ public class ImmutableEntry<K,V> implements Map.Entry<K,V> {
2323
v = value;
2424
}
2525

26+
@Override
2627
public K getKey() {return k;}
2728

29+
@Override
2830
public V getValue() {return v;}
2931

32+
@Override
3033
public V setValue(V value) {
3134
throw new UnsupportedOperationException();
3235
}
3336

37+
@Override
3438
public boolean equals(Object o) {
3539
try {
3640
Map.Entry e = (Map.Entry)o;
@@ -40,10 +44,12 @@ public boolean equals(Object o) {
4044
}
4145
}
4246

47+
@Override
4348
public int hashCode() {
4449
return ((k==null ? 0 : k.hashCode()) ^ (v==null ? 0 : v.hashCode()));
4550
}
4651

52+
@Override
4753
public String toString() {
4854
return k+"="+v;
4955
}

0 commit comments

Comments
 (0)