@NotNull annotations in instruction classes

This commit is contained in:
Andrey Breslav
2013-11-29 20:30:42 +04:00
parent 3110edaca6
commit 0b575da5d3
14 changed files with 15 additions and 2 deletions
@@ -54,6 +54,7 @@ public abstract class AbstractJumpInstruction extends InstructionImpl {
return updateCopyInfo(createCopy(newLabel)); return updateCopyInfo(createCopy(newLabel));
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return createCopy(targetLabel); return createCopy(targetLabel);
@@ -32,7 +32,7 @@ public interface Instruction {
@NotNull @NotNull
Collection<Instruction> getNextInstructions(); Collection<Instruction> getNextInstructions();
void accept(InstructionVisitor visitor); void accept(@NotNull InstructionVisitor visitor);
@NotNull @NotNull
Collection<Instruction> getCopies(); Collection<Instruction> getCopies();
@@ -71,6 +71,7 @@ public abstract class InstructionImpl implements Instruction {
return updateCopyInfo(createCopy()); return updateCopyInfo(createCopy());
} }
@NotNull
protected abstract Instruction createCopy(); protected abstract Instruction createCopy();
@NotNull @NotNull
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetElement; import org.jetbrains.jet.lang.psi.JetElement;
public abstract class JetElementInstructionImpl extends InstructionImpl implements JetElementInstruction { public abstract class JetElementInstructionImpl extends InstructionImpl implements JetElementInstruction {
@NotNull
protected final JetElement element; protected final JetElement element;
public JetElementInstructionImpl(@NotNull JetElement element) { public JetElementInstructionImpl(@NotNull JetElement element) {
@@ -35,6 +35,7 @@ public class LoadUnitValueInstruction extends InstructionWithNext {
return "read (Unit)"; return "read (Unit)";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new LoadUnitValueInstruction((JetExpression) element); return new LoadUnitValueInstruction((JetExpression) element);
@@ -62,6 +62,7 @@ public class LocalFunctionDeclarationInstruction extends InstructionWithNext {
return "d" + "(" + element.getText() + ")"; return "d" + "(" + element.getText() + ")";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new LocalFunctionDeclarationInstruction(element, body); return new LocalFunctionDeclarationInstruction(element, body);
@@ -85,6 +85,7 @@ public class NondeterministicJumpInstruction extends InstructionImpl{
return sb.toString(); return sb.toString();
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return createCopy(getTargetLabels()); return createCopy(getTargetLabels());
@@ -35,6 +35,7 @@ public class ReadValueInstruction extends InstructionWithNext {
return "r(" + element.getText() + ")"; return "r(" + element.getText() + ")";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new ReadValueInstruction(element); return new ReadValueInstruction(element);
@@ -41,6 +41,7 @@ public class SubroutineEnterInstruction extends InstructionWithNext {
return "<START>"; return "<START>";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new SubroutineEnterInstruction(subroutine); return new SubroutineEnterInstruction(subroutine);
@@ -57,6 +57,7 @@ public class SubroutineExitInstruction extends InstructionImpl {
return debugLabel; return debugLabel;
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new SubroutineExitInstruction(subroutine, debugLabel); return new SubroutineExitInstruction(subroutine, debugLabel);
@@ -51,6 +51,7 @@ public class SubroutineSinkInstruction extends InstructionImpl {
return debugLabel; return debugLabel;
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new SubroutineSinkInstruction(subroutine, debugLabel); return new SubroutineSinkInstruction(subroutine, debugLabel);
@@ -35,6 +35,7 @@ public class UnsupportedElementInstruction extends InstructionWithNext {
return "unsupported(" + element + " : " + element.getText() + ")"; return "unsupported(" + element + " : " + element.getText() + ")";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new UnsupportedElementInstruction(element); return new UnsupportedElementInstruction(element);
@@ -45,6 +45,7 @@ public class VariableDeclarationInstruction extends InstructionWithNext {
return "v(" + element.getText() + ")"; return "v(" + element.getText() + ")";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
if (element instanceof JetParameter) { if (element instanceof JetParameter) {
@@ -35,7 +35,7 @@ public class WriteValueInstruction extends InstructionWithNext {
} }
@Override @Override
public void accept(InstructionVisitor visitor) { public void accept(@NotNull InstructionVisitor visitor) {
visitor.visitWriteValue(this); visitor.visitWriteValue(this);
} }
@@ -48,6 +48,7 @@ public class WriteValueInstruction extends InstructionWithNext {
return "w(" + lValue.getText() + ")"; return "w(" + lValue.getText() + ")";
} }
@NotNull
@Override @Override
protected Instruction createCopy() { protected Instruction createCopy() {
return new WriteValueInstruction(element, lValue); return new WriteValueInstruction(element, lValue);