summaryrefslogtreecommitdiff
path: root/src/main/java/com/amazon/carbonado/util
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2008-05-06 13:52:12 +0000
committerBrian S. O'Neill <bronee@gmail.com>2008-05-06 13:52:12 +0000
commitab92f4ec859413b2d3612068dfb21d741fb389a3 (patch)
tree110ab1c9c6b08bd1acf40b1ac0e3192caa38cc93 /src/main/java/com/amazon/carbonado/util
parent6087388aca5eb50054732c2f606fa21165e88b75 (diff)
Code cleanup: add @Override annotations, remove unused imports, remove dead code and add @Deprecated annotations.
Diffstat (limited to 'src/main/java/com/amazon/carbonado/util')
-rw-r--r--src/main/java/com/amazon/carbonado/util/AnnotationBuilder.java24
-rw-r--r--src/main/java/com/amazon/carbonado/util/AnnotationDescPrinter.java24
-rw-r--r--src/main/java/com/amazon/carbonado/util/AnnotationPrinter.java24
-rw-r--r--src/main/java/com/amazon/carbonado/util/TaskQueueThread.java1
-rw-r--r--src/main/java/com/amazon/carbonado/util/WeakReentrantLockPool.java1
-rw-r--r--src/main/java/com/amazon/carbonado/util/WeakReentrantReadWriteLockPool.java1
6 files changed, 75 insertions, 0 deletions
diff --git a/src/main/java/com/amazon/carbonado/util/AnnotationBuilder.java b/src/main/java/com/amazon/carbonado/util/AnnotationBuilder.java
index 9b5b900..e613b0c 100644
--- a/src/main/java/com/amazon/carbonado/util/AnnotationBuilder.java
+++ b/src/main/java/com/amazon/carbonado/util/AnnotationBuilder.java
@@ -38,6 +38,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
mStack = new Stack<Annotation.MemberValue[]>();
}
+ @Override
public Object visit(String name, int pos, java.lang.annotation.Annotation value,
Annotation ann)
{
@@ -54,62 +55,74 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, int value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, long value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, float value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, double value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, boolean value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, byte value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, short value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, char value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, String value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(value));
return null;
}
+ @Override
public Object visit(String name, int pos, Class value, Annotation ann) {
put(ann, name, pos, ann.makeMemberValue(TypeDesc.forClass(value)));
return null;
}
+ @Override
public Object visit(String name, int pos, Enum value, Annotation ann) {
put(ann, name, pos,
ann.makeMemberValue(TypeDesc.forClass(value.getDeclaringClass()), value.name()));
return null;
}
+ @Override
public Object visit(String name, int pos, java.lang.annotation.Annotation[] value,
Annotation ann)
{
@@ -119,6 +132,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, int[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -126,6 +140,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, long[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -133,6 +148,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, float[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -140,6 +156,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, double[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -147,6 +164,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, boolean[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -154,6 +172,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, byte[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -161,6 +180,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, short[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -168,6 +188,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, char[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -175,6 +196,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, String[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -182,6 +204,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, Class[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
@@ -189,6 +212,7 @@ public class AnnotationBuilder extends AnnotationVisitor<Object, Annotation> {
return null;
}
+ @Override
public Object visit(String name, int pos, Enum[] value, Annotation ann) {
mStack.push(new Annotation.MemberValue[value.length]);
super.visit(name, pos, value, ann);
diff --git a/src/main/java/com/amazon/carbonado/util/AnnotationDescPrinter.java b/src/main/java/com/amazon/carbonado/util/AnnotationDescPrinter.java
index 4f80911..b4a995f 100644
--- a/src/main/java/com/amazon/carbonado/util/AnnotationDescPrinter.java
+++ b/src/main/java/com/amazon/carbonado/util/AnnotationDescPrinter.java
@@ -81,6 +81,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return visit(value, null);
}
+ @Override
public Object visit(String name, int pos, Annotation value, Object param) {
if (appendName(name, pos, TAG_ANNOTATION)) {
mBuilder.append(TypeDesc.forClass(value.annotationType()).getDescriptor());
@@ -90,6 +91,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, int value, Object param) {
appendName(name, pos, TAG_INT);
mBuilder.append(value);
@@ -97,6 +99,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, long value, Object param) {
appendName(name, pos, TAG_LONG);
mBuilder.append(value);
@@ -104,6 +107,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, float value, Object param) {
appendName(name, pos, TAG_FLOAT);
mBuilder.append(Float.toString(value));
@@ -111,6 +115,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, double value, Object param) {
appendName(name, pos, TAG_DOUBLE);
mBuilder.append(Double.toString(value));
@@ -118,12 +123,14 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, boolean value, Object param) {
appendName(name, pos, TAG_BOOLEAN);
mBuilder.append(value ? '1' : '0');
return null;
}
+ @Override
public Object visit(String name, int pos, byte value, Object param) {
appendName(name, pos, TAG_BYTE);
mBuilder.append(value);
@@ -131,6 +138,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, short value, Object param) {
appendName(name, pos, TAG_SHORT);
mBuilder.append(value);
@@ -138,12 +146,14 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, char value, Object param) {
appendName(name, pos, TAG_CHAR);
mBuilder.append(value);
return null;
}
+ @Override
public Object visit(String name, int pos, String value, Object param) {
appendName(name, pos, TAG_STRING);
int length = value.length();
@@ -158,6 +168,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Class value, Object param) {
appendName(name, pos, TAG_CLASS);
if (value == String.class) {
@@ -170,6 +181,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Enum value, Object param) {
if (appendName(name, pos, TAG_ENUM)) {
mBuilder.append(value.getDeclaringClass().getName());
@@ -180,6 +192,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Annotation[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -187,6 +200,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, int[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -194,6 +208,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, long[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -201,6 +216,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, float[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -208,6 +224,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, double[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -215,6 +232,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, boolean[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -222,6 +240,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, byte[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -229,6 +248,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, short[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -236,6 +256,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, char[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -243,6 +264,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, String[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -250,6 +272,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Class[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
@@ -257,6 +280,7 @@ public class AnnotationDescPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Enum[] value, Object param) {
appendName(name, pos, TAG_ARRAY);
super.visit(name, pos, value, param);
diff --git a/src/main/java/com/amazon/carbonado/util/AnnotationPrinter.java b/src/main/java/com/amazon/carbonado/util/AnnotationPrinter.java
index df811c0..9aa78c1 100644
--- a/src/main/java/com/amazon/carbonado/util/AnnotationPrinter.java
+++ b/src/main/java/com/amazon/carbonado/util/AnnotationPrinter.java
@@ -48,6 +48,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return visit(value, null);
}
+ @Override
public Object visit(String name, int pos, Annotation value, Object param) {
appendName(name, pos);
mBuilder.append('@');
@@ -58,12 +59,14 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, int value, Object param) {
appendName(name, pos);
mBuilder.append(value);
return null;
}
+ @Override
public Object visit(String name, int pos, long value, Object param) {
appendName(name, pos);
mBuilder.append(value);
@@ -71,6 +74,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, float value, Object param) {
appendName(name, pos);
if (Float.isNaN(value)) {
@@ -86,6 +90,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, double value, Object param) {
appendName(name, pos);
if (Double.isNaN(value)) {
@@ -101,24 +106,28 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, boolean value, Object param) {
appendName(name, pos);
mBuilder.append(value);
return null;
}
+ @Override
public Object visit(String name, int pos, byte value, Object param) {
appendName(name, pos);
mBuilder.append(value);
return null;
}
+ @Override
public Object visit(String name, int pos, short value, Object param) {
appendName(name, pos);
mBuilder.append(value);
return null;
}
+ @Override
public Object visit(String name, int pos, char value, Object param) {
appendName(name, pos);
mBuilder.append('\'');
@@ -198,6 +207,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
}
}
+ @Override
public Object visit(String name, int pos, String value, Object param) {
appendName(name, pos);
mBuilder.append('"');
@@ -209,6 +219,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Class value, Object param) {
appendName(name, pos);
mBuilder.append(value.getName());
@@ -216,6 +227,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Enum value, Object param) {
appendName(name, pos);
mBuilder.append(value.getDeclaringClass().getName());
@@ -224,6 +236,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Annotation[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -232,6 +245,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, int[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -240,6 +254,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, long[] value, Object param) {
appendName(name, pos);
super.visit(name, pos, value, param);
@@ -247,6 +262,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, float[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -255,6 +271,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, double[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -263,6 +280,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, boolean[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -271,6 +289,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, byte[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -279,6 +298,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, short[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -287,6 +307,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, char[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -295,6 +316,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, String[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -303,6 +325,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Class[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
@@ -311,6 +334,7 @@ public class AnnotationPrinter extends AnnotationVisitor<Object, Object> {
return null;
}
+ @Override
public Object visit(String name, int pos, Enum[] value, Object param) {
appendName(name, pos);
mBuilder.append('{');
diff --git a/src/main/java/com/amazon/carbonado/util/TaskQueueThread.java b/src/main/java/com/amazon/carbonado/util/TaskQueueThread.java
index 51febc0..2eaf835 100644
--- a/src/main/java/com/amazon/carbonado/util/TaskQueueThread.java
+++ b/src/main/java/com/amazon/carbonado/util/TaskQueueThread.java
@@ -120,6 +120,7 @@ public class TaskQueueThread extends Thread implements Executor {
mQueue.offer(STOP_TASK);
}
+ @Override
public void run() {
synchronized (this) {
if (mState == STATE_SHOULD_STOP || mState == STATE_STOPPED) {
diff --git a/src/main/java/com/amazon/carbonado/util/WeakReentrantLockPool.java b/src/main/java/com/amazon/carbonado/util/WeakReentrantLockPool.java
index b44a823..77a7317 100644
--- a/src/main/java/com/amazon/carbonado/util/WeakReentrantLockPool.java
+++ b/src/main/java/com/amazon/carbonado/util/WeakReentrantLockPool.java
@@ -40,6 +40,7 @@ class WeakReentrantLockPool<K>
mFair = fair;
}
+ @Override
protected ReentrantLock create(K key) {
return new ReentrantLock(mFair);
}
diff --git a/src/main/java/com/amazon/carbonado/util/WeakReentrantReadWriteLockPool.java b/src/main/java/com/amazon/carbonado/util/WeakReentrantReadWriteLockPool.java
index 3b0663e..6905ab5 100644
--- a/src/main/java/com/amazon/carbonado/util/WeakReentrantReadWriteLockPool.java
+++ b/src/main/java/com/amazon/carbonado/util/WeakReentrantReadWriteLockPool.java
@@ -40,6 +40,7 @@ class WeakReentrantReadWriteLockPool<K>
mFair = fair;
}
+ @Override
protected ReentrantReadWriteLock create(K key) {
return new ReentrantReadWriteLock(mFair);
}