Unnecessary 'continue' removed; other warnings fixed

This commit is contained in:
Tagir Valeev
2017-10-31 15:44:07 +01:00
parent ee509d0158
commit 2a2b09e1f8
8 changed files with 16 additions and 32 deletions
@@ -257,7 +257,6 @@ public final class TodoPackageNode extends PackageElementNode implements Highlig
TodoFileNode todoFileNode = new TodoFileNode(getProject(), psiFile, myBuilder, false);
if (ArrayUtil.find(psiPackage.getDirectories(), _dir) > -1 && !children.contains(todoFileNode)) {
children.add(todoFileNode);
continue;
}
}
}
@@ -276,7 +275,7 @@ public final class TodoPackageNode extends PackageElementNode implements Highlig
final PsiDirectory[] directories = packageElement.getPackage().getDirectories(scope);
for (PsiDirectory directory : directories) {
Iterator<PsiFile> files = myBuilder.getFiles(directory, false);
for (;files.hasNext();) {
while (files.hasNext()) {
psiFileList.add(files.next());
}
}
@@ -916,15 +916,9 @@ public class SystemBuilder {
ReductionSystem system = new ReductionSystem(myProject, victims, myTypes, myTypeVariableFactory, mySettings);
for (final PsiElement element : victims) {
if (element instanceof PsiParameter && ((PsiParameter)element).getDeclarationScope() instanceof PsiMethod) {
if (!verifyMethod(element, victims, helper)) {
continue;
}
}
else if (element instanceof PsiMethod) {
if (!verifyMethod(element, victims, helper)) {
continue;
}
if (element instanceof PsiParameter && ((PsiParameter)element).getDeclarationScope() instanceof PsiMethod ||
element instanceof PsiMethod) {
verifyMethod(element, victims, helper);
}
}
@@ -36,7 +36,6 @@ public class SolutionHolder {
return;
case Binding.NONCOMPARABLE:
continue;
}
}
@@ -117,7 +117,6 @@ public class JavacResourcesReader {
return ResourceBundle.getBundle(BUNDLE_NAMES[i]);
}
catch (MissingResourceException ignored) {
continue;
}
}
return null;
@@ -150,7 +149,7 @@ public class JavacResourcesReader {
private static class IgnoredWarningBundleKey extends BundleKey {
public IgnoredWarningBundleKey(final String messageKey) {
super(JavacResourcesReader.MSG_IGNORED, new String[]{"compiler.warn.warning", messageKey});
super(MSG_IGNORED, new String[]{"compiler.warn.warning", messageKey});
}
public String getCategoryValue(ResourceBundle messagesBundle) {
@@ -117,7 +117,6 @@ public class CallCommand extends AbstractCommand {
return Pair.create(method, eachClass);
}
catch (NoSuchMethodException ignored) {
continue;
}
}
@@ -310,7 +310,7 @@ public class MethodUtils {
if (statement instanceof PsiEmptyStatement) {
continue;
}
else if (statement instanceof PsiReturnStatement) {
if (statement instanceof PsiReturnStatement) {
final PsiReturnStatement returnStatement = (PsiReturnStatement)statement;
final PsiExpression returnValue = ParenthesesUtils.stripParentheses(returnStatement.getReturnValue());
if (returnValue == null || returnValue instanceof PsiLiteralExpression) {
@@ -18,6 +18,7 @@ import org.jetbrains.annotations.NonNls;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Thomas Singer
@@ -28,7 +29,7 @@ public final class SimpleStringPattern
private static final char MATCH_EACH = '*';
private static final char MATCH_ONE = '?';
private final List<SubPattern> subPatterns = new ArrayList();
private final List<SubPattern> subPatterns = new ArrayList<>();
/**
* Creates a SimpleStringPattern for the specified definition.
@@ -39,13 +40,13 @@ public final class SimpleStringPattern
}
/**
* Returns whether the specified string matches thiz pattern.
* Returns whether the specified string matches this pattern.
*/
public boolean doesMatch(String string) {
int index = 0;
SubPattern subPattern = null;
for (int i = 0, length = subPatterns.size(); i < length ; i++) {
subPattern = subPatterns.get(i);
for (SubPattern subPattern1 : subPatterns) {
subPattern = subPattern1;
index = subPattern.doesMatch(string, index);
if (index < 0) {
return false;
@@ -82,7 +83,6 @@ public final class SimpleStringPattern
addSubPattern(match, prevSubPattern);
prevSubPattern = MATCH_ONE;
index++;
continue;
}
}
final String match = definition.substring(prevIndex);
@@ -107,12 +107,7 @@ public final class SimpleStringPattern
}
public String toString() {
final StringBuilder buffer = new StringBuilder();
for (int i = 0, length = subPatterns.size(); i < length; i++) {
final SubPattern subPattern = subPatterns.get(i);
buffer.append(subPattern.toString());
}
return buffer.toString();
return subPatterns.stream().map(Object::toString).collect(Collectors.joining());
}
private static abstract class SubPattern {
@@ -80,7 +80,7 @@ public final class FastStringBuffer {
if (minimumCapacity > newCapacity) {
newCapacity = minimumCapacity;
}
char newValue[] = new char[newCapacity];
char[] newValue = new char[newCapacity];
System.arraycopy(value, 0, newValue, 0, count);
value = newValue;
}
@@ -315,9 +315,8 @@ public final class FastStringBuffer {
if(matchPos == replaceLen){
this.replace(i-(replaceLen-1), i+1, with);
matchPos = 0;
i = i-(replaceLen-withLen);
i -= (replaceLen - withLen);
}
continue;
}else{
matchPos = 0;
}
@@ -433,9 +432,9 @@ public final class FastStringBuffer {
}
public boolean startsWith(String prefix, int offset) {
char ta[] = value;
char[] ta = value;
int to = offset;
char pa[] = prefix.toCharArray();
char[] pa = prefix.toCharArray();
int po = 0;
int pc = pa.length;
// Note: toffset might be near -1>>>1.