made fields final, cleanup

This commit is contained in:
Alexey Kudravtsev
2013-11-01 18:07:30 +04:00
parent ba6b81fc8f
commit 6bdf2d1d39
98 changed files with 293 additions and 242 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,6 @@ import org.jetbrains.annotations.NotNull;
public class JavadocWhiteSpaceFormattingStrategy extends WhiteSpaceFormattingStrategyAdapter {
@Override
public boolean containsWhitespacesOnly(@NotNull final ASTNode node) {
return node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA && node.textContains('\n') && node.getText().trim().length() == 0;
return node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA && node.textContains('\n') && node.getText().trim().isEmpty();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,9 +38,9 @@ public class BlockContainingJavaBlock extends AbstractJavaBlock{
JavaElementType.IF_STATEMENT, JavaElementType.WHILE_STATEMENT, JavaElementType.FOR_STATEMENT
);
private final static int BEFORE_FIRST = 0;
private final static int BEFORE_BLOCK = 1;
private final static int AFTER_ELSE = 2;
private static final int BEFORE_FIRST = 0;
private static final int BEFORE_BLOCK = 1;
private static final int AFTER_ELSE = 2;
private final List<Indent> myIndentsBefore = new ArrayList<Indent>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,9 +36,9 @@ import java.util.ArrayList;
import java.util.List;
public class CodeBlockBlock extends AbstractJavaBlock {
private final static int BEFORE_FIRST = 0;
private final static int BEFORE_LBRACE = 1;
private final static int INSIDE_BODY = 2;
private static final int BEFORE_FIRST = 0;
private static final int BEFORE_LBRACE = 1;
private static final int INSIDE_BODY = 2;
private final int myChildrenIndent;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ import java.util.List;
* @author nik
*/
public class CommentWithInjectionBlock extends AbstractJavaBlock {
private InjectedLanguageBlockBuilder myInjectedBlockBuilder;
private final InjectedLanguageBlockBuilder myInjectedBlockBuilder;
public CommentWithInjectionBlock(ASTNode node, Wrap wrap, Alignment alignment, Indent indent, CommonCodeStyleSettings settings) {
super(node, wrap, alignment, indent, settings);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public class DocCommentBlock extends AbstractJavaBlock{
while (child != null) {
if (child.getElementType() == JavaDocTokenType.DOC_COMMENT_START) {
result.add(createJavaBlock(child, mySettings, Indent.getNoneIndent(), null, AlignmentStrategy.getNullStrategy()));
} else if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getText().trim().length() > 0){
} else if (!FormatterUtil.containsWhiteSpacesOnly(child) && !child.getText().trim().isEmpty()){
result.add(createJavaBlock(child, mySettings, Indent.getSpaceIndent(1), null, AlignmentStrategy.getNullStrategy()));
}
child = child.getTreeNext();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class CreateBeanPropertyFix implements LocalQuickFix, IntentionAction {
private final static Logger LOG = Logger.getInstance("#com.intellij.psi.impl.beanProperties.CreateBeanPropertyFix");
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.beanProperties.CreateBeanPropertyFix");
private static final CreateBeanPropertyFix[] NO_FIXES = new CreateBeanPropertyFix[0];
protected final String myPropertyName;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public class PsiJavaDirectoryFactory extends PsiDirectoryFactory {
final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
if (aPackage != null) {
final String qualifiedName = aPackage.getQualifiedName();
if (qualifiedName.length() > 0) return qualifiedName;
if (!qualifiedName.isEmpty()) return qualifiedName;
if (presentable) {
return PsiBundle.message("default.package.presentation") + " (" + directory.getVirtualFile().getPresentableUrl() + ")";
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,9 +46,9 @@ public class LightMethodBuilder extends LightElement implements PsiMethod, Origi
private final String myName;
private Computable<PsiType> myReturnType;
private final PsiModifierList myModifierList;
private PsiParameterList myParameterList;
private PsiTypeParameterList myTypeParameterList;
private PsiReferenceList myThrowsList;
private final PsiParameterList myParameterList;
private final PsiTypeParameterList myTypeParameterList;
private final PsiReferenceList myThrowsList;
private Icon myBaseIcon;
private PsiClass myContainingClass;
private boolean myConstructor;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,8 +39,8 @@ public class ImportsFormatter extends XmlRecursiveElementVisitor {
private final FormattingDocumentModelImpl myDocumentModel;
private final CommonCodeStyleSettings.IndentOptions myIndentOptions;
private static final @NonNls String PAGE_DIRECTIVE = "page";
private static final @NonNls String IMPORT_ATT = "import";
@NonNls private static final String PAGE_DIRECTIVE = "page";
@NonNls private static final String IMPORT_ATT = "import";
private final PostFormatProcessorHelper myPostProcessor;
@@ -779,7 +779,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
String prefix = getPrefixByVariableKind(variableKind);
String name = propertyName;
if (name.length() > 0 && prefix.length() > 0 && !StringUtil.endsWithChar(prefix, '_')) {
if (!name.isEmpty() && !prefix.isEmpty() && !StringUtil.endsWithChar(prefix, '_')) {
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
}
name = prefix + name + getSuffixByVariableKind(variableKind);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt
if(type == TokenType.WHITE_SPACE) {
final String text = prevNode.getText();
final @NonNls String cdataStartMarker = "<![CDATA[";
@NonNls final String cdataStartMarker = "<![CDATA[";
final int cdataPos = text.indexOf(cdataStartMarker);
if (cdataPos != -1 && whiteSpace.indexOf(cdataStartMarker) == -1) {
whiteSpace = DocumentBasedFormattingModel.mergeWsWithCdataMarker(whiteSpace, text, cdataPos);
@@ -95,7 +95,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt
type = prevNode != null ? prevNode.getElementType():null;
}
final @NonNls String cdataEndMarker = "]]>";
@NonNls final String cdataEndMarker = "]]>";
if(type == XmlElementType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) {
final ASTNode at = findElementAt(prevNode.getStartOffset());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -113,7 +113,7 @@ public class ShiftIndentInsideHelper {
leafOffset = getStartOffset(element, leaf);
}
else {
if (newSpace.length() > 0) {
if (!newSpace.isEmpty()) {
LeafElement newLeaf = ASTFactory.whitespace(newSpace);
next.getTreeParent().addChild(newLeaf, next);
}
@@ -129,7 +129,7 @@ public class ShiftIndentInsideHelper {
}
String leafText = leaf.getText();
String newLeafText = leafText.substring(0, startOffset) + newSpace + leafText.substring(endOffset);
if (newLeafText.length() > 0) {
if (!newLeafText.isEmpty()) {
LeafElement newLeaf = Factory.createSingleLeafElement(leaf.getElementType(), newLeafText,charTableByTree, SharedImplUtil.getManagerByTree(leaf));
if (leaf.getTreeParent() != null) {
leaf.getTreeParent().replaceChild(leaf, newLeaf);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,11 +43,11 @@ public class JDComment {
}
protected static boolean isNull(@Nullable String s) {
return s == null || s.trim().length() == 0;
return s == null || s.trim().isEmpty();
}
protected static boolean isNull(@Nullable List<?> l) {
return l == null || l.size() == 0;
return l == null || l.isEmpty();
}
public void setMultiLine(boolean value) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public class JDMethodComment extends JDParamListOwnerComment {
super.generateSpecial(prefix, sb);
if (myReturnTag != null) {
if (myFormatter.getSettings().JD_KEEP_EMPTY_RETURN || myReturnTag.trim().length() != 0) {
if (myFormatter.getSettings().JD_KEEP_EMPTY_RETURN || !myReturnTag.trim().isEmpty()) {
JDTag tag = JDTag.RETURN;
sb.append(prefix);
sb.append(tag.getWithEndWhitespace());
@@ -73,7 +73,7 @@ public class JDParser {
for (int i = 0; i < size; i++) {
String line = l.get(i);
line = line.trim();
if (line.length() > 0) {
if (!line.isEmpty()) {
if (line.charAt(0) == '*') {
if ((markers.get(i)).booleanValue()) {
if (line.length() > 1 && line.charAt(1) == ' ') {
@@ -95,7 +95,7 @@ public class JDParser {
String tag = null;
for (int i = 0; i <= size; i++) {
String line = i == size ? null : l.get(i);
if (i == size || line.length() > 0) {
if (i == size || !line.isEmpty()) {
if (i == size || line.charAt(0) == '@') {
if (tag == null) {
comment.setDescription(sb.toString());
@@ -157,7 +157,7 @@ public class JDParser {
private List<String> toArray(@Nullable String s, @NotNull String separators, @Nullable List<Boolean> markers) {
if (s == null) return null;
s = s.trim();
if (s.length() == 0) return null;
if (s.isEmpty()) return null;
boolean p2nl = markers != null && mySettings.JD_P_AT_EMPTY_LINES;
List<String> list = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(s, separators, true);
@@ -232,7 +232,7 @@ public class JDParser {
String seq = pair.getFirst();
boolean isMarked = pair.getSecond();
if (seq.length() == 0) {
if (seq.isEmpty()) {
// keep empty lines
list.add("");
continue;
@@ -514,9 +514,9 @@ public class JDParser {
boolean insidePreTag = false;
for (int i = 0; i < list.size(); i++) {
String line = list.get(i);
if (line.length() == 0 && !mySettings.JD_KEEP_EMPTY_LINES) continue;
if (line.isEmpty() && !mySettings.JD_KEEP_EMPTY_LINES) continue;
if (i != 0) sb.append(prefix);
if (line.length() == 0 && mySettings.JD_P_AT_EMPTY_LINES && !insidePreTag) {
if (line.isEmpty() && mySettings.JD_P_AT_EMPTY_LINES && !insidePreTag) {
if (myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) {
//Self-closing elements are not allowed for javadoc tool from JDK8
sb.append(P_START_TAG);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
String text,
int offset,
final boolean soft,
final @NotNull Module... forModules) {
@NotNull final Module... forModules) {
return new FileReferenceSet(text, element, offset, this, true, myEndingSlashNotAllowed) {
@@ -75,7 +75,7 @@ public class FilePathReferenceProvider extends PsiReferenceProvider {
@Override
public boolean absoluteUrlNeedsStartSlash() {
final String s = getPathString();
return s != null && s.length() > 0 && s.charAt(0) == '/';
return s != null && !s.isEmpty() && s.charAt(0) == '/';
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,7 +61,7 @@ public class JavaClassReferenceProvider extends GenericReferenceProvider impleme
private boolean myAllowEmpty;
private ParameterizedCachedValueProvider<List<PsiElement>, Project> myProvider = new ParameterizedCachedValueProvider<List<PsiElement>, Project>() {
private final ParameterizedCachedValueProvider<List<PsiElement>, Project> myProvider = new ParameterizedCachedValueProvider<List<PsiElement>, Project>() {
@Override
public CachedValueProvider.Result<List<PsiElement>> compute(Project project) {
final List<PsiElement> psiPackages = new ArrayList<PsiElement>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -293,7 +293,7 @@ public class MyTestInjector {
if (!method.hasModifierProperty(PsiModifier.NATIVE) || !method.hasModifierProperty(PsiModifier.PUBLIC)) return;
String paramList = "";
for (PsiParameter parameter : method.getParameterList().getParameters()) {
if (paramList.length()!=0) paramList += ",";
if (!paramList.isEmpty()) paramList += ",";
paramList += parameter.getName();
}
@NonNls String header = "function " + method.getName() + "("+paramList+") {";
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public class PatternPackageSetParserExtension implements PackageSetParserExtensi
scope = PatternPackageSet.SCOPE_PROBLEM;
} else if (PatternPackageSet.SCOPE_LIBRARY.equals(id)) {
scope = PatternPackageSet.SCOPE_LIBRARY;
} else if (id.trim().length() > 0) {
} else if (!id.trim().isEmpty()) {
scope = null;
}
final CharSequence buf = lexer.getBufferSequence();
@@ -62,7 +62,7 @@ public class PsiDisjunctionType extends PsiType {
@NotNull
public static PsiType createDisjunction(@NotNull List<PsiType> types, @NotNull PsiManager psiManager) {
assert types.size() > 0;
assert !types.isEmpty();
return types.size() == 1 ? types.get(0) : new PsiDisjunctionType(types, psiManager);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ public class ClassUtil {
if (className == null){
return null;
}
if (qualifiedName == null || qualifiedName.length() == 0){
if (qualifiedName == null || qualifiedName.isEmpty()){
return className;
}
return qualifiedName + "." + extractClassName(className);
@@ -120,7 +120,7 @@ public class ClassUtil {
public static PsiClass findNonQualifiedClassByIndex(final String indexName, @NotNull final PsiClass containingClass,
final boolean jvmCompatible) {
String prefix = getDigitPrefix(indexName);
final int idx = prefix.length() > 0 ? Integer.parseInt(prefix) : -1;
final int idx = !prefix.isEmpty() ? Integer.parseInt(prefix) : -1;
final String name = prefix.length() < indexName.length() ? indexName.substring(prefix.length()) : null;
final PsiClass[] result = new PsiClass[1];
containingClass.accept(new JavaRecursiveElementVisitor() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@ public class ConditionalGoToInstruction extends ConditionalBranchingInstruction
}
public String toString() {
final @NonNls String sRole = "["+role.toString()+"]";
@NonNls final String sRole = "["+role.toString()+"]";
return "COND_GOTO " + sRole + " " + offset;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1249,7 +1249,7 @@ public class ControlFlowUtil {
// map of variable->PsiReferenceExpressions for all read before written variables for this point and below in control flow
private final CopyOnWriteList[] readVariables;
private final ControlFlow myFlow;
private boolean localVariablesOnly;
private final boolean localVariablesOnly;
public ReadBeforeWriteClientVisitor(ControlFlow flow, boolean localVariablesOnly) {
myFlow = flow;
@@ -336,7 +336,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
List<PsiMethod> methods = getOwnMethods();
List<PsiClass> classes = getOwnInnerClasses();
if (fields.size() > 0) {
if (!fields.isEmpty()) {
goNextLine(newIndentLevel, buffer);
for (int i = 0; i < fields.size(); i++) {
@@ -365,8 +365,8 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
buffer.append(";");
}
if (methods.size() > 0) {
if (isEnum() || fields.size() > 0) {
if (!methods.isEmpty()) {
if (isEnum() || !fields.isEmpty()) {
buffer.append('\n');
}
goNextLine(newIndentLevel, buffer);
@@ -381,7 +381,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
}
}
if (classes.size() > 0) {
if (!classes.isEmpty()) {
if (fields.size() + methods.size() > 0) {
buffer.append('\n');
}
@@ -315,7 +315,7 @@ public class ClsFileImpl extends ClsRepositoryPsiElement<PsiClassHolderFileStub>
@NotNull
public LanguageLevel getSourceLanguageLevel() {
final List stubs = getStub().getChildrenStubs();
return stubs.size() > 0 ? ((PsiClassStub<?>)stubs.get(0)).getLanguageLevel() : LanguageLevel.HIGHEST;
return !stubs.isEmpty() ? ((PsiClassStub<?>)stubs.get(0)).getLanguageLevel() : LanguageLevel.HIGHEST;
}
@Override
@@ -120,7 +120,7 @@ public abstract class JavaClassElementType extends JavaStubElementType<PsiClassS
if (name != null) {
if (parentStub instanceof PsiJavaFileStub) {
final String pkg = ((PsiJavaFileStub)parentStub).getPackageName();
if (pkg.length() > 0) qualifiedName = pkg + '.' + name; else qualifiedName = name;
if (!pkg.isEmpty()) qualifiedName = pkg + '.' + name; else qualifiedName = name;
}
else if (parentStub instanceof PsiClassStub) {
final String parentFqn = ((PsiClassStub)parentStub).getQualifiedName();
@@ -92,7 +92,7 @@ public abstract class JavaMethodElementType extends JavaStubElementType<PsiMetho
}
else if (type == JavaElementType.PARAMETER_LIST) {
final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
if (params.size() > 0) {
if (!params.isEmpty()) {
final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
if (pType != null) {
isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
@@ -38,8 +38,8 @@ public class PsiImportStatementStubImpl extends StubBase<PsiImportStatementBase>
private final StringRef myText;
private SoftReference<PsiJavaCodeReferenceElement> myReference = null;
private final static int ON_DEMAND = 0x01;
private final static int STATIC = 0x02;
private static final int ON_DEMAND = 0x01;
private static final int STATIC = 0x02;
public PsiImportStatementStubImpl(final StubElement parent, final String text, final byte flags) {
this(parent, StringRef.fromString(text), flags);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public class LightTypeParameterListBuilder extends LightElement implements PsiTy
@Override
public PsiTypeParameter[] getTypeParameters() {
if (cached == null) {
if (myParameters.size() == 0) {
if (myParameters.isEmpty()) {
cached = PsiTypeParameter.EMPTY_ARRAY;
}
else {
@@ -584,7 +584,7 @@ public class PsiJavaCodeReferenceElementImpl extends CompositePsiElement impleme
PsiModifierList modifierList = PsiImplUtil.findNeighbourModifierList(this);
if (modifierList != null) {
List<PsiAnnotation> typeAnnotations = PsiImplUtil.getTypeUseAnnotations(modifierList);
if (typeAnnotations != null && typeAnnotations.size() > 0) {
if (typeAnnotations != null && !typeAnnotations.isEmpty()) {
annotations.addAll(typeAnnotations);
}
}
@@ -121,7 +121,7 @@ public abstract class PsiJavaFileBaseImpl extends PsiFileImpl implements PsiJava
final PsiPackageStatement packageStatement = getPackageStatement();
final PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
if (packageStatement != null) {
if (packageName.length() > 0) {
if (!packageName.isEmpty()) {
final PsiJavaCodeReferenceElement reference = packageStatement.getPackageReference();
reference.replace(factory.createReferenceFromText(packageName, packageStatement));
}
@@ -130,7 +130,7 @@ public abstract class PsiJavaFileBaseImpl extends PsiFileImpl implements PsiJava
}
}
else {
if (packageName.length() > 0) {
if (!packageName.isEmpty()) {
addBefore(factory.createPackageStatement(packageName), getFirstChild());
}
}
@@ -138,14 +138,14 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
if (PsiUtil.isJavaToken(child, JavaTokenType.AND)) {
List<PsiType> types = collectTypes();
assert types.size() > 0 : this;
assert !types.isEmpty() : this;
type = PsiIntersectionType.createIntersection(types);
break;
}
if (PsiUtil.isJavaToken(child, JavaTokenType.OR)) {
List<PsiType> types = collectTypes();
assert types.size() > 0 : this;
assert !types.isEmpty() : this;
type = PsiDisjunctionType.createDisjunction(types, getManager());
break;
}
@@ -161,7 +161,7 @@ public class PsiTypeElementImpl extends CompositePsiElement implements PsiTypeEl
if (left instanceof PsiModifierList) {
List<PsiAnnotation> annotations = PsiImplUtil.getTypeUseAnnotations((PsiModifierList)left);
if (annotations != null && annotations.size() > 0) {
if (annotations != null && !annotations.isEmpty()) {
list.addAll(annotations);
}
break;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -176,7 +176,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo
final String[] typeStrings = child.getText().split("[, ]"); //avoid param types list parsing hmm method(paramType1, paramType2, ...) -> typeElement1, identifier2, ...
if (typeStrings != null) {
for (String type : typeStrings) {
if (type.length() > 0) {
if (!type.isEmpty()) {
types.add(type);
}
}
@@ -36,7 +36,7 @@ import java.util.List;
class SeeDocTagInfo implements JavadocTagInfo {
private final String myName;
private final boolean myInline;
private static final @NonNls String LINKPLAIN_TAG = "linkplain";
@NonNls private static final String LINKPLAIN_TAG = "linkplain";
public SeeDocTagInfo(@NonNls String name, boolean isInline) {
myName = name;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public class StaticImportResolveProcessor extends BaseScopeProcessor implements
}
private static boolean checkDomination(final PsiMember candidate, final List<JavaResolveResult> results) {
if (results.size() > 0) {
if (!results.isEmpty()) {
for (ListIterator<JavaResolveResult> i = results.listIterator(results.size()); i.hasPrevious();) {
final Domination domination = dominates(candidate, (PsiMember)i.previous().getElement());
if (domination == Domination.DOMINATED_BY) {
@@ -27,7 +27,7 @@ import java.util.List;
* User: anna
*/
public class InferenceIncorporationPhase {
private InferenceSession mySession;
private final InferenceSession mySession;
public InferenceIncorporationPhase(InferenceSession session) {
mySession = session;
@@ -37,7 +37,7 @@ import java.util.*;
public class InferenceSession {
private static final Logger LOG = Logger.getInstance("#" + InferenceSession.class.getName());
private Map<PsiTypeParameter, InferenceVariable> myInferenceVariables = new LinkedHashMap<PsiTypeParameter, InferenceVariable>();
private final Map<PsiTypeParameter, InferenceVariable> myInferenceVariables = new LinkedHashMap<PsiTypeParameter, InferenceVariable>();
private final List<ConstraintFormula> myConstraints = new ArrayList<ConstraintFormula>();
private PsiSubstitutor mySiteSubstitutor;
@@ -29,8 +29,8 @@ public class InferenceVariable {
return myParameter;
}
private Map<InferenceBound, List<PsiType>> myBounds = new HashMap<InferenceBound, List<PsiType>>();
private PsiTypeParameter myParameter;
private final Map<InferenceBound, List<PsiType>> myBounds = new HashMap<InferenceBound, List<PsiType>>();
private final PsiTypeParameter myParameter;
private PsiType myInstantiation = PsiType.NULL;
public InferenceVariable(PsiTypeParameter parameter) {
@@ -78,7 +78,7 @@ public class InferenceVariablesOrder {
public static class InferenceGraphNode<T> {
private final List<T> myValue = new ArrayList<T>();
private Set<InferenceGraphNode<T>> myDependencies = new HashSet<InferenceGraphNode<T>>();
private final Set<InferenceGraphNode<T>> myDependencies = new HashSet<InferenceGraphNode<T>>();
private int index = -1;
private int lowlink;
@@ -76,7 +76,7 @@ public class PsiPolyExpressionUtil {
if (isInAssignmentOrInvocationContext(expression) && ((PsiCallExpression)expression).getTypeArguments().length == 0) {
if (method != null) {
final Set<PsiTypeParameter> typeParameters = new HashSet<PsiTypeParameter>(Arrays.asList(method.getTypeParameters()));
if (typeParameters.size() > 0) {
if (!typeParameters.isEmpty()) {
final PsiType returnType = method.getReturnType();
if (returnType != null) {
return mentionsTypeParameters(returnType, typeParameters);
@@ -31,7 +31,7 @@ import java.util.*;
* User: anna
*/
public class ExpressionCompatibilityConstraint extends InputOutputConstraintFormula {
private PsiExpression myExpression;
private final PsiExpression myExpression;
private PsiType myT;
public ExpressionCompatibilityConstraint(@NotNull PsiExpression expression, @NotNull PsiType type) {
@@ -29,7 +29,7 @@ import java.util.List;
public class SubtypingConstraint implements ConstraintFormula {
private PsiType myS;
private PsiType myT;
private boolean myIsRefTypes;
private final boolean myIsRefTypes;
public SubtypingConstraint(PsiType t, PsiType s, boolean isRefTypes) {
myT = t;
@@ -47,7 +47,7 @@ public class SourceUtil {
public void visitLeaf(LeafElement leaf) {
if (!REF_FILTER.contains(leaf.getElementType())) {
String leafText = leaf.getText();
if (buffer.length() > 0 && leafText.length() > 0 && Character.isJavaIdentifierPart(leafText.charAt(0))) {
if (buffer.length() > 0 && !leafText.isEmpty() && Character.isJavaIdentifierPart(leafText.charAt(0))) {
char lastInBuffer = buffer.charAt(buffer.length() - 1);
if (lastInBuffer == '?' || Character.isJavaIdentifierPart(lastInBuffer)) {
buffer.append(" ");
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ public class ClassPresentationProvider implements ItemPresentationProvider<PsiCl
if (file instanceof PsiClassOwner) {
PsiClassOwner classOwner = (PsiClassOwner)file;
String packageName = classOwner.getPackageName();
if (packageName.length() == 0) return null;
if (packageName.isEmpty()) return null;
return "(" + packageName + ")";
}
return null;
@@ -381,7 +381,7 @@ public class JavaMethodsConflictResolver implements PsiConflictResolver{
boolean toFilter = false;
for (CandidateInfo conflict : conflicts) {
ProgressManager.checkCanceled();
final @MethodCandidateInfo.ApplicabilityLevelConstant int level = preferVarargs((MethodCandidateInfo)conflict);
@MethodCandidateInfo.ApplicabilityLevelConstant final int level = preferVarargs((MethodCandidateInfo)conflict);
if (maxApplicabilityLevel > 0 && maxApplicabilityLevel != level) {
toFilter = true;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,12 +37,15 @@ public abstract class JspContextManager {
public abstract void setContextFile(@NotNull PsiFile file, @Nullable BaseJspFile contextFile);
public abstract @Nullable
@Nullable
public abstract
BaseJspFile getContextFile(@NotNull PsiFile file);
public abstract @Nullable JspFile getConfiguredContextFile(@NotNull PsiFile file);
@Nullable
public abstract JspFile getConfiguredContextFile(@NotNull PsiFile file);
public @NotNull
@NotNull
public
BaseJspFile getRootContextFile(@NotNull BaseJspFile file) {
BaseJspFile rootContext = file;
HashSet<BaseJspFile> recursionPreventer = new HashSet<BaseJspFile>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@ public abstract class JspManager implements IBaseJspManager {
public abstract List<Pair<String,String>> getAvailableFunctions(@NotNull final JspFile context);
@Nullable
public abstract String getPrefixForNamespace(@NotNull String namespaceUri, final @NotNull JspFile context);
public abstract String getPrefixForNamespace(@NotNull String namespaceUri, @NotNull final JspFile context);
@Nullable
public abstract String getDefaultPrefix(@NotNull XmlFile taglibFile);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public class PatternPackageSet extends PatternBasedPackageSet {
myModulePatternText = modulePattern;
Pattern mmgp = null;
Pattern mmp = null;
if (modulePattern == null || modulePattern.length() == 0) {
if (modulePattern == null || modulePattern.isEmpty()) {
mmp = null;
}
else {