cleanup
This commit is contained in:
@@ -18,7 +18,7 @@ public class Class extends Member {
|
||||
String TYPE = "class";
|
||||
final Identifier myName;
|
||||
private final List<Expression> myBaseClassParams;
|
||||
private List<? extends Member> myMembers;
|
||||
private final List<? extends Member> myMembers;
|
||||
private final List<Element> myTypeParameters;
|
||||
private final List<Type> myExtendsTypes;
|
||||
private final List<Type> myImplementsTypes;
|
||||
@@ -174,7 +174,7 @@ public class Class extends Member {
|
||||
"}";
|
||||
}
|
||||
|
||||
private List<Member> getStatic(List<? extends Member> members) {
|
||||
private static List<Member> getStatic(List<? extends Member> members) {
|
||||
List<Member> result = new LinkedList<Member>();
|
||||
for (Member m : members)
|
||||
if (m.isStatic())
|
||||
@@ -182,7 +182,7 @@ public class Class extends Member {
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Member> getNonStatic(List<? extends Member> members) {
|
||||
private static List<Member> getNonStatic(List<? extends Member> members) {
|
||||
List<Member> result = new LinkedList<Member>();
|
||||
for (Member m : members)
|
||||
if (!m.isStatic())
|
||||
|
||||
@@ -16,7 +16,7 @@ public class DeclarationStatement extends Statement {
|
||||
myElements = elements;
|
||||
}
|
||||
|
||||
private List<String> toStringList(List<Element> elements) {
|
||||
private static List<String> toStringList(List<Element> elements) {
|
||||
List<String> result = new LinkedList<String>();
|
||||
for (Element e : elements) {
|
||||
if (e instanceof LocalVariable) {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class IdentifierImpl extends Expression implements Identifier {
|
||||
return myName.length() == 0;
|
||||
}
|
||||
|
||||
private String quote(String str) {
|
||||
private static String quote(String str) {
|
||||
return BACKTICK + str + BACKTICK;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class MethodCallExpression extends Expression {
|
||||
private final Expression myMethodCall;
|
||||
private final Element myParamList;
|
||||
private final boolean myIsResultNullable;
|
||||
private List<Type> myTypeParameters;
|
||||
private final List<Type> myTypeParameters;
|
||||
|
||||
public MethodCallExpression(Expression methodCall, Element paramList, boolean nullable, List<Type> typeParameters) {
|
||||
myMethodCall = methodCall;
|
||||
|
||||
@@ -9,8 +9,8 @@ import java.util.List;
|
||||
* @author ignatov
|
||||
*/
|
||||
public class ReferenceElement extends Element {
|
||||
private Identifier myReference;
|
||||
private List<Type> myTypes;
|
||||
private final Identifier myReference;
|
||||
private final List<Type> myTypes;
|
||||
|
||||
public ReferenceElement(@NotNull Identifier reference, @NotNull List<Type> types) {
|
||||
myReference = reference;
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getOperatorString(@NotNull IElementType tokenType) {
|
||||
private static String getOperatorString(@NotNull IElementType tokenType) {
|
||||
if (tokenType == JavaTokenType.PLUS) return "+";
|
||||
if (tokenType == JavaTokenType.MINUS) return "-";
|
||||
if (tokenType == JavaTokenType.ASTERISK) return "*";
|
||||
@@ -197,7 +197,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Expression createNewClassExpression(@NotNull PsiNewExpression expression) {
|
||||
private static Expression createNewClassExpression(@NotNull PsiNewExpression expression) {
|
||||
final PsiAnonymousClass anonymousClass = expression.getAnonymousClass();
|
||||
final PsiMethod constructor = expression.resolveMethod();
|
||||
if (constructor == null || isConstructorPrimary(constructor)) {
|
||||
@@ -209,7 +209,8 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
);
|
||||
}
|
||||
// is constructor secondary
|
||||
final List<Type> typeParameters = expression.getClassReference() != null ? typesToTypeList(expression.getClassReference().getTypeParameters()) : Collections.<Type>emptyList();
|
||||
final PsiJavaCodeReferenceElement reference = expression.getClassReference();
|
||||
final List<Type> typeParameters = reference != null ? typesToTypeList(reference.getTypeParameters()) : Collections.<Type>emptyList();
|
||||
return new CallChainExpression(
|
||||
new IdentifierImpl(constructor.getName(), false),
|
||||
new MethodCallExpression(
|
||||
@@ -220,7 +221,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private NewClassExpression createNewNonEmptyArray(@NotNull PsiNewExpression expression) {
|
||||
private static NewClassExpression createNewNonEmptyArray(@NotNull PsiNewExpression expression) {
|
||||
final List<Expression> callExpression = expressionsToExpressionList(expression.getArrayDimensions());
|
||||
callExpression.add(new IdentifierImpl("{null}")); // TODO: remove
|
||||
return new NewClassExpression(
|
||||
@@ -291,7 +292,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String getClassName(PsiReferenceExpression expression) {
|
||||
private static String getClassName(@NotNull PsiReferenceExpression expression) {
|
||||
PsiElement context = expression.getContext();
|
||||
while (context != null) {
|
||||
if (context instanceof PsiMethod && ((PsiMethod) context).isConstructor()) {
|
||||
@@ -307,7 +308,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
return "";
|
||||
}
|
||||
|
||||
private boolean isFieldReference(PsiReferenceExpression expression, PsiClass currentClass) {
|
||||
private static boolean isFieldReference(@NotNull PsiReferenceExpression expression, PsiClass currentClass) {
|
||||
final PsiReference reference = expression.getReference();
|
||||
if (reference != null) {
|
||||
final PsiElement resolvedReference = reference.resolve();
|
||||
@@ -320,7 +321,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInsideSecondaryConstructor(PsiReferenceExpression expression) {
|
||||
private static boolean isInsideSecondaryConstructor(PsiReferenceExpression expression) {
|
||||
PsiElement context = expression.getContext();
|
||||
while (context != null) {
|
||||
if (context instanceof PsiMethod && ((PsiMethod) context).isConstructor())
|
||||
@@ -330,7 +331,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isInsidePrimaryConstructor(PsiExpression expression) {
|
||||
private static boolean isInsidePrimaryConstructor(PsiExpression expression) {
|
||||
PsiElement context = expression.getContext();
|
||||
while (context != null) {
|
||||
if (context instanceof PsiMethod && ((PsiMethod) context).isConstructor())
|
||||
@@ -341,7 +342,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private PsiClass getContainingClass(@NotNull PsiExpression expression) {
|
||||
private static PsiClass getContainingClass(@NotNull PsiExpression expression) {
|
||||
PsiElement context = expression.getContext();
|
||||
while (context != null) {
|
||||
if (context instanceof PsiMethod && ((PsiMethod) context).isConstructor())
|
||||
@@ -351,7 +352,7 @@ public class ExpressionVisitor extends StatementVisitor {
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isThisExpression(PsiReferenceExpression expression) {
|
||||
private static boolean isThisExpression(PsiReferenceExpression expression) {
|
||||
for (PsiReference r : expression.getReferences())
|
||||
if (r.getCanonicalText().equals("this")) {
|
||||
final PsiElement res = r.resolve();
|
||||
|
||||
Reference in New Issue
Block a user