Permalink
Browse files

Resolve unchecked assignments warnings

  • Loading branch information...
1 parent 667ea90 commit 4783b3fc99296ea12d40c90ec645a6d50ddcfdca @thomas-kielbus thomas-kielbus committed Jun 12, 2014
@@ -26,21 +26,21 @@
import com.liveramp.megadesk.core.transaction.Context;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class Append<V> extends BaseTransaction<Void> implements Transaction<Void> {
+public class Append<VALUE> extends BaseTransaction<Void> implements Transaction<Void> {
- private final Variable<ImmutableList> list;
- private final List<V> values;
+ private final Variable<ImmutableList<VALUE>> list;
+ private final List<VALUE> values;
- public Append(Variable<ImmutableList> driver, List<V> values) {
+ public Append(Variable<ImmutableList<VALUE>> driver, List<VALUE> values) {
super(BaseDependency.builder().writes(driver).build());
this.values = values;
this.list = driver;
}
@Override
public Void run(Context context) throws Exception {
- ImmutableList originalValue = context.read(list);
- ImmutableList newValue = ImmutableList.builder().addAll(originalValue).addAll(values).build();
+ ImmutableList<VALUE> originalValue = context.read(list);
+ ImmutableList<VALUE> newValue = ImmutableList.<VALUE>builder().addAll(originalValue).addAll(values).build();
context.write(list, newValue);
return null;
}
@@ -29,11 +29,11 @@
public abstract class BaseQueue<VALUE, OUTPUT> {
- private final Variable<ImmutableList> input;
- private final Variable<ImmutableList> output;
+ private final Variable<ImmutableList<VALUE>> input;
+ private final Variable<ImmutableList<VALUE>> output;
private final Variable<Boolean> frozen;
- public BaseQueue(Variable<ImmutableList> input, Variable<ImmutableList> output, Variable<Boolean> frozen) {
+ public BaseQueue(Variable<ImmutableList<VALUE>> input, Variable<ImmutableList<VALUE>> output, Variable<Boolean> frozen) {
this.input = input;
this.output = output;
this.frozen = frozen;
@@ -64,11 +64,11 @@ public void append(Context context, VALUE... values) {
append(context, Lists.newArrayList(values));
}
- public Variable<ImmutableList> getInput() {
+ public Variable<ImmutableList<VALUE>> getInput() {
return input;
}
- public Variable<ImmutableList> getOutput() {
+ public Variable<ImmutableList<VALUE>> getOutput() {
return output;
}
@@ -89,8 +89,8 @@ public void append(Context context, VALUE... values) {
}
}
- protected TransferBatch getTransferTransaction() {
- return new TransferBatch(input, output, frozen);
+ protected TransferBatch<VALUE> getTransferTransaction() {
+ return new TransferBatch<VALUE>(input, output, frozen);
}
public void pop(Context context) {
@@ -23,7 +23,7 @@
public class Batch<VALUE> extends BaseQueue<VALUE, ImmutableList<VALUE>> {
- public Batch(Variable<ImmutableList> input, Variable<ImmutableList> output, Variable<Boolean> frozen) {
+ public Batch(Variable<ImmutableList<VALUE>> input, Variable<ImmutableList<VALUE>> output, Variable<Boolean> frozen) {
super(input, output, frozen);
}
@@ -34,7 +34,7 @@ public Batch(Variable<ImmutableList> input, Variable<ImmutableList> output, Vari
@Override
protected Transaction getPopTransaction() {
- return new Erase(getOutput(), getFrozen());
+ return new Erase<VALUE>(getOutput(), getFrozen());
}
}
@@ -32,8 +32,8 @@ public BatchExecutable(Batch<VALUE> batch, TransactionExecutor executor) {
public static <VALUE> BatchExecutable<VALUE> getBatchByName(String name, DriverFactory factory, BaseTransactionExecutor executor) {
return new BatchExecutable<VALUE>(
new Batch<VALUE>(
- new Local<ImmutableList>(factory.<ImmutableList>get(name + "-input", ImmutableList.of())),
- new Local<ImmutableList>(factory.<ImmutableList>get(name + "-output", ImmutableList.of())),
+ new Local<ImmutableList<VALUE>>(factory.get(name + "-input", ImmutableList.<VALUE>of())),
+ new Local<ImmutableList<VALUE>>(factory.get(name + "-output", ImmutableList.<VALUE>of())),
new Local<Boolean>(factory.get(name + "-frozen", false))),
new BaseTransactionExecutor()
);
@@ -24,20 +24,20 @@
import com.liveramp.megadesk.core.transaction.Context;
import com.liveramp.megadesk.core.transaction.Transaction;
-class Erase extends BaseTransaction<Void> implements Transaction<Void> {
+class Erase<VALUE> extends BaseTransaction<Void> implements Transaction<Void> {
- private final Variable<ImmutableList> list;
+ private final Variable<ImmutableList<VALUE>> list;
private final Variable<Boolean> frozen;
- Erase(Variable<ImmutableList> list, Variable<Boolean> frozen) {
+ Erase(Variable<ImmutableList<VALUE>> list, Variable<Boolean> frozen) {
super(BaseDependency.builder().writes(list, frozen).build());
this.frozen = frozen;
this.list = list;
}
@Override
public Void run(Context context) throws Exception {
- context.write(list, ImmutableList.of());
+ context.write(list, ImmutableList.<VALUE>of());
context.write(frozen, false);
return null;
}
@@ -24,22 +24,22 @@
import com.liveramp.megadesk.core.transaction.Context;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class PopOne extends BaseTransaction<Void> implements Transaction<Void> {
+public class PopOne<VALUE> extends BaseTransaction<Void> implements Transaction<Void> {
- private final Variable<ImmutableList> list;
+ private final Variable<ImmutableList<VALUE>> list;
private final Variable<Boolean> frozen;
- public PopOne(Variable<ImmutableList> list, Variable<Boolean> frozen) {
+ public PopOne(Variable<ImmutableList<VALUE>> list, Variable<Boolean> frozen) {
super(BaseDependency.builder().writes(list, frozen).build());
this.frozen = frozen;
this.list = list;
}
@Override
public Void run(Context context) throws Exception {
- ImmutableList list = context.read(this.list);
+ ImmutableList<VALUE> list = context.read(this.list);
if (!list.isEmpty()) {
- ImmutableList newList = list.subList(1, list.size());
+ ImmutableList<VALUE> newList = list.subList(1, list.size());
context.write(this.list, newList);
}
if (context.read(this.list).isEmpty()) {
@@ -23,7 +23,7 @@
public class Queue<VALUE> extends BaseQueue<VALUE, VALUE> {
- public Queue(Variable<ImmutableList> input, Variable<ImmutableList> output, Variable<Boolean> frozen) {
+ public Queue(Variable<ImmutableList<VALUE>> input, Variable<ImmutableList<VALUE>> output, Variable<Boolean> frozen) {
super(input, output, frozen);
}
@@ -38,6 +38,6 @@ protected VALUE internalRead(ImmutableList<VALUE> transfer) {
@Override
protected Transaction getPopTransaction() {
- return new PopOne(this.getOutput(), this.getFrozen());
+ return new PopOne<VALUE>(this.getOutput(), this.getFrozen());
}
}
@@ -33,8 +33,8 @@ public QueueExecutable(Queue<VALUE> queue, TransactionExecutor executor) {
public static <VALUE> QueueExecutable<VALUE> getQueueByName(String name, DriverFactory factory, BaseTransactionExecutor executor) {
return new QueueExecutable<VALUE>(
new Queue<VALUE>(
- new BaseVariable<ImmutableList>(new Name<ImmutableList>(name + "input"), factory.<ImmutableList>get(name + "-input", ImmutableList.of())),
- new BaseVariable<ImmutableList>(new Name<ImmutableList>(name + "output"), factory.<ImmutableList>get(name + "-output", ImmutableList.of())),
+ new BaseVariable<ImmutableList<VALUE>>(new Name<ImmutableList<VALUE>>(name + "input"), factory.get(name + "-input", ImmutableList.<VALUE>of())),
+ new BaseVariable<ImmutableList<VALUE>>(new Name<ImmutableList<VALUE>>(name + "output"), factory.get(name + "-output", ImmutableList.<VALUE>of())),
new BaseVariable<Boolean>(new Name<Boolean>(name + "frozen"), (factory.get(name + "-frozen", false)))),
new BaseTransactionExecutor()
);
@@ -25,31 +25,31 @@
import com.liveramp.megadesk.core.transaction.Context;
import com.liveramp.megadesk.core.transaction.Transaction;
-public class TransferBatch extends BaseTransaction<ImmutableList> implements Transaction<ImmutableList> {
+public class TransferBatch<VALUE> extends BaseTransaction<ImmutableList<VALUE>> implements Transaction<ImmutableList<VALUE>> {
- private final Variable<ImmutableList> input;
- private final Variable<ImmutableList> output;
+ private final Variable<ImmutableList<VALUE>> input;
+ private final Variable<ImmutableList<VALUE>> output;
private final Variable<Boolean> frozen;
- public TransferBatch(Variable<ImmutableList> input, Variable<ImmutableList> output, Variable<Boolean> frozen) {
+ public TransferBatch(Variable<ImmutableList<VALUE>> input, Variable<ImmutableList<VALUE>> output, Variable<Boolean> frozen) {
super(BaseDependency.builder().writes(input, output, frozen).build());
this.input = input;
this.output = output;
this.frozen = frozen;
}
@Override
- public ImmutableList run(Context context) throws Exception {
- Accessor<ImmutableList> inputList = context.accessor(input);
- Accessor<ImmutableList> outputList = context.accessor(output);
+ public ImmutableList<VALUE> run(Context context) throws Exception {
+ Accessor<ImmutableList<VALUE>> inputList = context.accessor(input);
+ Accessor<ImmutableList<VALUE>> outputList = context.accessor(output);
Accessor<Boolean> frozenFlag = context.accessor(frozen);
if (!frozenFlag.read()) {
if (!outputList.read().isEmpty()) {
throw new IllegalStateException("Batch should not be unfrozen when output still remains!");
}
- ImmutableList values = inputList.read();
+ ImmutableList<VALUE> values = inputList.read();
outputList.write(values);
- inputList.write(ImmutableList.of());
+ inputList.write(ImmutableList.<VALUE>of());
frozenFlag.write(true);
}
return outputList.read();

0 comments on commit 4783b3f

Please sign in to comment.