diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DiagnosticsWithSuppression.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DiagnosticsWithSuppression.java index 8674715122d..02f91cbd8d2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DiagnosticsWithSuppression.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DiagnosticsWithSuppression.java @@ -23,7 +23,6 @@ import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.ModificationTracker; import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiFile; import com.intellij.util.containers.ConcurrentWeakValueHashMap; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.FilteringIterator; @@ -31,14 +30,10 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; import org.jetbrains.jet.lang.diagnostics.Diagnostic; -import org.jetbrains.jet.lang.diagnostics.DiagnosticFactory; -import org.jetbrains.jet.lang.diagnostics.Errors; import org.jetbrains.jet.lang.diagnostics.Severity; import org.jetbrains.jet.lang.psi.JetAnnotated; import org.jetbrains.jet.lang.psi.JetAnnotationEntry; -import org.jetbrains.jet.lang.psi.JetFile; import org.jetbrains.jet.lang.psi.JetStubbedPsiUtil; -import org.jetbrains.jet.lang.psi.codeFragmentUtil.CodeFragmentUtilPackage; import org.jetbrains.jet.lang.resolve.constants.ArrayValue; import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant; import org.jetbrains.jet.lang.resolve.constants.StringValue; @@ -121,25 +116,12 @@ public class DiagnosticsWithSuppression implements Diagnostics { if (suppressor.isSuppressed(diagnostic)) return true; } - if (isSuppressedForDebugger(diagnostic, element)) return true; - JetAnnotated annotated = JetStubbedPsiUtil.getPsiOrStubParent(element, JetAnnotated.class, false); if (annotated == null) return false; return isSuppressedByAnnotated(diagnostic, annotated, 0); } - private static boolean isSuppressedForDebugger(@NotNull Diagnostic diagnostic, @NotNull PsiElement element) { - PsiFile containingFile = element.getContainingFile(); - if (containingFile instanceof JetFile && CodeFragmentUtilPackage.getSkipVisibilityCheck((JetFile) containingFile)) { - DiagnosticFactory diagnosticFactory = diagnostic.getFactory(); - return diagnosticFactory == Errors.INVISIBLE_MEMBER || - diagnosticFactory == Errors.INVISIBLE_REFERENCE || - diagnosticFactory == Errors.INVISIBLE_SETTER; - } - return false; - } - /* The cache is optimized for the case where no warnings are suppressed (most frequent one) diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 89cf653cc5a..3a7ec8586e5 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -818,5 +818,6 @@ + diff --git a/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt b/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt new file mode 100644 index 00000000000..5267d9d9897 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/debugger/DiagnosticSuppressorForDebugger.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2014 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 org.jetbrains.jet.plugin.debugger + +import org.jetbrains.jet.lang.resolve.DiagnosticsWithSuppression +import org.jetbrains.jet.lang.diagnostics.Diagnostic +import org.jetbrains.jet.lang.psi.JetFile +import org.jetbrains.jet.lang.diagnostics.Errors +import org.jetbrains.jet.lang.psi.codeFragmentUtil.skipVisibilityCheck + +public class DiagnosticSuppressorForDebugger : DiagnosticsWithSuppression.DiagnosticSuppressor { + override fun isSuppressed(diagnostic: Diagnostic): Boolean { + val element = diagnostic.getPsiElement() + val containingFile = element.getContainingFile() + + if (containingFile is JetFile && containingFile.skipVisibilityCheck) { + val diagnosticFactory = diagnostic.getFactory() + return diagnosticFactory == Errors.INVISIBLE_MEMBER || + diagnosticFactory == Errors.INVISIBLE_REFERENCE || + diagnosticFactory == Errors.INVISIBLE_SETTER + } + + return false + } +} \ No newline at end of file