mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
strictfp in interfaces for java 1.8 (IDEA-138501)
This commit is contained in:
+8
-2
@@ -886,11 +886,17 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
isAllowed = false;
|
||||
}
|
||||
|
||||
if (PsiModifier.PRIVATE.equals(modifier) || PsiModifier.PROTECTED.equals(modifier) || PsiModifier.TRANSIENT.equals(modifier) ||
|
||||
PsiModifier.STRICTFP.equals(modifier) || PsiModifier.SYNCHRONIZED.equals(modifier)) {
|
||||
if (PsiModifier.PRIVATE.equals(modifier)) {
|
||||
isAllowed &= modifierOwnerParent instanceof PsiClass &&
|
||||
(!((PsiClass)modifierOwnerParent).isInterface() || PsiUtil.isLanguageLevel9OrHigher(modifierOwner));
|
||||
}
|
||||
else if (PsiModifier.STRICTFP.equals(modifier)) {
|
||||
isAllowed &= modifierOwnerParent instanceof PsiClass && (!((PsiClass)modifierOwnerParent).isInterface() || PsiUtil.isLanguageLevel8OrHigher(modifierOwner));
|
||||
}
|
||||
else if (PsiModifier.PROTECTED.equals(modifier) || PsiModifier.TRANSIENT.equals(modifier) ||
|
||||
PsiModifier.SYNCHRONIZED.equals(modifier)) {
|
||||
isAllowed &= modifierOwnerParent instanceof PsiClass && !((PsiClass)modifierOwnerParent).isInterface();
|
||||
}
|
||||
|
||||
if (containingClass != null && containingClass.isAnnotationType()) {
|
||||
isAllowed &= !PsiModifier.STATIC.equals(modifier);
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
interface A {
|
||||
<error descr="Illegal combination of modifiers: 'strictfp' and 'abstract'">strictfp</error> void m();
|
||||
strictfp default void m1(){}
|
||||
strictfp static void m2() {}
|
||||
}
|
||||
+4
@@ -43,6 +43,10 @@ public class LightAdvHighlightingJdk8Test extends LightDaemonAnalyzerTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testStrictfpInsideInterface() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_8, getModule(), getTestRootDisposable());
|
||||
doTest(BASE_PATH + "/" + getTestName(false) + ".java", true, false);
|
||||
|
||||
Reference in New Issue
Block a user