summaryrefslogtreecommitdiff
path: root/java/java-impl/src/com
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-05-07 20:09:46 -0700
committerTor Norbye <tnorbye@google.com>2013-05-07 20:09:46 -0700
commit934b9431b0b827a132df794e307fe5a2b70de00b (patch)
treedadfd1ccaeb2ce0403d306a59b35711531481e2b /java/java-impl/src/com
parentf56a0fff1a336635c966bffc25e16af9a4e6e988 (diff)
downloadidea-934b9431b0b827a132df794e307fe5a2b70de00b.tar.gz
Snapshot 5220ac5242aadc343c995ec9a49d09765db4a0c7 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I2494d92b34f89102885b2f39d7552747fafdafec
Diffstat (limited to 'java/java-impl/src/com')
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java29
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java13
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java21
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AccessStaticViaInstanceFix.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java2
-rw-r--r--java/java-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java11
-rw-r--r--java/java-impl/src/com/intellij/codeInspection/ex/BaseLocalInspectionTool.java1
-rw-r--r--java/java-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspection.java8
-rw-r--r--java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java9
-rw-r--r--java/java-impl/src/com/intellij/profile/codeInspection/ui/JavaErrorOptionsProvider.java11
-rw-r--r--java/java-impl/src/com/intellij/psi/filters/element/ReferenceOnFilter.java49
-rw-r--r--java/java-impl/src/com/intellij/refactoring/util/JavaNonCodeSearchElementDescriptionProvider.java3
13 files changed, 79 insertions, 82 deletions
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
index 61fef1b8706e..4480f31d3535 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java
@@ -204,7 +204,7 @@ public class JavaCompletionContributor extends CompletionContributor {
final CompletionResultSet result = JavaCompletionSorting.addJavaSorting(parameters, _result);
if (ANNOTATION_ATTRIBUTE_NAME.accepts(position) && !JavaCompletionData.isAfterPrimitiveOrArrayType(position)) {
- JavaCompletionData.addExpectedTypeMembers(parameters, result, position);
+ JavaCompletionData.addExpectedTypeMembers(parameters, result);
completeAnnotationAttributeName(result, position, parameters);
result.stopHere();
return;
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
index 7992e0a4c07d..390ba94dd028 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
@@ -29,7 +29,6 @@ import com.intellij.psi.*;
import com.intellij.psi.filters.*;
import com.intellij.psi.filters.classes.EnumOrAnnotationTypeFilter;
import com.intellij.psi.filters.classes.InterfaceFilter;
-import com.intellij.psi.filters.element.ReferenceOnFilter;
import com.intellij.psi.filters.getters.JavaMembersGetter;
import com.intellij.psi.filters.position.*;
import com.intellij.psi.impl.source.jsp.jspJava.JspClassLevelDeclarationStatement;
@@ -48,16 +47,6 @@ public class JavaCompletionData extends JavaAwareCompletionData {
public static final ElementPattern<PsiElement> AFTER_DOT = psiElement().afterLeaf(".");
- private static final LeftNeighbour INSTANCEOF_PLACE = new LeftNeighbour(new OrFilter(
- new ReferenceOnFilter(new ClassFilter(PsiVariable.class)),
- new TextFilter(PsiKeyword.THIS),
- new AndFilter(new TextFilter(")"), new ParentElementFilter(new AndFilter(
- new ClassFilter(PsiTypeCastExpression.class, false),
- new OrFilter(
- new ParentElementFilter(new ClassFilter(PsiExpression.class)),
- new ClassFilter(PsiExpression.class))))),
- new AndFilter(new TextFilter("]"), new ParentElementFilter(new ClassFilter(PsiArrayAccessExpression.class)))));
-
public static final PsiJavaElementPattern.Capture<PsiElement> VARIABLE_AFTER_FINAL =
psiElement().afterLeaf(PsiKeyword.FINAL).inside(PsiDeclarationStatement.class);
@@ -415,9 +404,13 @@ public class JavaCompletionData extends JavaAwareCompletionData {
if (statement == null) {
statement = PsiTreeUtil.getParentOfType(position, PsiDeclarationStatement.class);
}
+ PsiElement prevLeaf = PsiTreeUtil.prevVisibleLeaf(position);
if (statement != null && statement.getTextRange().getStartOffset() == position.getTextRange().getStartOffset()) {
if (!psiElement().withSuperParent(2, PsiSwitchStatement.class).afterLeaf("{").accepts(statement)) {
- result.addElement(new OverrideableSpace(createKeyword(position, PsiKeyword.FINAL), TailType.HUMBLE_SPACE_BEFORE_WORD));
+ PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(prevLeaf, PsiTryStatement.class);
+ if (tryStatement == null || tryStatement.getCatchSections().length > 0 || tryStatement.getFinallyBlock() != null) {
+ result.addElement(new OverrideableSpace(createKeyword(position, PsiKeyword.FINAL), TailType.HUMBLE_SPACE_BEFORE_WORD));
+ }
}
}
@@ -474,7 +467,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
if (!(file instanceof PsiExpressionCodeFragment) &&
!(file instanceof PsiJavaCodeReferenceCodeFragment) &&
!(file instanceof PsiTypeCodeFragment)) {
- if (PsiTreeUtil.prevVisibleLeaf(position) == null) {
+ if (prevLeaf == null) {
result.addElement(new OverrideableSpace(createKeyword(position, PsiKeyword.PACKAGE), TailType.HUMBLE_SPACE_BEFORE_WORD));
result.addElement(new OverrideableSpace(createKeyword(position, PsiKeyword.IMPORT), TailType.HUMBLE_SPACE_BEFORE_WORD));
}
@@ -517,7 +510,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
if (JavaSmartCompletionContributor.INSIDE_EXPRESSION.accepts(position) &&
!AFTER_DOT.accepts(position) &&
!(position.getParent() instanceof PsiLiteralExpression)) {
- addExpectedTypeMembers(parameters, result, position);
+ addExpectedTypeMembers(parameters, result);
if (SameSignatureCallParametersProvider.IN_CALL_ARGUMENT.accepts(position)) {
new SameSignatureCallParametersProvider().addCompletions(parameters, new ProcessingContext(), result);
}
@@ -535,7 +528,11 @@ public class JavaCompletionData extends JavaAwareCompletionData {
}
public static boolean isInstanceofPlace(PsiElement position) {
- return INSTANCEOF_PLACE.isAcceptable(position, position);
+ PsiElement prev = PsiTreeUtil.prevVisibleLeaf(position);
+ if (prev == null) return false;
+
+ PsiExpression expr = PsiTreeUtil.getParentOfType(prev, PsiExpression.class);
+ return expr != null && expr.getTextRange().getEndOffset() == prev.getTextRange().getEndOffset();
}
public static boolean isSuitableForClass(PsiElement position) {
@@ -558,7 +555,7 @@ public class JavaCompletionData extends JavaAwareCompletionData {
return END_OF_BLOCK.isAcceptable(position, position);
}
- static void addExpectedTypeMembers(CompletionParameters parameters, final CompletionResultSet result, PsiElement position) {
+ static void addExpectedTypeMembers(CompletionParameters parameters, final CompletionResultSet result) {
for (final ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) {
new JavaMembersGetter(info.getDefaultType(), parameters).addMembers(parameters.getInvocationCount() > 1, result);
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index 3f9bf87694f3..a44d932a50dc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -548,6 +548,17 @@ public class GenericsHighlightUtil {
for (HierarchicalMethodSignature superSignature : supers) {
info = checkSameErasureNotSubSignatureInner(superSignature, manager, aClass, sameErasureMethods);
if (info != null) return info;
+
+ if (superSignature.isRaw() && !signature.isRaw()) {
+ final PsiType[] parameterTypes = signature.getParameterTypes();
+ PsiType[] types = superSignature.getParameterTypes();
+ for (int i = 0; i < types.length; i++) {
+ if (!Comparing.equal(parameterTypes[i], TypeConversionUtil.erasure(types[i]))) {
+ return getSameErasureMessage(false, method, superSignature.getMethod(), HighlightNamesUtil.getClassDeclarationTextRange(aClass));
+ }
+ }
+ }
+
}
return null;
}
@@ -987,6 +998,8 @@ public class GenericsHighlightUtil {
for (int i = 0; i < typeParameters.length; i++) {
final PsiTypeParameter typeParameter1 = typeParameters[i];
+ final HighlightInfo cyclicInheritance = HighlightClassUtil.checkCyclicInheritance(typeParameter1);
+ if (cyclicInheritance != null) return cyclicInheritance;
String name1 = typeParameter1.getName();
for (int j = i + 1; j < typeParameters.length; j++) {
final PsiTypeParameter typeParameter2 = typeParameters[j];
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
index f611668b576c..952cb600380c 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
@@ -29,6 +29,8 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
@@ -906,6 +908,21 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
myRefCountHolder.registerReference(ref, result);
}
myHolder.add(HighlightUtil.checkReference(ref, result));
+ if (!myHolder.hasErrorResults() && resolved instanceof PsiTypeParameter) {
+ boolean cannotSelectFromTypeParameter = !JavaVersionService.getInstance().isAtLeast(ref, JavaSdkVersion.JDK_1_7);
+ if (!cannotSelectFromTypeParameter) {
+ final PsiClass containingClass = PsiTreeUtil.getParentOfType(ref, PsiClass.class);
+ if (containingClass != null) {
+ if (PsiTreeUtil.isAncestor(containingClass.getExtendsList(), ref, false) ||
+ PsiTreeUtil.isAncestor(containingClass.getImplementsList(), ref, false)) {
+ cannotSelectFromTypeParameter = true;
+ }
+ }
+ }
+ if (cannotSelectFromTypeParameter) {
+ myHolder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).descriptionAndTooltip("Cannot select from a type parameter").range(ref).create());
+ }
+ }
}
if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkAbstractInstantiation(ref, resolved));
if (!myHolder.hasErrorResults()) myHolder.add(HighlightClassUtil.checkExtendsDuplicate(ref, resolved));
@@ -951,6 +968,10 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
highlightReferencedMethodOrClassName(ref, resolved);
}
+ if (parent instanceof PsiNewExpression && !(resolved instanceof PsiClass) && resolved instanceof PsiNamedElement && ((PsiNewExpression)parent).getClassOrAnonymousClassReference() == ref) {
+ myHolder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(ref)
+ .descriptionAndTooltip("Cannot find symbol " + ((PsiNamedElement)resolved).getName()).create());
+ }
if (!myHolder.hasErrorResults() && resolved instanceof PsiClass) {
final PsiClass aClass = ((PsiClass)resolved).getContainingClass();
if (aClass != null) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AccessStaticViaInstanceFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AccessStaticViaInstanceFix.java
index 4cc78a2cb717..d96e461ece8b 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AccessStaticViaInstanceFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AccessStaticViaInstanceFix.java
@@ -47,7 +47,7 @@ public class AccessStaticViaInstanceFix extends LocalQuickFixAndIntentionActionO
private final boolean myOnTheFly;
private final String myText;
- public AccessStaticViaInstanceFix(PsiReferenceExpression expression, JavaResolveResult result, boolean onTheFly) {
+ public AccessStaticViaInstanceFix(@NotNull PsiReferenceExpression expression, @NotNull JavaResolveResult result, boolean onTheFly) {
super(expression);
myOnTheFly = onTheFly;
PsiMember member = (PsiMember)result.getElement();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java
index 15901dd28f94..4f0a29eb10b7 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsFix.java
@@ -71,7 +71,7 @@ public class AddTypeArgumentsFix extends MethodArgumentFix {
PsiTypeParameter typeParameter = typeParameters[i];
final PsiType substitution = helper.getSubstitutionForTypeParameter(typeParameter, returnType, toType, false, level);
if (substitution == null || PsiType.NULL.equals(substitution)) return null;
- mappings[i] = substitution;
+ mappings[i] = GenericsUtil.eliminateWildcards(substitution);
}
final PsiElementFactory factory = JavaPsiFacade.getInstance(expression.getProject()).getElementFactory();
diff --git a/java/java-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java b/java/java-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
index 270a3062e0f1..664ffe429c6c 100644
--- a/java/java-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
+++ b/java/java-impl/src/com/intellij/codeInspection/dataFlow/ControlFlowAnalyzer.java
@@ -1347,6 +1347,17 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
} else if (type == ConditionChecker.Type.IS_NULL_METHOD || type == ConditionChecker.Type.IS_NOT_NULL_METHOD) {
addInstruction(new PushInstruction(myFactory.getConstFactory().getNull(), null));
addInstruction(new BinopInstruction(type == ConditionChecker.Type.IS_NULL_METHOD ? JavaTokenType.EQEQ : JavaTokenType.NE, null, expression.getProject()));
+
+ ConditionalGotoInstruction ifFails = new ConditionalGotoInstruction(-1, true, null);
+ GotoInstruction gotoEnd = new GotoInstruction(exitPoint);
+
+ addInstruction(ifFails);
+ pushUnknown();
+ addInstruction(gotoEnd);
+ ifFails.setOffset(myCurrentFlow.getInstructionCount());
+ addInstruction(new PushInstruction(myFactory.getConstFactory().getFalse(), null));
+ gotoEnd.setOffset(myCurrentFlow.getInstructionCount());
+
} else { //assertTrue or assertFalse
conditionalExit(exitPoint, type == ConditionChecker.Type.ASSERT_FALSE_METHOD);
}
diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/BaseLocalInspectionTool.java b/java/java-impl/src/com/intellij/codeInspection/ex/BaseLocalInspectionTool.java
index 4c704eda8ba3..701ce36fbc76 100644
--- a/java/java-impl/src/com/intellij/codeInspection/ex/BaseLocalInspectionTool.java
+++ b/java/java-impl/src/com/intellij/codeInspection/ex/BaseLocalInspectionTool.java
@@ -22,7 +22,6 @@ import com.intellij.codeInspection.BaseJavaLocalInspectionTool;
* Date: Dec 27, 2004
*/
public abstract class BaseLocalInspectionTool extends BaseJavaLocalInspectionTool {
-
@Override
public boolean isEnabledByDefault() {
return true;
diff --git a/java/java-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspection.java b/java/java-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspection.java
index 5d66bae03a8e..8d407501777d 100644
--- a/java/java-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/java15api/Java15APIUsageInspection.java
@@ -19,12 +19,11 @@ import com.intellij.ExtensionPoints;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.*;
-import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.LanguageLevelUtil;
import com.intellij.openapi.module.Module;
-import com.intellij.openapi.module.ModuleUtil;
+import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
@@ -35,6 +34,7 @@ import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.reference.SoftReference;
+import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.util.ui.UIUtil;
import gnu.trove.THashSet;
import org.jdom.Element;
@@ -259,7 +259,7 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
final PsiElement resolved = reference.resolve();
if (resolved instanceof PsiCompiledElement && resolved instanceof PsiMember) {
- final Module module = ModuleUtil.findModuleForPsiElement(reference.getElement());
+ final Module module = ModuleUtilCore.findModuleForPsiElement(reference.getElement());
if (module != null) {
final LanguageLevel languageLevel = getEffectiveLanguageLevel(module);
if (isForbiddenApiUsage((PsiMember)resolved, languageLevel)) {
@@ -293,7 +293,7 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
@Override public void visitNewExpression(final PsiNewExpression expression) {
super.visitNewExpression(expression);
final PsiMethod constructor = expression.resolveConstructor();
- final Module module = ModuleUtil.findModuleForPsiElement(expression);
+ final Module module = ModuleUtilCore.findModuleForPsiElement(expression);
if (module != null) {
final LanguageLevel languageLevel = getEffectiveLanguageLevel(module);
if (constructor instanceof PsiCompiledElement) {
diff --git a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
index 85ae19c6a7d7..133c517b12e7 100644
--- a/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
+++ b/java/java-impl/src/com/intellij/codeInspection/miscGenerics/RedundantTypeArgsInspection.java
@@ -106,12 +106,11 @@ public class RedundantTypeArgsInspection extends GenericsInspectionToolBase {
if (typeParameters.length == typeArguments.length) {
final PsiParameter[] parameters = method.getParameterList().getParameters();
PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(expression.getProject()).getResolveHelper();
- for (int i = 0; i < typeParameters.length; i++) {
+ final PsiSubstitutor psiSubstitutor = resolveHelper
+ .inferTypeArguments(typeParameters, parameters, argumentList.getExpressions(), PsiSubstitutor.EMPTY, expression, DefaultParameterTypeInferencePolicy.INSTANCE);
+ for (int i = 0, length = typeParameters.length; i < length; i++) {
PsiTypeParameter typeParameter = typeParameters[i];
- final PsiType inferredType = resolveHelper.inferTypeForMethodTypeParameter(typeParameter, parameters,
- argumentList.getExpressions(),
- resolveResult.getSubstitutor(), expression,
- DefaultParameterTypeInferencePolicy.INSTANCE);
+ final PsiType inferredType = psiSubstitutor.getSubstitutionMap().get(typeParameter);
if (!typeArguments[i].equals(inferredType)) return;
if (PsiUtil.resolveClassInType(method.getReturnType()) == typeParameter && PsiPrimitiveType.getUnboxedType(inferredType) != null) return;
}
diff --git a/java/java-impl/src/com/intellij/profile/codeInspection/ui/JavaErrorOptionsProvider.java b/java/java-impl/src/com/intellij/profile/codeInspection/ui/JavaErrorOptionsProvider.java
index 9bbb4625db77..471fd5cda1cf 100644
--- a/java/java-impl/src/com/intellij/profile/codeInspection/ui/JavaErrorOptionsProvider.java
+++ b/java/java-impl/src/com/intellij/profile/codeInspection/ui/JavaErrorOptionsProvider.java
@@ -29,6 +29,7 @@ import java.awt.*;
public class JavaErrorOptionsProvider implements ErrorOptionsProvider {
private JCheckBox mySuppressWay;
+ @Override
public JComponent createComponent() {
mySuppressWay = new JCheckBox(ApplicationBundle.message("checkbox.suppress.with.suppresswarnings"));
final JPanel panel = new JPanel(new BorderLayout());
@@ -36,21 +37,25 @@ public class JavaErrorOptionsProvider implements ErrorOptionsProvider {
return panel;
}
+ @Override
public void reset() {
- mySuppressWay.setSelected(DaemonCodeAnalyzerSettings.getInstance().SUPPRESS_WARNINGS);
+ mySuppressWay.setSelected(DaemonCodeAnalyzerSettings.getInstance().isSuppressWarnings());
}
+ @Override
public void disposeUIResources() {
mySuppressWay = null;
}
+ @Override
public void apply() {
- DaemonCodeAnalyzerSettings.getInstance().SUPPRESS_WARNINGS = mySuppressWay.isSelected();
+ DaemonCodeAnalyzerSettings.getInstance().setSuppressWarnings(mySuppressWay.isSelected());
}
+ @Override
public boolean isModified() {
DaemonCodeAnalyzerSettings settings = DaemonCodeAnalyzerSettings.getInstance();
- return mySuppressWay.isSelected() != settings.SUPPRESS_WARNINGS;
+ return mySuppressWay.isSelected() != settings.isSuppressWarnings();
}
} \ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/psi/filters/element/ReferenceOnFilter.java b/java/java-impl/src/com/intellij/psi/filters/element/ReferenceOnFilter.java
deleted file mode 100644
index 7ba8c08e1603..000000000000
--- a/java/java-impl/src/com/intellij/psi/filters/element/ReferenceOnFilter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2000-2009 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.psi.filters.element;
-
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiJavaCodeReferenceElement;
-import com.intellij.psi.PsiJavaReference;
-import com.intellij.psi.filters.ElementFilter;
-import com.intellij.psi.filters.position.PositionElementFilter;
-import com.intellij.util.ReflectionCache;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 07.02.2003
- * Time: 17:25:04
- * To change this template use Options | File Templates.
- */
-public class ReferenceOnFilter extends PositionElementFilter{
- public ReferenceOnFilter(ElementFilter filter){
- setFilter(filter);
- }
-
- @Override
- public boolean isClassAcceptable(Class hintClass){
- return ReflectionCache.isAssignable(PsiJavaCodeReferenceElement.class, hintClass);
- }
-
- @Override
- public boolean isAcceptable(Object element, PsiElement context){
- if (!(element instanceof PsiElement)) return false;
- PsiElement parent = ((PsiElement) element).getParent();
- return parent instanceof PsiJavaCodeReferenceElement &&
- getFilter().isAcceptable(((PsiJavaReference)parent).advancedResolve(true).getElement(), context);
- }
-}
diff --git a/java/java-impl/src/com/intellij/refactoring/util/JavaNonCodeSearchElementDescriptionProvider.java b/java/java-impl/src/com/intellij/refactoring/util/JavaNonCodeSearchElementDescriptionProvider.java
index 9c4d816cae6e..45b3cc27c05e 100644
--- a/java/java-impl/src/com/intellij/refactoring/util/JavaNonCodeSearchElementDescriptionProvider.java
+++ b/java/java-impl/src/com/intellij/refactoring/util/JavaNonCodeSearchElementDescriptionProvider.java
@@ -15,6 +15,7 @@
*/
package com.intellij.refactoring.util;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
@@ -27,7 +28,7 @@ public class JavaNonCodeSearchElementDescriptionProvider implements ElementDescr
if (!(location instanceof NonCodeSearchDescriptionLocation)) return null;
NonCodeSearchDescriptionLocation ncdLocation = (NonCodeSearchDescriptionLocation) location;
if (element instanceof PsiPackage) {
- return ncdLocation.isNonJava() ? ((PsiPackage)element).getQualifiedName() : ((PsiPackage)element).getName();
+ return ncdLocation.isNonJava() ? ((PsiPackage)element).getQualifiedName() : StringUtil.notNullize(((PsiPackage)element).getName());
}
if (element instanceof PsiClass) {
return ncdLocation.isNonJava() ? ((PsiClass)element).getQualifiedName() : ((PsiClass)element).getName();