This commit is contained in:
Alexey Kudravtsev
2017-02-22 17:40:00 +03:00
parent a6d0d7bea5
commit 8fd72fd9d6
3 changed files with 12 additions and 17 deletions
@@ -97,7 +97,7 @@ public class Java15APIUsageInspectionBase extends BaseJavaBatchLocalInspectionTo
ourDefaultMethods.add("java.util.Iterator#remove()");
}
protected LanguageLevel myEffectiveLanguageLevel;
LanguageLevel myEffectiveLanguageLevel;
@Nullable
private static Set<String> getForbiddenApi(@NotNull LanguageLevel languageLevel) {
@@ -119,14 +119,8 @@ public class Java15APIUsageInspectionBase extends BaseJavaBatchLocalInspectionTo
return;
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream(), CharsetToolkit.UTF8_CHARSET));
try {
set.addAll(FileUtil.loadLines(reader));
}
finally {
reader.close();
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource.openStream(), CharsetToolkit.UTF8_CHARSET))) {
set.addAll(FileUtil.loadLines(reader));
}
catch (IOException ignored) { }
}
@@ -367,7 +361,7 @@ public class Java15APIUsageInspectionBase extends BaseJavaBatchLocalInspectionTo
private static String getJdkName(LanguageLevel languageLevel) {
final String presentableText = languageLevel.getPresentableText();
return presentableText.substring(0, presentableText.indexOf(" "));
return presentableText.substring(0, presentableText.indexOf(' '));
}
public static boolean isForbiddenApiUsage(@NotNull PsiMember member, @NotNull LanguageLevel languageLevel) {
@@ -31,5 +31,5 @@ public interface UsageFilteringRuleProvider {
@NotNull
AnAction[] createFilteringActions(@NotNull UsageView view);
Topic<Runnable> RULES_CHANGED = new Topic<>("usave view rules changed", Runnable.class);
Topic<Runnable> RULES_CHANGED = new Topic<>("usage view rules changed", Runnable.class);
}
@@ -30,17 +30,18 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author Dmitry Batkovich
*/
public class AlphaUnsortedPropertiesFileInspection extends LocalInspectionTool {
private final static Logger LOG = Logger.getInstance(AlphaUnsortedPropertiesFileInspection.class);
private final static String MESSAGE_TEMPLATE_WHOLE_RESOURCE_BUNDLE = "Property keys of resource bundle '%s' aren't alphabetically sorted";
private static final Logger LOG = Logger.getInstance(AlphaUnsortedPropertiesFileInspection.class);
private static final String MESSAGE_TEMPLATE_WHOLE_RESOURCE_BUNDLE = "Property keys of resource bundle '%s' aren't alphabetically sorted";
@NotNull
@Override
@@ -73,8 +74,8 @@ public class AlphaUnsortedPropertiesFileInspection extends LocalInspectionTool {
};
}
private static boolean isResourceBundleAlphaSortedExceptOneFile(final @NotNull ResourceBundle resourceBundle,
final @NotNull PropertiesFile exceptedFile) {
private static boolean isResourceBundleAlphaSortedExceptOneFile(@NotNull final ResourceBundle resourceBundle,
@NotNull final PropertiesFile exceptedFile) {
for (PropertiesFile file : resourceBundle.getPropertiesFiles()) {
if (!(file instanceof PropertiesFileImpl)) {
return true;