Annotate JetVisitorVoid and its inheritors

This commit is contained in:
Alexey Sedunov
2013-11-18 13:42:23 +04:00
parent 05d9cbd67d
commit 523e44f00d
33 changed files with 246 additions and 237 deletions
@@ -1324,12 +1324,12 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
private void lookupConstructorExpressionsInClosureIfPresent(final ConstructorContext constructorContext) { private void lookupConstructorExpressionsInClosureIfPresent(final ConstructorContext constructorContext) {
JetVisitorVoid visitor = new JetVisitorVoid() { JetVisitorVoid visitor = new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement e) { public void visitJetElement(@NotNull JetElement e) {
e.acceptChildren(this); e.acceptChildren(this);
} }
@Override @Override
public void visitSimpleNameExpression(JetSimpleNameExpression expr) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expr) {
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expr); DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expr);
if (descriptor instanceof VariableDescriptor && !(descriptor instanceof PropertyDescriptor)) { if (descriptor instanceof VariableDescriptor && !(descriptor instanceof PropertyDescriptor)) {
ConstructorDescriptor constructorDescriptor = (ConstructorDescriptor) constructorContext.getContextDescriptor(); ConstructorDescriptor constructorDescriptor = (ConstructorDescriptor) constructorContext.getContextDescriptor();
@@ -1355,7 +1355,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
} }
@Override @Override
public void visitThisExpression(JetThisExpression expression) { public void visitThisExpression(@NotNull JetThisExpression expression) {
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getInstanceReference()); DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression.getInstanceReference());
assert descriptor instanceof CallableDescriptor || assert descriptor instanceof CallableDescriptor ||
descriptor instanceof ClassDescriptor : "'This' reference target should be class or callable descriptor but was " + descriptor; descriptor instanceof ClassDescriptor : "'This' reference target should be class or callable descriptor but was " + descriptor;
@@ -139,13 +139,13 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
super.visitJetElement(element); super.visitJetElement(element);
element.acceptChildren(this); element.acceptChildren(this);
} }
@Override @Override
public void visitJetFile(JetFile file) { public void visitJetFile(@NotNull JetFile file) {
if (file.isScript()) { if (file.isScript()) {
//noinspection ConstantConditions //noinspection ConstantConditions
ClassDescriptor classDescriptor = bindingContext.get(CLASS_FOR_SCRIPT, bindingContext.get(SCRIPT, file.getScript())); ClassDescriptor classDescriptor = bindingContext.get(CLASS_FOR_SCRIPT, bindingContext.get(SCRIPT, file.getScript()));
@@ -164,7 +164,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitEnumEntry(JetEnumEntry enumEntry) { public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
ClassDescriptor descriptor = bindingContext.get(CLASS, enumEntry); ClassDescriptor descriptor = bindingContext.get(CLASS, enumEntry);
assert descriptor != null; assert descriptor != null;
@@ -181,7 +181,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitClassObject(JetClassObject classObject) { public void visitClassObject(@NotNull JetClassObject classObject) {
ClassDescriptor classDescriptor = bindingContext.get(CLASS, classObject.getObjectDeclaration()); ClassDescriptor classDescriptor = bindingContext.get(CLASS, classObject.getObjectDeclaration());
assert classDescriptor != null; assert classDescriptor != null;
@@ -196,7 +196,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitObjectDeclaration(JetObjectDeclaration declaration) { public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
if (declaration.getParent() instanceof JetObjectLiteralExpression || declaration.getParent() instanceof JetClassObject) { if (declaration.getParent() instanceof JetObjectLiteralExpression || declaration.getParent() instanceof JetClassObject) {
super.visitObjectDeclaration(declaration); super.visitObjectDeclaration(declaration);
} }
@@ -217,7 +217,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitClass(JetClass klass) { public void visitClass(@NotNull JetClass klass) {
ClassDescriptor classDescriptor = bindingContext.get(CLASS, klass); ClassDescriptor classDescriptor = bindingContext.get(CLASS, klass);
// working around a problem with shallow analysis // working around a problem with shallow analysis
if (classDescriptor == null) return; if (classDescriptor == null) return;
@@ -239,7 +239,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) { public void visitObjectLiteralExpression(@NotNull JetObjectLiteralExpression expression) {
ClassDescriptor classDescriptor = bindingContext.get(CLASS, expression.getObjectDeclaration()); ClassDescriptor classDescriptor = bindingContext.get(CLASS, expression.getObjectDeclaration());
if (classDescriptor == null) { if (classDescriptor == null) {
// working around a problem with shallow analysis // working around a problem with shallow analysis
@@ -259,7 +259,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) { public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral(); JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
FunctionDescriptor functionDescriptor = FunctionDescriptor functionDescriptor =
(FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, functionLiteral); (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, functionLiteral);
@@ -298,7 +298,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) { public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
ClassDescriptorWithState state = peekFromStack(classStack); ClassDescriptorWithState state = peekFromStack(classStack);
assert state != null : "Class descriptor should be recorded before " + call + " processing"; assert state != null : "Class descriptor should be recorded before " + call + " processing";
state.setDelegationToSuperCall(true); state.setDelegationToSuperCall(true);
@@ -307,7 +307,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitCallableReferenceExpression(JetCallableReferenceExpression expression) { public void visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression) {
FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression); FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression);
// working around a problem with shallow analysis // working around a problem with shallow analysis
if (functionDescriptor == null) return; if (functionDescriptor == null) return;
@@ -339,7 +339,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitProperty(JetProperty property) { public void visitProperty(@NotNull JetProperty property) {
DeclarationDescriptor propertyDescriptor = bindingContext.get(DECLARATION_TO_DESCRIPTOR, property); DeclarationDescriptor propertyDescriptor = bindingContext.get(DECLARATION_TO_DESCRIPTOR, property);
// working around a problem with shallow analysis // working around a problem with shallow analysis
if (propertyDescriptor == null) return; if (propertyDescriptor == null) return;
@@ -356,7 +356,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(@NotNull JetNamedFunction function) {
FunctionDescriptor functionDescriptor = (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, function); FunctionDescriptor functionDescriptor = (FunctionDescriptor) bindingContext.get(DECLARATION_TO_DESCRIPTOR, function);
// working around a problem with shallow analysis // working around a problem with shallow analysis
if (functionDescriptor == null) return; if (functionDescriptor == null) return;
@@ -402,7 +402,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitCallExpression(JetCallExpression expression) { public void visitCallExpression(@NotNull JetCallExpression expression) {
super.visitCallExpression(expression); super.visitCallExpression(expression);
ResolvedCall<? extends CallableDescriptor> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression()); ResolvedCall<? extends CallableDescriptor> call = bindingContext.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression());
if (call == null) { if (call == null) {
@@ -437,7 +437,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitBinaryExpression(JetBinaryExpression expression) { public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
super.visitBinaryExpression(expression); super.visitBinaryExpression(expression);
FunctionDescriptor operationDescriptor = FunctionDescriptor operationDescriptor =
@@ -460,7 +460,7 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
} }
@Override @Override
public void visitArrayAccessExpression(JetArrayAccessExpression expression) { public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
super.visitArrayAccessExpression(expression); super.visitArrayAccessExpression(expression);
FunctionDescriptor operationDescriptor = (FunctionDescriptor) bindingContext.get(BindingContext.REFERENCE_TARGET, expression); FunctionDescriptor operationDescriptor = (FunctionDescriptor) bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
@@ -83,7 +83,7 @@ public class DebugInfoUtil {
root.acceptChildren(new JetTreeVisitorVoid() { root.acceptChildren(new JetTreeVisitorVoid() {
@Override @Override
public void visitReferenceExpression(JetReferenceExpression expression) { public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
super.visitReferenceExpression(expression); super.visitReferenceExpression(expression);
if (!BindingContextUtils.isExpressionWithValidReference(expression, bindingContext)){ if (!BindingContextUtils.isExpressionWithValidReference(expression, bindingContext)){
return; return;
@@ -95,31 +95,31 @@ public class JetControlFlowProcessor {
private final JetVisitorVoid conditionVisitor = new JetVisitorVoid() { private final JetVisitorVoid conditionVisitor = new JetVisitorVoid() {
@Override @Override
public void visitWhenConditionInRange(JetWhenConditionInRange condition) { public void visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition) {
generateInstructions(condition.getRangeExpression(), CFPVisitor.this.inCondition); // TODO : inCondition? generateInstructions(condition.getRangeExpression(), CFPVisitor.this.inCondition); // TODO : inCondition?
generateInstructions(condition.getOperationReference(), CFPVisitor.this.inCondition); // TODO : inCondition? generateInstructions(condition.getOperationReference(), CFPVisitor.this.inCondition); // TODO : inCondition?
// TODO : read the call to contains()... // TODO : read the call to contains()...
} }
@Override @Override
public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) { public void visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition) {
// TODO: types in CF? // TODO: types in CF?
} }
@Override @Override
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) { public void visitWhenConditionWithExpression(@NotNull JetWhenConditionWithExpression condition) {
generateInstructions(condition.getExpression(), inCondition); generateInstructions(condition.getExpression(), inCondition);
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString()); throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString());
} }
}; };
private final JetVisitorVoid patternVisitor = new JetVisitorVoid() { private final JetVisitorVoid patternVisitor = new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString()); throw new UnsupportedOperationException("[JetControlFlowProcessor] " + element.toString());
} }
}; };
@@ -141,7 +141,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitParenthesizedExpression(JetParenthesizedExpression expression) { public void visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression) {
builder.read(expression); builder.read(expression);
JetExpression innerExpression = expression.getExpression(); JetExpression innerExpression = expression.getExpression();
@@ -151,7 +151,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitAnnotatedExpression(JetAnnotatedExpression expression) { public void visitAnnotatedExpression(@NotNull JetAnnotatedExpression expression) {
builder.read(expression); builder.read(expression);
JetExpression baseExpression = expression.getBaseExpression(); JetExpression baseExpression = expression.getBaseExpression();
@@ -161,17 +161,17 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitThisExpression(JetThisExpression expression) { public void visitThisExpression(@NotNull JetThisExpression expression) {
builder.read(expression); builder.read(expression);
} }
@Override @Override
public void visitConstantExpression(JetConstantExpression expression) { public void visitConstantExpression(@NotNull JetConstantExpression expression) {
builder.read(expression); builder.read(expression);
} }
@Override @Override
public void visitSimpleNameExpression(JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
builder.read(expression); builder.read(expression);
if (trace.get(BindingContext.PROCESSED, expression)) { if (trace.get(BindingContext.PROCESSED, expression)) {
JetType type = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression); JetType type = trace.getBindingContext().get(BindingContext.EXPRESSION_TYPE, expression);
@@ -182,7 +182,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) { public void visitLabelQualifiedExpression(@NotNull JetLabelQualifiedExpression expression) {
String labelName = expression.getLabelName(); String labelName = expression.getLabelName();
JetExpression labeledExpression = expression.getLabeledExpression(); JetExpression labeledExpression = expression.getLabeledExpression();
if (labelName != null && labeledExpression != null) { if (labelName != null && labeledExpression != null) {
@@ -198,7 +198,7 @@ public class JetControlFlowProcessor {
} }
@SuppressWarnings("SuspiciousMethodCalls") @Override @SuppressWarnings("SuspiciousMethodCalls") @Override
public void visitBinaryExpression(JetBinaryExpression expression) { public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
IElementType operationType = expression.getOperationReference().getReferencedNameElementType(); IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
JetExpression right = expression.getRight(); JetExpression right = expression.getRight();
if (operationType == JetTokens.ANDAND) { if (operationType == JetTokens.ANDAND) {
@@ -294,7 +294,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitUnaryExpression(JetUnaryExpression expression) { public void visitUnaryExpression(@NotNull JetUnaryExpression expression) {
JetSimpleNameExpression operationSign = expression.getOperationReference(); JetSimpleNameExpression operationSign = expression.getOperationReference();
IElementType operationType = operationSign.getReferencedNameElementType(); IElementType operationType = operationSign.getReferencedNameElementType();
JetExpression baseExpression = expression.getBaseExpression(); JetExpression baseExpression = expression.getBaseExpression();
@@ -322,7 +322,7 @@ public class JetControlFlowProcessor {
@Override @Override
public void visitIfExpression(JetIfExpression expression) { public void visitIfExpression(@NotNull JetIfExpression expression) {
JetExpression condition = expression.getCondition(); JetExpression condition = expression.getCondition();
if (condition != null) { if (condition != null) {
generateInstructions(condition, true); generateInstructions(condition, true);
@@ -376,7 +376,7 @@ public class JetControlFlowProcessor {
@Override @Override
public void visitTryExpression(JetTryExpression expression) { public void visitTryExpression(@NotNull JetTryExpression expression) {
builder.read(expression); builder.read(expression);
JetFinallySection finallyBlock = expression.getFinallyBlock(); JetFinallySection finallyBlock = expression.getFinallyBlock();
final FinallyBlockGenerator finallyBlockGenerator = new FinallyBlockGenerator(finallyBlock); final FinallyBlockGenerator finallyBlockGenerator = new FinallyBlockGenerator(finallyBlock);
@@ -461,7 +461,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitWhileExpression(JetWhileExpression expression) { public void visitWhileExpression(@NotNull JetWhileExpression expression) {
builder.read(expression); builder.read(expression);
LoopInfo loopInfo = builder.enterLoop(expression, null, null); LoopInfo loopInfo = builder.enterLoop(expression, null, null);
@@ -492,7 +492,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitDoWhileExpression(JetDoWhileExpression expression) { public void visitDoWhileExpression(@NotNull JetDoWhileExpression expression) {
builder.read(expression); builder.read(expression);
LoopInfo loopInfo = builder.enterLoop(expression, null, null); LoopInfo loopInfo = builder.enterLoop(expression, null, null);
@@ -512,7 +512,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitForExpression(JetForExpression expression) { public void visitForExpression(@NotNull JetForExpression expression) {
builder.read(expression); builder.read(expression);
JetExpression loopRange = expression.getLoopRange(); JetExpression loopRange = expression.getLoopRange();
if (loopRange != null) { if (loopRange != null) {
@@ -548,7 +548,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitBreakExpression(JetBreakExpression expression) { public void visitBreakExpression(@NotNull JetBreakExpression expression) {
JetElement loop = getCorrespondingLoop(expression); JetElement loop = getCorrespondingLoop(expression);
if (loop != null) { if (loop != null) {
builder.jump(builder.getExitPoint(loop)); builder.jump(builder.getExitPoint(loop));
@@ -556,7 +556,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitContinueExpression(JetContinueExpression expression) { public void visitContinueExpression(@NotNull JetContinueExpression expression) {
JetElement loop = getCorrespondingLoop(expression); JetElement loop = getCorrespondingLoop(expression);
if (loop != null) { if (loop != null) {
builder.jump(builder.getEntryPoint(loop)); builder.jump(builder.getEntryPoint(loop));
@@ -588,7 +588,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitReturnExpression(JetReturnExpression expression) { public void visitReturnExpression(@NotNull JetReturnExpression expression) {
JetExpression returnedExpression = expression.getReturnedExpression(); JetExpression returnedExpression = expression.getReturnedExpression();
if (returnedExpression != null) { if (returnedExpression != null) {
generateInstructions(returnedExpression, false); generateInstructions(returnedExpression, false);
@@ -623,7 +623,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitParameter(JetParameter parameter) { public void visitParameter(@NotNull JetParameter parameter) {
builder.declare(parameter); builder.declare(parameter);
JetExpression defaultValue = parameter.getDefaultValue(); JetExpression defaultValue = parameter.getDefaultValue();
if (defaultValue != null) { if (defaultValue != null) {
@@ -633,7 +633,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitBlockExpression(JetBlockExpression expression) { public void visitBlockExpression(@NotNull JetBlockExpression expression) {
List<JetElement> statements = expression.getStatements(); List<JetElement> statements = expression.getStatements();
for (JetElement statement : statements) { for (JetElement statement : statements) {
generateInstructions(statement, false); generateInstructions(statement, false);
@@ -644,19 +644,19 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(@NotNull JetNamedFunction function) {
processLocalDeclaration(function); processLocalDeclaration(function);
} }
@Override @Override
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) { public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral(); JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
processLocalDeclaration(functionLiteral); processLocalDeclaration(functionLiteral);
builder.read(expression); builder.read(expression);
} }
@Override @Override
public void visitQualifiedExpression(JetQualifiedExpression expression) { public void visitQualifiedExpression(@NotNull JetQualifiedExpression expression) {
generateInstructions(expression.getReceiverExpression(), false); generateInstructions(expression.getReceiverExpression(), false);
JetExpression selectorExpression = expression.getSelectorExpression(); JetExpression selectorExpression = expression.getSelectorExpression();
if (selectorExpression != null) { if (selectorExpression != null) {
@@ -685,7 +685,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitCallExpression(JetCallExpression expression) { public void visitCallExpression(@NotNull JetCallExpression expression) {
//inline functions after M1 //inline functions after M1
// ResolvedCall<? extends CallableDescriptor> resolvedCall = trace.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression()); // ResolvedCall<? extends CallableDescriptor> resolvedCall = trace.get(BindingContext.RESOLVED_CALL, expression.getCalleeExpression());
// assert resolvedCall != null; // assert resolvedCall != null;
@@ -722,7 +722,7 @@ public class JetControlFlowProcessor {
// } // }
@Override @Override
public void visitProperty(JetProperty property) { public void visitProperty(@NotNull JetProperty property) {
builder.declare(property); builder.declare(property);
JetExpression initializer = property.getInitializer(); JetExpression initializer = property.getInitializer();
if (initializer != null) { if (initializer != null) {
@@ -739,7 +739,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitMultiDeclaration(JetMultiDeclaration declaration) { public void visitMultiDeclaration(@NotNull JetMultiDeclaration declaration) {
JetExpression initializer = declaration.getInitializer(); JetExpression initializer = declaration.getInitializer();
if (initializer != null) { if (initializer != null) {
generateInstructions(initializer, false); generateInstructions(initializer, false);
@@ -752,12 +752,12 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitPropertyAccessor(JetPropertyAccessor accessor) { public void visitPropertyAccessor(@NotNull JetPropertyAccessor accessor) {
processLocalDeclaration(accessor); processLocalDeclaration(accessor);
} }
@Override @Override
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) { public void visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression) {
IElementType operationType = expression.getOperationReference().getReferencedNameElementType(); IElementType operationType = expression.getOperationReference().getReferencedNameElementType();
if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) { if (operationType == JetTokens.COLON || operationType == JetTokens.AS_KEYWORD || operationType == JetTokens.AS_SAFE) {
generateInstructions(expression.getLeft(), false); generateInstructions(expression.getLeft(), false);
@@ -769,7 +769,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitThrowExpression(JetThrowExpression expression) { public void visitThrowExpression(@NotNull JetThrowExpression expression) {
JetExpression thrownExpression = expression.getThrownExpression(); JetExpression thrownExpression = expression.getThrownExpression();
if (thrownExpression != null) { if (thrownExpression != null) {
generateInstructions(thrownExpression, false); generateInstructions(thrownExpression, false);
@@ -778,7 +778,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitArrayAccessExpression(JetArrayAccessExpression expression) { public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
for (JetExpression index : expression.getIndexExpressions()) { for (JetExpression index : expression.getIndexExpressions()) {
generateInstructions(index, false); generateInstructions(index, false);
} }
@@ -788,7 +788,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitIsExpression(JetIsExpression expression) { public void visitIsExpression(@NotNull JetIsExpression expression) {
generateInstructions(expression.getLeftHandSide(), inCondition); generateInstructions(expression.getLeftHandSide(), inCondition);
// no CF for types // no CF for types
// TODO : builder.read(expression.getPattern()); // TODO : builder.read(expression.getPattern());
@@ -796,7 +796,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitWhenExpression(JetWhenExpression expression) { public void visitWhenExpression(@NotNull JetWhenExpression expression) {
JetExpression subjectExpression = expression.getSubjectExpression(); JetExpression subjectExpression = expression.getSubjectExpression();
if (subjectExpression != null) { if (subjectExpression != null) {
generateInstructions(subjectExpression, inCondition); generateInstructions(subjectExpression, inCondition);
@@ -853,7 +853,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) { public void visitObjectLiteralExpression(@NotNull JetObjectLiteralExpression expression) {
JetObjectDeclaration declaration = expression.getObjectDeclaration(); JetObjectDeclaration declaration = expression.getObjectDeclaration();
generateInstructions(declaration, inCondition); generateInstructions(declaration, inCondition);
@@ -871,12 +871,12 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitObjectDeclaration(JetObjectDeclaration objectDeclaration) { public void visitObjectDeclaration(@NotNull JetObjectDeclaration objectDeclaration) {
visitClassOrObject(objectDeclaration); visitClassOrObject(objectDeclaration);
} }
@Override @Override
public void visitStringTemplateExpression(JetStringTemplateExpression expression) { public void visitStringTemplateExpression(@NotNull JetStringTemplateExpression expression) {
for (JetStringTemplateEntry entry : expression.getEntries()) { for (JetStringTemplateEntry entry : expression.getEntries()) {
if (entry instanceof JetStringTemplateEntryWithExpression) { if (entry instanceof JetStringTemplateEntryWithExpression) {
JetStringTemplateEntryWithExpression entryWithExpression = (JetStringTemplateEntryWithExpression) entry; JetStringTemplateEntryWithExpression entryWithExpression = (JetStringTemplateEntryWithExpression) entry;
@@ -887,12 +887,12 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitTypeProjection(JetTypeProjection typeProjection) { public void visitTypeProjection(@NotNull JetTypeProjection typeProjection) {
// TODO : Support Type Arguments. Class object may be initialized at this point"); // TODO : Support Type Arguments. Class object may be initialized at this point");
} }
@Override @Override
public void visitAnonymousInitializer(JetClassInitializer classInitializer) { public void visitAnonymousInitializer(@NotNull JetClassInitializer classInitializer) {
generateInstructions(classInitializer.getBody(), inCondition); generateInstructions(classInitializer.getBody(), inCondition);
} }
@@ -909,7 +909,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitClass(JetClass klass) { public void visitClass(@NotNull JetClass klass) {
List<JetParameter> parameters = klass.getPrimaryConstructorParameters(); List<JetParameter> parameters = klass.getPrimaryConstructorParameters();
for (JetParameter parameter : parameters) { for (JetParameter parameter : parameters) {
generateInstructions(parameter, inCondition); generateInstructions(parameter, inCondition);
@@ -918,7 +918,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) { public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
List<? extends ValueArgument> valueArguments = call.getValueArguments(); List<? extends ValueArgument> valueArguments = call.getValueArguments();
for (ValueArgument valueArgument : valueArguments) { for (ValueArgument valueArgument : valueArguments) {
generateInstructions(valueArgument.getArgumentExpression(), inCondition); generateInstructions(valueArgument.getArgumentExpression(), inCondition);
@@ -926,12 +926,12 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) { public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) {
generateInstructions(specifier.getDelegateExpression(), inCondition); generateInstructions(specifier.getDelegateExpression(), inCondition);
} }
@Override @Override
public void visitJetFile(JetFile file) { public void visitJetFile(@NotNull JetFile file) {
for (JetDeclaration declaration : file.getDeclarations()) { for (JetDeclaration declaration : file.getDeclarations()) {
if (declaration instanceof JetProperty) { if (declaration instanceof JetProperty) {
generateInstructions(declaration, inCondition); generateInstructions(declaration, inCondition);
@@ -940,7 +940,7 @@ public class JetControlFlowProcessor {
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
builder.unsupported(element); builder.unsupported(element);
} }
} }
@@ -144,14 +144,14 @@ public class JetFlowInformationProvider {
for (JetElement returnedExpression : returnedExpressions) { for (JetElement returnedExpression : returnedExpressions) {
returnedExpression.accept(new JetVisitorVoid() { returnedExpression.accept(new JetVisitorVoid() {
@Override @Override
public void visitReturnExpression(JetReturnExpression expression) { public void visitReturnExpression(@NotNull JetReturnExpression expression) {
if (!blockBody) { if (!blockBody) {
trace.report(RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY.on(expression)); trace.report(RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY.on(expression));
} }
} }
@Override @Override
public void visitExpression(JetExpression expression) { public void visitExpression(@NotNull JetExpression expression) {
if (blockBody && !noExpectedType(expectedReturnType) && !KotlinBuiltIns.getInstance().isUnit(expectedReturnType) && !rootUnreachableElements.contains(expression)) { if (blockBody && !noExpectedType(expectedReturnType) && !KotlinBuiltIns.getInstance().isUnit(expectedReturnType) && !rootUnreachableElements.contains(expression)) {
noReturnError[0] = true; noReturnError[0] = true;
} }
@@ -138,7 +138,7 @@ public class JetPsiUtil {
final Set<JetElement> shadowedElements = new HashSet<JetElement>(); final Set<JetElement> shadowedElements = new HashSet<JetElement>();
JetVisitorVoid shadowAllChildren = new JetVisitorVoid() { JetVisitorVoid shadowAllChildren = new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
if (shadowedElements.add(element)) { if (shadowedElements.add(element)) {
element.acceptChildren(this); element.acceptChildren(this);
} }
@@ -841,7 +841,7 @@ public class JetPsiUtil {
((JetElement) root).accept( ((JetElement) root).accept(
new JetVisitorVoid() { new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
if (predicate.apply(element)) { if (predicate.apply(element)) {
//noinspection unchecked //noinspection unchecked
results.add(element); results.add(element);
@@ -17,161 +17,162 @@
package org.jetbrains.jet.lang.psi; package org.jetbrains.jet.lang.psi;
import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiElementVisitor;
import org.jetbrains.annotations.NotNull;
public class JetVisitorVoid extends PsiElementVisitor { public class JetVisitorVoid extends PsiElementVisitor {
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
visitElement(element); visitElement(element);
} }
public void visitDeclaration(JetDeclaration dcl) { public void visitDeclaration(@NotNull JetDeclaration dcl) {
visitExpression(dcl); visitExpression(dcl);
} }
public void visitClass(JetClass klass) { public void visitClass(@NotNull JetClass klass) {
visitNamedDeclaration(klass); visitNamedDeclaration(klass);
} }
public void visitClassObject(JetClassObject classObject) { public void visitClassObject(@NotNull JetClassObject classObject) {
visitDeclaration(classObject); visitDeclaration(classObject);
} }
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(@NotNull JetNamedFunction function) {
visitNamedDeclaration(function); visitNamedDeclaration(function);
} }
public void visitProperty(JetProperty property) { public void visitProperty(@NotNull JetProperty property) {
visitNamedDeclaration(property); visitNamedDeclaration(property);
} }
public void visitTypedef(JetTypedef typedef) { public void visitTypedef(@NotNull JetTypedef typedef) {
visitNamedDeclaration(typedef); visitNamedDeclaration(typedef);
} }
public void visitJetFile(JetFile file) { public void visitJetFile(@NotNull JetFile file) {
visitFile(file); visitFile(file);
} }
public void visitScript(JetScript script) { public void visitScript(@NotNull JetScript script) {
visitDeclaration(script); visitDeclaration(script);
} }
public void visitImportDirective(JetImportDirective importDirective) { public void visitImportDirective(@NotNull JetImportDirective importDirective) {
visitJetElement(importDirective); visitJetElement(importDirective);
} }
public void visitImportList(JetImportList importList) { public void visitImportList(@NotNull JetImportList importList) {
visitJetElement(importList); visitJetElement(importList);
} }
public void visitClassBody(JetClassBody classBody) { public void visitClassBody(@NotNull JetClassBody classBody) {
visitJetElement(classBody); visitJetElement(classBody);
} }
public void visitModifierList(JetModifierList list) { public void visitModifierList(@NotNull JetModifierList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitAnnotation(JetAnnotation annotation) { public void visitAnnotation(@NotNull JetAnnotation annotation) {
visitJetElement(annotation); visitJetElement(annotation);
} }
public void visitAnnotationEntry(JetAnnotationEntry annotationEntry) { public void visitAnnotationEntry(@NotNull JetAnnotationEntry annotationEntry) {
visitJetElement(annotationEntry); visitJetElement(annotationEntry);
} }
public void visitTypeParameterList(JetTypeParameterList list) { public void visitTypeParameterList(@NotNull JetTypeParameterList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitTypeParameter(JetTypeParameter parameter) { public void visitTypeParameter(@NotNull JetTypeParameter parameter) {
visitNamedDeclaration(parameter); visitNamedDeclaration(parameter);
} }
public void visitEnumEntry(JetEnumEntry enumEntry) { public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
visitClass(enumEntry); visitClass(enumEntry);
} }
public void visitParameterList(JetParameterList list) { public void visitParameterList(@NotNull JetParameterList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitParameter(JetParameter parameter) { public void visitParameter(@NotNull JetParameter parameter) {
visitNamedDeclaration(parameter); visitNamedDeclaration(parameter);
} }
public void visitDelegationSpecifierList(JetDelegationSpecifierList list) { public void visitDelegationSpecifierList(@NotNull JetDelegationSpecifierList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitDelegationSpecifier(JetDelegationSpecifier specifier) { public void visitDelegationSpecifier(@NotNull JetDelegationSpecifier specifier) {
visitJetElement(specifier); visitJetElement(specifier);
} }
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) { public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) {
visitDelegationSpecifier(specifier); visitDelegationSpecifier(specifier);
} }
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) { public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
visitDelegationSpecifier(call); visitDelegationSpecifier(call);
} }
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) { public void visitDelegationToSuperClassSpecifier(@NotNull JetDelegatorToSuperClass specifier) {
visitDelegationSpecifier(specifier); visitDelegationSpecifier(specifier);
} }
public void visitDelegationToThisCall(JetDelegatorToThisCall thisCall) { public void visitDelegationToThisCall(@NotNull JetDelegatorToThisCall thisCall) {
visitDelegationSpecifier(thisCall); visitDelegationSpecifier(thisCall);
} }
public void visitPropertyDelegate(JetPropertyDelegate delegate) { public void visitPropertyDelegate(@NotNull JetPropertyDelegate delegate) {
visitJetElement(delegate); visitJetElement(delegate);
} }
public void visitTypeReference(JetTypeReference typeReference) { public void visitTypeReference(@NotNull JetTypeReference typeReference) {
visitJetElement(typeReference); visitJetElement(typeReference);
} }
public void visitValueArgumentList(JetValueArgumentList list) { public void visitValueArgumentList(@NotNull JetValueArgumentList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitArgument(JetValueArgument argument) { public void visitArgument(@NotNull JetValueArgument argument) {
visitJetElement(argument); visitJetElement(argument);
} }
public void visitExpression(JetExpression expression) { public void visitExpression(@NotNull JetExpression expression) {
visitJetElement(expression); visitJetElement(expression);
} }
public void visitLoopExpression(JetLoopExpression loopExpression) { public void visitLoopExpression(@NotNull JetLoopExpression loopExpression) {
visitExpression(loopExpression); visitExpression(loopExpression);
} }
public void visitConstantExpression(JetConstantExpression expression) { public void visitConstantExpression(@NotNull JetConstantExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitSimpleNameExpression(JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
visitReferenceExpression(expression); visitReferenceExpression(expression);
} }
public void visitReferenceExpression(JetReferenceExpression expression) { public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitPrefixExpression(JetPrefixExpression expression) { public void visitPrefixExpression(@NotNull JetPrefixExpression expression) {
visitUnaryExpression(expression); visitUnaryExpression(expression);
} }
public void visitPostfixExpression(JetPostfixExpression expression) { public void visitPostfixExpression(@NotNull JetPostfixExpression expression) {
visitUnaryExpression(expression); visitUnaryExpression(expression);
} }
public void visitUnaryExpression(JetUnaryExpression expression) { public void visitUnaryExpression(@NotNull JetUnaryExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitBinaryExpression(JetBinaryExpression expression) { public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
@@ -179,231 +180,231 @@ public class JetVisitorVoid extends PsiElementVisitor {
// visitExpression(expression); // visitExpression(expression);
// } // }
// //
public void visitReturnExpression(JetReturnExpression expression) { public void visitReturnExpression(@NotNull JetReturnExpression expression) {
visitLabelQualifiedExpression(expression); visitLabelQualifiedExpression(expression);
} }
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) { public void visitLabelQualifiedExpression(@NotNull JetLabelQualifiedExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitThrowExpression(JetThrowExpression expression) { public void visitThrowExpression(@NotNull JetThrowExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitBreakExpression(JetBreakExpression expression) { public void visitBreakExpression(@NotNull JetBreakExpression expression) {
visitLabelQualifiedExpression(expression); visitLabelQualifiedExpression(expression);
} }
public void visitContinueExpression(JetContinueExpression expression) { public void visitContinueExpression(@NotNull JetContinueExpression expression) {
visitLabelQualifiedExpression(expression); visitLabelQualifiedExpression(expression);
} }
public void visitIfExpression(JetIfExpression expression) { public void visitIfExpression(@NotNull JetIfExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitWhenExpression(JetWhenExpression expression) { public void visitWhenExpression(@NotNull JetWhenExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitTryExpression(JetTryExpression expression) { public void visitTryExpression(@NotNull JetTryExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitForExpression(JetForExpression expression) { public void visitForExpression(@NotNull JetForExpression expression) {
visitLoopExpression(expression); visitLoopExpression(expression);
} }
public void visitWhileExpression(JetWhileExpression expression) { public void visitWhileExpression(@NotNull JetWhileExpression expression) {
visitLoopExpression(expression); visitLoopExpression(expression);
} }
public void visitDoWhileExpression(JetDoWhileExpression expression) { public void visitDoWhileExpression(@NotNull JetDoWhileExpression expression) {
visitLoopExpression(expression); visitLoopExpression(expression);
} }
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) { public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitAnnotatedExpression(JetAnnotatedExpression expression) { public void visitAnnotatedExpression(@NotNull JetAnnotatedExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitCallExpression(JetCallExpression expression) { public void visitCallExpression(@NotNull JetCallExpression expression) {
visitReferenceExpression(expression); visitReferenceExpression(expression);
} }
public void visitArrayAccessExpression(JetArrayAccessExpression expression) { public void visitArrayAccessExpression(@NotNull JetArrayAccessExpression expression) {
visitReferenceExpression(expression); visitReferenceExpression(expression);
} }
public void visitQualifiedExpression(JetQualifiedExpression expression) { public void visitQualifiedExpression(@NotNull JetQualifiedExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitCallableReferenceExpression(JetCallableReferenceExpression expression) { public void visitCallableReferenceExpression(@NotNull JetCallableReferenceExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitDotQualifiedExpression(JetDotQualifiedExpression expression) { public void visitDotQualifiedExpression(@NotNull JetDotQualifiedExpression expression) {
visitQualifiedExpression(expression); visitQualifiedExpression(expression);
} }
public void visitSafeQualifiedExpression(JetSafeQualifiedExpression expression) { public void visitSafeQualifiedExpression(@NotNull JetSafeQualifiedExpression expression) {
visitQualifiedExpression(expression); visitQualifiedExpression(expression);
} }
public void visitObjectLiteralExpression(JetObjectLiteralExpression expression) { public void visitObjectLiteralExpression(@NotNull JetObjectLiteralExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitRootNamespaceExpression(JetRootNamespaceExpression expression) { public void visitRootNamespaceExpression(@NotNull JetRootNamespaceExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitBlockExpression(JetBlockExpression expression) { public void visitBlockExpression(@NotNull JetBlockExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitCatchSection(JetCatchClause catchClause) { public void visitCatchSection(@NotNull JetCatchClause catchClause) {
visitJetElement(catchClause); visitJetElement(catchClause);
} }
public void visitFinallySection(JetFinallySection finallySection) { public void visitFinallySection(@NotNull JetFinallySection finallySection) {
visitJetElement(finallySection); visitJetElement(finallySection);
} }
public void visitTypeArgumentList(JetTypeArgumentList typeArgumentList) { public void visitTypeArgumentList(@NotNull JetTypeArgumentList typeArgumentList) {
visitJetElement(typeArgumentList); visitJetElement(typeArgumentList);
} }
public void visitThisExpression(JetThisExpression expression) { public void visitThisExpression(@NotNull JetThisExpression expression) {
visitLabelQualifiedExpression(expression); visitLabelQualifiedExpression(expression);
} }
public void visitSuperExpression(JetSuperExpression expression) { public void visitSuperExpression(@NotNull JetSuperExpression expression) {
visitLabelQualifiedExpression(expression); visitLabelQualifiedExpression(expression);
} }
public void visitParenthesizedExpression(JetParenthesizedExpression expression) { public void visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitInitializerList(JetInitializerList list) { public void visitInitializerList(@NotNull JetInitializerList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitAnonymousInitializer(JetClassInitializer initializer) { public void visitAnonymousInitializer(@NotNull JetClassInitializer initializer) {
visitDeclaration(initializer); visitDeclaration(initializer);
} }
public void visitPropertyAccessor(JetPropertyAccessor accessor) { public void visitPropertyAccessor(@NotNull JetPropertyAccessor accessor) {
visitDeclaration(accessor); visitDeclaration(accessor);
} }
public void visitTypeConstraintList(JetTypeConstraintList list) { public void visitTypeConstraintList(@NotNull JetTypeConstraintList list) {
visitJetElement(list); visitJetElement(list);
} }
public void visitTypeConstraint(JetTypeConstraint constraint) { public void visitTypeConstraint(@NotNull JetTypeConstraint constraint) {
visitJetElement(constraint); visitJetElement(constraint);
} }
private void visitTypeElement(JetTypeElement type) { private void visitTypeElement(@NotNull JetTypeElement type) {
visitJetElement(type); visitJetElement(type);
} }
public void visitUserType(JetUserType type) { public void visitUserType(@NotNull JetUserType type) {
visitTypeElement(type); visitTypeElement(type);
} }
public void visitFunctionType(JetFunctionType type) { public void visitFunctionType(@NotNull JetFunctionType type) {
visitTypeElement(type); visitTypeElement(type);
} }
public void visitSelfType(JetSelfType type) { public void visitSelfType(@NotNull JetSelfType type) {
visitTypeElement(type); visitTypeElement(type);
} }
public void visitBinaryWithTypeRHSExpression(JetBinaryExpressionWithTypeRHS expression) { public void visitBinaryWithTypeRHSExpression(@NotNull JetBinaryExpressionWithTypeRHS expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitStringTemplateExpression(JetStringTemplateExpression expression) { public void visitStringTemplateExpression(@NotNull JetStringTemplateExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitNamedDeclaration(JetNamedDeclaration declaration) { public void visitNamedDeclaration(@NotNull JetNamedDeclaration declaration) {
visitDeclaration(declaration); visitDeclaration(declaration);
} }
public void visitNullableType(JetNullableType nullableType) { public void visitNullableType(@NotNull JetNullableType nullableType) {
visitTypeElement(nullableType); visitTypeElement(nullableType);
} }
public void visitTypeProjection(JetTypeProjection typeProjection) { public void visitTypeProjection(@NotNull JetTypeProjection typeProjection) {
visitJetElement(typeProjection); visitJetElement(typeProjection);
} }
public void visitWhenEntry(JetWhenEntry jetWhenEntry) { public void visitWhenEntry(@NotNull JetWhenEntry jetWhenEntry) {
visitJetElement(jetWhenEntry); visitJetElement(jetWhenEntry);
} }
public void visitIsExpression(JetIsExpression expression) { public void visitIsExpression(@NotNull JetIsExpression expression) {
visitExpression(expression); visitExpression(expression);
} }
public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) { public void visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition) {
visitJetElement(condition); visitJetElement(condition);
} }
public void visitWhenConditionInRange(JetWhenConditionInRange condition) { public void visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition) {
visitJetElement(condition); visitJetElement(condition);
} }
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) { public void visitWhenConditionWithExpression(@NotNull JetWhenConditionWithExpression condition) {
visitJetElement(condition); visitJetElement(condition);
} }
public void visitObjectDeclaration(JetObjectDeclaration declaration) { public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
visitNamedDeclaration(declaration); visitNamedDeclaration(declaration);
} }
public void visitObjectDeclarationName(JetObjectDeclarationName declaration) { public void visitObjectDeclarationName(@NotNull JetObjectDeclarationName declaration) {
visitNamedDeclaration(declaration); visitNamedDeclaration(declaration);
} }
public void visitStringTemplateEntry(JetStringTemplateEntry entry) { public void visitStringTemplateEntry(@NotNull JetStringTemplateEntry entry) {
visitJetElement(entry); visitJetElement(entry);
} }
public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) { public void visitStringTemplateEntryWithExpression(@NotNull JetStringTemplateEntryWithExpression entry) {
visitStringTemplateEntry(entry); visitStringTemplateEntry(entry);
} }
public void visitBlockStringTemplateEntry(JetBlockStringTemplateEntry entry) { public void visitBlockStringTemplateEntry(@NotNull JetBlockStringTemplateEntry entry) {
visitStringTemplateEntryWithExpression(entry); visitStringTemplateEntryWithExpression(entry);
} }
public void visitSimpleNameStringTemplateEntry(JetSimpleNameStringTemplateEntry entry) { public void visitSimpleNameStringTemplateEntry(@NotNull JetSimpleNameStringTemplateEntry entry) {
visitStringTemplateEntryWithExpression(entry); visitStringTemplateEntryWithExpression(entry);
} }
public void visitLiteralStringTemplateEntry(JetLiteralStringTemplateEntry entry) { public void visitLiteralStringTemplateEntry(@NotNull JetLiteralStringTemplateEntry entry) {
visitStringTemplateEntry(entry); visitStringTemplateEntry(entry);
} }
public void visitEscapeStringTemplateEntry(JetEscapeStringTemplateEntry entry) { public void visitEscapeStringTemplateEntry(@NotNull JetEscapeStringTemplateEntry entry) {
visitStringTemplateEntry(entry); visitStringTemplateEntry(entry);
} }
public void visitMultiDeclaration(JetMultiDeclaration declaration) { public void visitMultiDeclaration(@NotNull JetMultiDeclaration declaration) {
visitDeclaration(declaration); visitDeclaration(declaration);
} }
public void visitMultiDeclarationEntry(JetMultiDeclarationEntry entry) { public void visitMultiDeclarationEntry(@NotNull JetMultiDeclarationEntry entry) {
visitNamedDeclaration(entry); visitNamedDeclaration(entry);
} }
} }
@@ -193,7 +193,7 @@ public class BodyResolver {
} }
@Override @Override
public void visitDelegationByExpressionSpecifier(JetDelegatorByExpressionSpecifier specifier) { public void visitDelegationByExpressionSpecifier(@NotNull JetDelegatorByExpressionSpecifier specifier) {
if (descriptor.getKind() == ClassKind.TRAIT) { if (descriptor.getKind() == ClassKind.TRAIT) {
trace.report(DELEGATION_IN_TRAIT.on(specifier)); trace.report(DELEGATION_IN_TRAIT.on(specifier));
} }
@@ -224,7 +224,7 @@ public class BodyResolver {
} }
@Override @Override
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) { public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
JetValueArgumentList valueArgumentList = call.getValueArgumentList(); JetValueArgumentList valueArgumentList = call.getValueArgumentList();
PsiElement elementToMark = valueArgumentList == null ? call : valueArgumentList; PsiElement elementToMark = valueArgumentList == null ? call : valueArgumentList;
if (descriptor.getKind() == ClassKind.TRAIT) { if (descriptor.getKind() == ClassKind.TRAIT) {
@@ -256,7 +256,7 @@ public class BodyResolver {
} }
@Override @Override
public void visitDelegationToSuperClassSpecifier(JetDelegatorToSuperClass specifier) { public void visitDelegationToSuperClassSpecifier(@NotNull JetDelegatorToSuperClass specifier) {
JetTypeReference typeReference = specifier.getTypeReference(); JetTypeReference typeReference = specifier.getTypeReference();
JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, typeReference); JetType supertype = trace.getBindingContext().get(BindingContext.TYPE, typeReference);
recordSupertype(typeReference, supertype); recordSupertype(typeReference, supertype);
@@ -270,12 +270,12 @@ public class BodyResolver {
} }
@Override @Override
public void visitDelegationToThisCall(JetDelegatorToThisCall thisCall) { public void visitDelegationToThisCall(@NotNull JetDelegatorToThisCall thisCall) {
throw new IllegalStateException("This-calls should be prohibited by the parser"); throw new IllegalStateException("This-calls should be prohibited by the parser");
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
throw new UnsupportedOperationException(element.getText() + " : " + element); throw new UnsupportedOperationException(element.getText() + " : " + element);
} }
}; };
@@ -217,7 +217,7 @@ public class DeclarationResolver {
for (JetDeclaration declaration : declarations) { for (JetDeclaration declaration : declarations) {
declaration.accept(new JetVisitorVoid() { declaration.accept(new JetVisitorVoid() {
@Override @Override
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(@NotNull JetNamedFunction function) {
SimpleFunctionDescriptor functionDescriptor = descriptorResolver.resolveFunctionDescriptor( SimpleFunctionDescriptor functionDescriptor = descriptorResolver.resolveFunctionDescriptor(
namespaceLike.getOwnerForChildren(), namespaceLike.getOwnerForChildren(),
scopeForFunctions, scopeForFunctions,
@@ -231,7 +231,7 @@ public class DeclarationResolver {
} }
@Override @Override
public void visitProperty(JetProperty property) { public void visitProperty(@NotNull JetProperty property) {
PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor( PropertyDescriptor propertyDescriptor = descriptorResolver.resolvePropertyDescriptor(
namespaceLike.getOwnerForChildren(), namespaceLike.getOwnerForChildren(),
scopeForPropertyInitializers, scopeForPropertyInitializers,
@@ -252,7 +252,7 @@ public class DeclarationResolver {
} }
@Override @Override
public void visitObjectDeclaration(JetObjectDeclaration declaration) { public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
PropertyDescriptor propertyDescriptor = descriptorResolver.resolveObjectDeclarationAsPropertyDescriptor( PropertyDescriptor propertyDescriptor = descriptorResolver.resolveObjectDeclarationAsPropertyDescriptor(
scopeForFunctions, namespaceLike.getOwnerForChildren(), declaration, context.getObjects().get(declaration), trace); scopeForFunctions, namespaceLike.getOwnerForChildren(), declaration, context.getObjects().get(declaration), trace);
@@ -260,7 +260,7 @@ public class DeclarationResolver {
} }
@Override @Override
public void visitEnumEntry(JetEnumEntry enumEntry) { public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
// FIX: Bad cast // FIX: Bad cast
MutableClassDescriptorLite classObjectDescriptor = MutableClassDescriptorLite classObjectDescriptor =
((MutableClassDescriptorLite)namespaceLike.getOwnerForChildren()).getClassObjectDescriptor(); ((MutableClassDescriptorLite)namespaceLike.getOwnerForChildren()).getClassObjectDescriptor();
@@ -440,7 +440,7 @@ public class TypeHierarchyResolver {
} }
@Override @Override
public void visitJetFile(JetFile file) { public void visitJetFile(@NotNull JetFile file) {
NamespaceDescriptorImpl namespaceDescriptor = namespaceFactory.createNamespaceDescriptorPathIfNeeded( NamespaceDescriptorImpl namespaceDescriptor = namespaceFactory.createNamespaceDescriptorPathIfNeeded(
file, outerScope, RedeclarationHandler.DO_NOTHING); file, outerScope, RedeclarationHandler.DO_NOTHING);
context.getNamespaceDescriptors().put(file, namespaceDescriptor); context.getNamespaceDescriptors().put(file, namespaceDescriptor);
@@ -458,14 +458,14 @@ public class TypeHierarchyResolver {
} }
@Override @Override
public void visitClass(JetClass klass) { public void visitClass(@NotNull JetClass klass) {
MutableClassDescriptor mutableClassDescriptor = createClassDescriptorForClass(klass, owner.getOwnerForChildren()); MutableClassDescriptor mutableClassDescriptor = createClassDescriptorForClass(klass, owner.getOwnerForChildren());
owner.addClassifierDescriptor(mutableClassDescriptor); owner.addClassifierDescriptor(mutableClassDescriptor);
} }
@Override @Override
public void visitObjectDeclaration(JetObjectDeclaration declaration) { public void visitObjectDeclaration(@NotNull JetObjectDeclaration declaration) {
MutableClassDescriptor objectDescriptor = MutableClassDescriptor objectDescriptor =
createClassDescriptorForObject(declaration, owner, outerScope, JetPsiUtil.safeName(declaration.getName()), createClassDescriptorForObject(declaration, owner, outerScope, JetPsiUtil.safeName(declaration.getName()),
ClassKind.OBJECT); ClassKind.OBJECT);
@@ -474,7 +474,7 @@ public class TypeHierarchyResolver {
} }
@Override @Override
public void visitEnumEntry(JetEnumEntry enumEntry) { public void visitEnumEntry(@NotNull JetEnumEntry enumEntry) {
// TODO: Bad casting // TODO: Bad casting
MutableClassDescriptorLite ownerClassDescriptor = (MutableClassDescriptorLite) owner.getOwnerForChildren(); MutableClassDescriptorLite ownerClassDescriptor = (MutableClassDescriptorLite) owner.getOwnerForChildren();
MutableClassDescriptorLite classObjectDescriptor = ownerClassDescriptor.getClassObjectDescriptor(); MutableClassDescriptorLite classObjectDescriptor = ownerClassDescriptor.getClassObjectDescriptor();
@@ -484,12 +484,12 @@ public class TypeHierarchyResolver {
} }
@Override @Override
public void visitTypedef(JetTypedef typedef) { public void visitTypedef(@NotNull JetTypedef typedef) {
trace.report(UNSUPPORTED.on(typedef, "TypeHierarchyResolver")); trace.report(UNSUPPORTED.on(typedef, "TypeHierarchyResolver"));
} }
@Override @Override
public void visitClassObject(JetClassObject classObject) { public void visitClassObject(@NotNull JetClassObject classObject) {
JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration(); JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration();
if (objectDeclaration != null) { if (objectDeclaration != null) {
Name classObjectName = getClassObjectName(owner.getOwnerForChildren().getName()); Name classObjectName = getClassObjectName(owner.getOwnerForChildren().getName());
@@ -99,7 +99,7 @@ public class TypeResolver {
if (typeElement != null) { if (typeElement != null) {
typeElement.accept(new JetVisitorVoid() { typeElement.accept(new JetVisitorVoid() {
@Override @Override
public void visitUserType(JetUserType type) { public void visitUserType(@NotNull JetUserType type) {
JetSimpleNameExpression referenceExpression = type.getReferenceExpression(); JetSimpleNameExpression referenceExpression = type.getReferenceExpression();
String referencedName = type.getReferencedName(); String referencedName = type.getReferencedName();
if (referenceExpression == null || referencedName == null) { if (referenceExpression == null || referencedName == null) {
@@ -191,7 +191,7 @@ public class TypeResolver {
} }
@Override @Override
public void visitNullableType(JetNullableType nullableType) { public void visitNullableType(@NotNull JetNullableType nullableType) {
PossiblyBareType baseType = resolveTypeElement(c, annotations, nullableType.getInnerType()); PossiblyBareType baseType = resolveTypeElement(c, annotations, nullableType.getInnerType());
if (baseType.isNullable()) { if (baseType.isNullable()) {
c.trace.report(REDUNDANT_NULLABLE.on(nullableType)); c.trace.report(REDUNDANT_NULLABLE.on(nullableType));
@@ -203,7 +203,7 @@ public class TypeResolver {
} }
@Override @Override
public void visitFunctionType(JetFunctionType type) { public void visitFunctionType(@NotNull JetFunctionType type) {
JetTypeReference receiverTypeRef = type.getReceiverTypeRef(); JetTypeReference receiverTypeRef = type.getReceiverTypeRef();
JetType receiverType = receiverTypeRef == null ? null : resolveType(c.noBareTypes(), receiverTypeRef); JetType receiverType = receiverTypeRef == null ? null : resolveType(c.noBareTypes(), receiverTypeRef);
@@ -224,7 +224,7 @@ public class TypeResolver {
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
c.trace.report(UNSUPPORTED.on(element, "Self-types are not supported yet")); c.trace.report(UNSUPPORTED.on(element, "Self-types are not supported yet"));
} }
}); });
@@ -1143,7 +1143,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
entry.accept(new JetVisitorVoid() { entry.accept(new JetVisitorVoid() {
@Override @Override
public void visitStringTemplateEntryWithExpression(JetStringTemplateEntryWithExpression entry) { public void visitStringTemplateEntryWithExpression(@NotNull JetStringTemplateEntryWithExpression entry) {
JetExpression entryExpression = entry.getExpression(); JetExpression entryExpression = entry.getExpression();
if (entryExpression != null) { if (entryExpression != null) {
JetTypeInfo typeInfo = facade.getTypeInfo(entryExpression, context.replaceDataFlowInfo(dataFlowInfo[0])); JetTypeInfo typeInfo = facade.getTypeInfo(entryExpression, context.replaceDataFlowInfo(dataFlowInfo[0]));
@@ -1153,12 +1153,12 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
} }
@Override @Override
public void visitLiteralStringTemplateEntry(JetLiteralStringTemplateEntry entry) { public void visitLiteralStringTemplateEntry(@NotNull JetLiteralStringTemplateEntry entry) {
builder.append(entry.getText()); builder.append(entry.getText());
} }
@Override @Override
public void visitEscapeStringTemplateEntry(JetEscapeStringTemplateEntry entry) { public void visitEscapeStringTemplateEntry(@NotNull JetEscapeStringTemplateEntry entry) {
CompileTimeConstant<?> character = CompileTimeConstantResolver.escapedStringToCharValue(entry.getText(), entry); CompileTimeConstant<?> character = CompileTimeConstantResolver.escapedStringToCharValue(entry.getText(), entry);
if (character instanceof ErrorValue) { if (character instanceof ErrorValue) {
assert character instanceof ErrorValueWithDiagnostic; assert character instanceof ErrorValueWithDiagnostic;
@@ -51,14 +51,14 @@ public class DataFlowUtils {
final Ref<DataFlowInfo> result = new Ref<DataFlowInfo>(null); final Ref<DataFlowInfo> result = new Ref<DataFlowInfo>(null);
condition.accept(new JetVisitorVoid() { condition.accept(new JetVisitorVoid() {
@Override @Override
public void visitIsExpression(JetIsExpression expression) { public void visitIsExpression(@NotNull JetIsExpression expression) {
if (conditionValue && !expression.isNegated() || !conditionValue && expression.isNegated()) { if (conditionValue && !expression.isNegated() || !conditionValue && expression.isNegated()) {
result.set(context.trace.get(BindingContext.DATAFLOW_INFO_AFTER_CONDITION, expression)); result.set(context.trace.get(BindingContext.DATAFLOW_INFO_AFTER_CONDITION, expression));
} }
} }
@Override @Override
public void visitBinaryExpression(JetBinaryExpression expression) { public void visitBinaryExpression(@NotNull JetBinaryExpression expression) {
IElementType operationToken = expression.getOperationToken(); IElementType operationToken = expression.getOperationToken();
if (OperatorConventions.BOOLEAN_OPERATIONS.containsKey(operationToken)) { if (OperatorConventions.BOOLEAN_OPERATIONS.containsKey(operationToken)) {
DataFlowInfo dataFlowInfo = extractDataFlowInfoFromCondition(expression.getLeft(), conditionValue, context); DataFlowInfo dataFlowInfo = extractDataFlowInfoFromCondition(expression.getLeft(), conditionValue, context);
@@ -110,7 +110,7 @@ public class DataFlowUtils {
} }
@Override @Override
public void visitUnaryExpression(JetUnaryExpression expression) { public void visitUnaryExpression(@NotNull JetUnaryExpression expression) {
IElementType operationTokenType = expression.getOperationReference().getReferencedNameElementType(); IElementType operationTokenType = expression.getOperationReference().getReferencedNameElementType();
if (operationTokenType == JetTokens.EXCL) { if (operationTokenType == JetTokens.EXCL) {
JetExpression baseExpression = expression.getBaseExpression(); JetExpression baseExpression = expression.getBaseExpression();
@@ -121,7 +121,7 @@ public class DataFlowUtils {
} }
@Override @Override
public void visitParenthesizedExpression(JetParenthesizedExpression expression) { public void visitParenthesizedExpression(@NotNull JetParenthesizedExpression expression) {
JetExpression body = expression.getExpression(); JetExpression body = expression.getExpression();
if (body != null) { if (body != null) {
body.accept(this); body.accept(this);
@@ -178,7 +178,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
final Ref<DataFlowInfos> newDataFlowInfo = new Ref<DataFlowInfos>(noChange(context)); final Ref<DataFlowInfos> newDataFlowInfo = new Ref<DataFlowInfos>(noChange(context));
condition.accept(new JetVisitorVoid() { condition.accept(new JetVisitorVoid() {
@Override @Override
public void visitWhenConditionInRange(JetWhenConditionInRange condition) { public void visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition) {
JetExpression rangeExpression = condition.getRangeExpression(); JetExpression rangeExpression = condition.getRangeExpression();
if (rangeExpression == null) return; if (rangeExpression == null) return;
if (expectedCondition) { if (expectedCondition) {
@@ -197,7 +197,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
} }
@Override @Override
public void visitWhenConditionIsPattern(JetWhenConditionIsPattern condition) { public void visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition) {
if (expectedCondition) { if (expectedCondition) {
context.trace.report(EXPECTED_CONDITION.on(condition)); context.trace.report(EXPECTED_CONDITION.on(condition));
} }
@@ -213,7 +213,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
} }
@Override @Override
public void visitWhenConditionWithExpression(JetWhenConditionWithExpression condition) { public void visitWhenConditionWithExpression(@NotNull JetWhenConditionWithExpression condition) {
JetExpression expression = condition.getExpression(); JetExpression expression = condition.getExpression();
if (expression != null) { if (expression != null) {
newDataFlowInfo.set(checkTypeForExpressionCondition(context, expression, subjectType, subjectExpression == null, newDataFlowInfo.set(checkTypeForExpressionCondition(context, expression, subjectType, subjectExpression == null,
@@ -222,7 +222,7 @@ public class PatternMatchingTypingVisitor extends ExpressionTypingVisitor {
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName())); context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
} }
}); });
@@ -63,7 +63,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>(); final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
psiFile.accept(new JetVisitorVoid() { psiFile.accept(new JetVisitorVoid() {
@Override @Override
public void visitJetFile(JetFile file) { public void visitJetFile(@NotNull JetFile file) {
String qualifiedName = file.getNamespaceHeader().getQualifiedName(); String qualifiedName = file.getNamespaceHeader().getQualifiedName();
if (!qualifiedName.isEmpty()) { if (!qualifiedName.isEmpty()) {
NamespaceDescriptor packageDescriptor = resolveSession.getPackageDescriptorByFqName(new FqName(qualifiedName)); NamespaceDescriptor packageDescriptor = resolveSession.getPackageDescriptorByFqName(new FqName(qualifiedName));
@@ -73,12 +73,12 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
} }
@Override @Override
public void visitClassObject(JetClassObject classObject) { public void visitClassObject(@NotNull JetClassObject classObject) {
classObject.acceptChildren(this); classObject.acceptChildren(this);
} }
@Override @Override
public void visitParameter(JetParameter parameter) { public void visitParameter(@NotNull JetParameter parameter) {
PsiElement declaringElement = parameter.getParent().getParent(); PsiElement declaringElement = parameter.getParent().getParent();
if (declaringElement instanceof JetFunctionType) { if (declaringElement instanceof JetFunctionType) {
return; return;
@@ -108,7 +108,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
} }
@Override @Override
public void visitPropertyAccessor(JetPropertyAccessor accessor) { public void visitPropertyAccessor(@NotNull JetPropertyAccessor accessor) {
JetProperty parent = (JetProperty) accessor.getParent(); JetProperty parent = (JetProperty) accessor.getParent();
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) resolveSession.resolveToDescriptor(parent); PropertyDescriptor propertyDescriptor = (PropertyDescriptor) resolveSession.resolveToDescriptor(parent);
if (accessor.isGetter()) { if (accessor.isGetter()) {
@@ -120,7 +120,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
} }
@Override @Override
public void visitDeclaration(JetDeclaration element) { public void visitDeclaration(@NotNull JetDeclaration element) {
DeclarationDescriptor descriptor = resolveSession.resolveToDescriptor(element); DeclarationDescriptor descriptor = resolveSession.resolveToDescriptor(element);
descriptors.add(descriptor); descriptors.add(descriptor);
if (descriptor instanceof ClassDescriptor) { if (descriptor instanceof ClassDescriptor) {
@@ -130,7 +130,7 @@ public abstract class AbstractLazyResolveDescriptorRendererTest extends KotlinTe
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
element.acceptChildren(this); element.acceptChildren(this);
} }
}); });
@@ -77,7 +77,7 @@ public abstract class AbstractJetParsingTest extends ParsingTestCase {
myFile.acceptChildren(new JetVisitorVoid() { myFile.acceptChildren(new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
element.acceptChildren(this); element.acceptChildren(this);
try { try {
checkPsiGetters(element); checkPsiGetters(element);
@@ -18,6 +18,7 @@ package org.jetbrains.jet.renderer;
import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.editor.impl.DocumentImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.JetLiteFixture; import org.jetbrains.jet.JetLiteFixture;
import org.jetbrains.jet.JetTestCaseBuilder; import org.jetbrains.jet.JetTestCaseBuilder;
@@ -95,7 +96,7 @@ public class DescriptorRendererTest extends JetLiteFixture {
final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>(); final List<DeclarationDescriptor> descriptors = new ArrayList<DeclarationDescriptor>();
psiFile.acceptChildren(new JetVisitorVoid() { psiFile.acceptChildren(new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element); DeclarationDescriptor descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, element);
if (descriptor != null) { if (descriptor != null) {
descriptors.add(descriptor); descriptors.add(descriptor);
@@ -17,6 +17,7 @@
package org.jetbrains.jet.plugin.codeInsight; package org.jetbrains.jet.plugin.codeInsight;
import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiDocumentManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor; import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
@@ -44,12 +45,12 @@ public class ReferenceToClassesShortening {
for (JetElement element : elementsToCompact) { for (JetElement element : elementsToCompact) {
element.accept(new JetVisitorVoid() { element.accept(new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
element.acceptChildren(this); element.acceptChildren(this);
} }
@Override @Override
public void visitTypeReference(JetTypeReference typeReference) { public void visitTypeReference(@NotNull JetTypeReference typeReference) {
super.visitTypeReference(typeReference); super.visitTypeReference(typeReference);
JetTypeElement typeElement = typeReference.getTypeElement(); JetTypeElement typeElement = typeReference.getTypeElement();
@@ -34,7 +34,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
declaration.accept( declaration.accept(
new JetVisitorVoid() { new JetVisitorVoid() {
@Override @Override
public void visitAnonymousInitializer(JetClassInitializer initializer) { public void visitAnonymousInitializer(@NotNull JetClassInitializer initializer) {
PsiElement brace = initializer.getOpenBraceNode(); PsiElement brace = initializer.getOpenBraceNode();
if (brace != null) { if (brace != null) {
memberSuspects.add(brace); memberSuspects.add(brace);
@@ -42,13 +42,13 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
} }
@Override @Override
public void visitClassObject(JetClassObject classObject) { public void visitClassObject(@NotNull JetClassObject classObject) {
PsiElement classKeyword = classObject.getClassKeywordNode(); PsiElement classKeyword = classObject.getClassKeywordNode();
if (classKeyword != null) memberSuspects.add(classKeyword); if (classKeyword != null) memberSuspects.add(classKeyword);
} }
@Override @Override
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(@NotNull JetNamedFunction function) {
PsiElement equalsToken = function.getEqualsToken(); PsiElement equalsToken = function.getEqualsToken();
if (equalsToken != null) memberSuspects.add(equalsToken); if (equalsToken != null) memberSuspects.add(equalsToken);
@@ -63,7 +63,7 @@ public class JetDeclarationMover extends AbstractJetUpDownMover {
} }
@Override @Override
public void visitProperty(JetProperty property) { public void visitProperty(@NotNull JetProperty property) {
PsiElement valOrVarNode = property.getValOrVarNode().getPsi(); PsiElement valOrVarNode = property.getValOrVarNode().getPsi();
if (valOrVarNode != null) memberSuspects.add(valOrVarNode); if (valOrVarNode != null) memberSuspects.add(valOrVarNode);
@@ -116,7 +116,7 @@ public class JetImportOptimizer implements ImportOptimizer {
} }
@Override @Override
public void visitUserType(JetUserType type) { public void visitUserType(@NotNull JetUserType type) {
if (type.getQualifier() == null) { if (type.getQualifier() == null) {
super.visitUserType(type); super.visitUserType(type);
} }
@@ -130,7 +130,7 @@ public class JetImportOptimizer implements ImportOptimizer {
} }
@Override @Override
public void visitReferenceExpression(JetReferenceExpression expression) { public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
if (PsiTreeUtil.getParentOfType(expression, JetImportDirective.class) == null && if (PsiTreeUtil.getParentOfType(expression, JetImportDirective.class) == null &&
PsiTreeUtil.getParentOfType(expression, JetNamespaceHeader.class) == null) { PsiTreeUtil.getParentOfType(expression, JetNamespaceHeader.class) == null) {
@@ -161,7 +161,7 @@ public class JetImportOptimizer implements ImportOptimizer {
} }
@Override @Override
public void visitForExpression(JetForExpression expression) { public void visitForExpression(@NotNull JetForExpression expression) {
BindingContext context = AnalyzerFacadeWithCache.getContextForElement(expression); BindingContext context = AnalyzerFacadeWithCache.getContextForElement(expression);
ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL, expression.getLoopRange()); ResolvedCall<FunctionDescriptor> resolvedCall = context.get(BindingContext.LOOP_RANGE_ITERATOR_RESOLVED_CALL, expression.getLoopRange());
addResolvedCallFqName(resolvedCall); addResolvedCallFqName(resolvedCall);
@@ -170,7 +170,7 @@ public class JetImportOptimizer implements ImportOptimizer {
} }
@Override @Override
public void visitMultiDeclaration(JetMultiDeclaration declaration) { public void visitMultiDeclaration(@NotNull JetMultiDeclaration declaration) {
BindingContext context = AnalyzerFacadeWithCache.getContextForElement(declaration); BindingContext context = AnalyzerFacadeWithCache.getContextForElement(declaration);
List<JetMultiDeclarationEntry> entries = declaration.getEntries(); List<JetMultiDeclarationEntry> entries = declaration.getEntries();
for (JetMultiDeclarationEntry entry : entries) { for (JetMultiDeclarationEntry entry : entries) {
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin.hierarchy.calls;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiMethod;
import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor; import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor; import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
@@ -38,14 +39,14 @@ public abstract class CalleeReferenceVisitorBase extends JetTreeVisitorVoid {
protected abstract void processDeclaration(JetReferenceExpression reference, PsiElement declaration); protected abstract void processDeclaration(JetReferenceExpression reference, PsiElement declaration);
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
if (deepTraversal || !(element instanceof JetClassOrObject || element instanceof JetNamedFunction)) { if (deepTraversal || !(element instanceof JetClassOrObject || element instanceof JetNamedFunction)) {
super.visitJetElement(element); super.visitJetElement(element);
} }
} }
@Override @Override
public void visitSimpleNameExpression(JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression); DeclarationDescriptor descriptor = bindingContext.get(BindingContext.REFERENCE_TARGET, expression);
if (descriptor == null) return; if (descriptor == null) return;
@@ -51,12 +51,12 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
} }
@Override @Override
public void visitSuperExpression(JetSuperExpression expression) { public void visitSuperExpression(@NotNull JetSuperExpression expression) {
// Deprecated for super expression. Unnecessary to mark it as Deprecated // Deprecated for super expression. Unnecessary to mark it as Deprecated
} }
@Override @Override
public void visitReferenceExpression(JetReferenceExpression expression) { public void visitReferenceExpression(@NotNull JetReferenceExpression expression) {
super.visitReferenceExpression(expression); super.visitReferenceExpression(expression);
ResolvedCall resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression); ResolvedCall resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, expression);
if (resolvedCall != null && resolvedCall instanceof VariableAsFunctionResolvedCall) { if (resolvedCall != null && resolvedCall instanceof VariableAsFunctionResolvedCall) {
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.highlighter;
import com.intellij.lang.annotation.AnnotationHolder; import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
@@ -34,7 +35,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
} }
@Override @Override
public void visitNamedFunction(JetNamedFunction function) { public void visitNamedFunction(@NotNull JetNamedFunction function) {
PsiElement nameIdentifier = function.getNameIdentifier(); PsiElement nameIdentifier = function.getNameIdentifier();
if (nameIdentifier != null) { if (nameIdentifier != null) {
JetPsiChecker.highlightName(holder, nameIdentifier, JetHighlightingColors.FUNCTION_DECLARATION); JetPsiChecker.highlightName(holder, nameIdentifier, JetHighlightingColors.FUNCTION_DECLARATION);
@@ -44,7 +45,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
} }
@Override @Override
public void visitDelegationToSuperCallSpecifier(JetDelegatorToSuperCall call) { public void visitDelegationToSuperCallSpecifier(@NotNull JetDelegatorToSuperCall call) {
JetConstructorCalleeExpression calleeExpression = call.getCalleeExpression(); JetConstructorCalleeExpression calleeExpression = call.getCalleeExpression();
JetTypeReference typeRef = calleeExpression.getTypeReference(); JetTypeReference typeRef = calleeExpression.getTypeReference();
if (typeRef != null) { if (typeRef != null) {
@@ -60,7 +61,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
} }
@Override @Override
public void visitCallExpression(JetCallExpression expression) { public void visitCallExpression(@NotNull JetCallExpression expression) {
JetExpression callee = expression.getCalleeExpression(); JetExpression callee = expression.getCalleeExpression();
if (callee instanceof JetReferenceExpression) { if (callee instanceof JetReferenceExpression) {
ResolvedCall<? extends CallableDescriptor> resolvedCall = ResolvedCall<? extends CallableDescriptor> resolvedCall =
@@ -17,6 +17,7 @@
package org.jetbrains.jet.plugin.highlighter; package org.jetbrains.jet.plugin.highlighter;
import com.intellij.lang.annotation.AnnotationHolder; import com.intellij.lang.annotation.AnnotationHolder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.JetLabelQualifiedExpression; import org.jetbrains.jet.lang.psi.JetLabelQualifiedExpression;
import org.jetbrains.jet.lang.psi.JetPrefixExpression; import org.jetbrains.jet.lang.psi.JetPrefixExpression;
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression; import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
@@ -28,7 +29,7 @@ class LabelsHighlightingVisitor extends HighlightingVisitor {
} }
@Override @Override
public void visitPrefixExpression(JetPrefixExpression expression) { public void visitPrefixExpression(@NotNull JetPrefixExpression expression) {
JetSimpleNameExpression operationSign = expression.getOperationReference(); JetSimpleNameExpression operationSign = expression.getOperationReference();
if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) { if (JetTokens.LABELS.contains(operationSign.getReferencedNameElementType())) {
JetPsiChecker.highlightName(holder, operationSign, JetHighlightingColors.LABEL); JetPsiChecker.highlightName(holder, operationSign, JetHighlightingColors.LABEL);
@@ -36,7 +37,7 @@ class LabelsHighlightingVisitor extends HighlightingVisitor {
} }
@Override @Override
public void visitLabelQualifiedExpression(JetLabelQualifiedExpression expression) { public void visitLabelQualifiedExpression(@NotNull JetLabelQualifiedExpression expression) {
JetSimpleNameExpression targetLabel = expression.getTargetLabel(); JetSimpleNameExpression targetLabel = expression.getTargetLabel();
if (targetLabel != null) { if (targetLabel != null) {
JetPsiChecker.highlightName(holder, targetLabel, JetHighlightingColors.LABEL); JetPsiChecker.highlightName(holder, targetLabel, JetHighlightingColors.LABEL);
@@ -34,7 +34,7 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
} }
@Override @Override
public void visitSimpleNameExpression(JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
if (expression.getParent() instanceof JetThisExpression) { if (expression.getParent() instanceof JetThisExpression) {
return; return;
} }
@@ -23,6 +23,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafPsiElement; import com.intellij.psi.impl.source.tree.LeafPsiElement;
import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lexer.JetTokens; import org.jetbrains.jet.lexer.JetTokens;
@@ -49,7 +50,7 @@ class SoftKeywordsHighlightingVisitor extends HighlightingVisitor {
} }
@Override @Override
public void visitFunctionLiteralExpression(JetFunctionLiteralExpression expression) { public void visitFunctionLiteralExpression(@NotNull JetFunctionLiteralExpression expression) {
if (ApplicationManager.getApplication().isUnitTestMode()) return; if (ApplicationManager.getApplication().isUnitTestMode()) return;
JetFunctionLiteral functionLiteral = expression.getFunctionLiteral(); JetFunctionLiteral functionLiteral = expression.getFunctionLiteral();
holder.createInfoAnnotation(functionLiteral.getOpenBraceNode(), null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW); holder.createInfoAnnotation(functionLiteral.getOpenBraceNode(), null).setTextAttributes(JetHighlightingColors.FUNCTION_LITERAL_BRACES_AND_ARROW);
@@ -31,7 +31,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
} }
@Override @Override
public void visitSimpleNameExpression(JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
PsiReference ref = expression.getReference(); PsiReference ref = expression.getReference();
if (ref == null) return; if (ref == null) return;
if (JetPsiChecker.isNamesHighlightingEnabled()) { if (JetPsiChecker.isNamesHighlightingEnabled()) {
@@ -50,7 +50,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
} }
@Override @Override
public void visitTypeParameter(JetTypeParameter parameter) { public void visitTypeParameter(@NotNull JetTypeParameter parameter) {
PsiElement identifier = parameter.getNameIdentifier(); PsiElement identifier = parameter.getNameIdentifier();
if (identifier != null) { if (identifier != null) {
JetPsiChecker.highlightName(holder, identifier, JetHighlightingColors.TYPE_PARAMETER); JetPsiChecker.highlightName(holder, identifier, JetHighlightingColors.TYPE_PARAMETER);
@@ -59,7 +59,7 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
} }
@Override @Override
public void visitClass(JetClass klass) { public void visitClass(@NotNull JetClass klass) {
PsiElement identifier = klass.getNameIdentifier(); PsiElement identifier = klass.getNameIdentifier();
ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, klass); ClassDescriptor classDescriptor = bindingContext.get(BindingContext.CLASS, klass);
if (identifier != null && classDescriptor != null) { if (identifier != null && classDescriptor != null) {
@@ -59,7 +59,7 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
} }
@Override @Override
public void visitParameter(JetParameter parameter) { public void visitParameter(@NotNull JetParameter parameter) {
visitVariableDeclaration(parameter); visitVariableDeclaration(parameter);
super.visitParameter(parameter); super.visitParameter(parameter);
} }
@@ -106,7 +106,7 @@ public class MigrateSureInProjectFix extends JetIntentionAction<PsiElement> {
declaration.acceptChildren(new JetVisitorVoid() { declaration.acceptChildren(new JetVisitorVoid() {
@Override @Override
public void visitCallExpression(JetCallExpression expression) { public void visitCallExpression(@NotNull JetCallExpression expression) {
expression.acceptChildren(this); expression.acceptChildren(this);
if (!isUnresolvedSure(expression.getCalleeExpression())) return; if (!isUnresolvedSure(expression.getCalleeExpression())) return;
@@ -57,7 +57,7 @@ public class RemoveValVarFromParametersFix implements IntentionAction {
for (JetFile jetFile : files) { for (JetFile jetFile : files) {
jetFile.acceptChildren(new JetVisitorVoid() { jetFile.acceptChildren(new JetVisitorVoid() {
@Override @Override
public void visitParameter(JetParameter parameter) { public void visitParameter(@NotNull JetParameter parameter) {
visitJetElement(parameter); // run recursively for children visitJetElement(parameter); // run recursively for children
PsiElement parent = parameter.getParent(); PsiElement parent = parameter.getParent();
@@ -75,7 +75,7 @@ public class RemoveValVarFromParametersFix implements IntentionAction {
} }
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
element.acceptChildren(this); element.acceptChildren(this);
} }
}); });
@@ -19,6 +19,7 @@ package org.jetbrains.jet.plugin.refactoring;
import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil; import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.psi.*; import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
@@ -213,13 +214,13 @@ public class JetNameSuggester {
private static void addNamesForExpression(final ArrayList<String> result, JetExpression expression, final JetNameValidator validator) { private static void addNamesForExpression(final ArrayList<String> result, JetExpression expression, final JetNameValidator validator) {
expression.accept(new JetVisitorVoid() { expression.accept(new JetVisitorVoid() {
@Override @Override
public void visitQualifiedExpression(JetQualifiedExpression expression) { public void visitQualifiedExpression(@NotNull JetQualifiedExpression expression) {
JetExpression selectorExpression = expression.getSelectorExpression(); JetExpression selectorExpression = expression.getSelectorExpression();
addNamesForExpression(result, selectorExpression, validator); addNamesForExpression(result, selectorExpression, validator);
} }
@Override @Override
public void visitSimpleNameExpression(JetSimpleNameExpression expression) { public void visitSimpleNameExpression(@NotNull JetSimpleNameExpression expression) {
String referenceName = expression.getReferencedName(); String referenceName = expression.getReferencedName();
if (referenceName.equals(referenceName.toUpperCase())) { if (referenceName.equals(referenceName.toUpperCase())) {
addName(result, referenceName, validator); addName(result, referenceName, validator);
@@ -230,12 +231,12 @@ public class JetNameSuggester {
} }
@Override @Override
public void visitCallExpression(JetCallExpression expression) { public void visitCallExpression(@NotNull JetCallExpression expression) {
addNamesForExpression(result, expression.getCalleeExpression(), validator); addNamesForExpression(result, expression.getCalleeExpression(), validator);
} }
@Override @Override
public void visitPostfixExpression(JetPostfixExpression expression) { public void visitPostfixExpression(@NotNull JetPostfixExpression expression) {
addNamesForExpression(result, expression.getBaseExpression(), validator); addNamesForExpression(result, expression.getBaseExpression(), validator);
} }
}); });
@@ -18,6 +18,7 @@ package org.jetbrains.jet.plugin.refactoring;
import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.VariableDescriptor; import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
import org.jetbrains.jet.lang.psi.JetExpression; import org.jetbrains.jet.lang.psi.JetExpression;
@@ -79,7 +80,7 @@ public class JetNameValidatorImpl extends JetNameValidator {
} }
@Override @Override
public void visitExpression(JetExpression expression) { public void visitExpression(@NotNull JetExpression expression) {
Collection<DeclarationDescriptor> variants = Collection<DeclarationDescriptor> variants =
TipsManager.getVariantsNoReceiver(expression, myBindingContext); TipsManager.getVariantsNoReceiver(expression, myBindingContext);
for (DeclarationDescriptor variant : variants) { for (DeclarationDescriptor variant : variants) {
@@ -437,13 +437,13 @@ public class JetIntroduceVariableHandler extends JetIntroduceHandlerBase {
JetVisitorVoid visitor = new JetVisitorVoid() { JetVisitorVoid visitor = new JetVisitorVoid() {
@Override @Override
public void visitJetElement(JetElement element) { public void visitJetElement(@NotNull JetElement element) {
element.acceptChildren(this); element.acceptChildren(this);
super.visitJetElement(element); super.visitJetElement(element);
} }
@Override @Override
public void visitExpression(JetExpression expression) { public void visitExpression(@NotNull JetExpression expression) {
if (PsiEquivalenceUtil.areElementsEquivalent(expression, actualExpression, null, new Comparator<PsiElement>() { if (PsiEquivalenceUtil.areElementsEquivalent(expression, actualExpression, null, new Comparator<PsiElement>() {
@Override @Override
public int compare(PsiElement element1, PsiElement element2) { public int compare(PsiElement element1, PsiElement element2) {