mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
honor super method contracts
This commit is contained in:
+1
-1
@@ -1471,7 +1471,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
|
||||
|
||||
@Nullable
|
||||
public static PsiAnnotation findContractAnnotation(PsiMethod method) {
|
||||
return AnnotationUtil.findAnnotation(method, ORG_JETBRAINS_ANNOTATIONS_CONTRACT);
|
||||
return AnnotationUtil.findAnnotationInHierarchy(method, Collections.singleton(ORG_JETBRAINS_ANNOTATIONS_CONTRACT));
|
||||
}
|
||||
|
||||
public static boolean isPure(PsiMethod method) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2000-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.
|
||||
*/
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
interface I {
|
||||
@Contract("true->fail") void assertFalse(boolean fail);
|
||||
}
|
||||
|
||||
class Foo implements I {
|
||||
|
||||
public void <warning descr="Contract clause 'true -> fail' is violated: no exception is thrown">assertFalse</warning>(boolean fail) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,6 +36,7 @@ public class ContractCheckTest extends LightCodeInsightFixtureTestCase {
|
||||
public void testDelegationWithUnknownArgument() { doTest(); }
|
||||
public void testEqualsUnknownValue() { doTest(); }
|
||||
public void testMissingFail() { doTest(); }
|
||||
public void testCheckSuperContract() { doTest(); }
|
||||
|
||||
public void testSignatureIssues() { doTest(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user