mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
api usage inspection: warn if old interface method was made default and class doesn't override it
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Test.java</file>
|
||||
<line>3</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Usages of API documented as @since 1.5 (1.6|1.7)</problem_class>
|
||||
<description>Default method 'remove' is not overridden. It would cause compilation problems with JDK 6</description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
@@ -0,0 +1,29 @@
|
||||
import java.util.Iterator;
|
||||
|
||||
public class Test implements Iterator<String> {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String next() {
|
||||
return null;
|
||||
}
|
||||
|
||||
static class T implements Iterator<String> {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String next() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.intellij.codeInspection;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
@@ -60,6 +61,20 @@ public class JavaAPIUsagesInspectionTest extends InspectionTestCase {
|
||||
});
|
||||
}
|
||||
|
||||
public void testDefaultMethods() throws Exception {
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_1_6, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doTest();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getTestProjectSdk() {
|
||||
return IdeaTestUtil.getMockJdk18();
|
||||
}
|
||||
|
||||
//generate apiXXX.txt
|
||||
/*
|
||||
public void testCollectSinceApiUsages() {
|
||||
|
||||
Reference in New Issue
Block a user