service to detect java version;

highlight access to private class members according to java version used (IDEA-83045)
This commit is contained in:
anna
2012-03-29 11:06:43 +02:00
parent a4f3fc20a7
commit 24d2eeb3d0
11 changed files with 155 additions and 25 deletions
@@ -0,0 +1,9 @@
class A {
private int value = 1;
static class B<T extends A> {
void print(T t) {
System.out.println(t.<error descr="'value' has private access in 'A'">value</error>);
}
}
}
@@ -0,0 +1,9 @@
class A {
private int value = 1;
static class B<T extends A> {
void print(T t) {
System.out.println(t.value);
}
}
}
@@ -32,7 +32,16 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
LanguageLevel level = getTestName(false).contains("Level6") ? LanguageLevel.JDK_1_6 : LanguageLevel.JDK_1_5;
LanguageLevel level;
final String testName = getTestName(false);
if (testName.contains("Level17")) {
level = LanguageLevel.JDK_1_7;
} else if (testName.contains("Level6")) {
level = LanguageLevel.JDK_1_6;
}
else {
level = LanguageLevel.JDK_1_5;
}
LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject()).setLanguageLevel(level);
}
@@ -107,6 +116,8 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testPrivateInnerClassRef() throws Exception { doTest(false); }
public void testWideningCastToTypeParam() throws Exception { doTest(false); }
public void testCapturedWildcardAssignments() throws Exception { doTest(false);}
public void testTypeParameterBoundVisibility() throws Exception { doTest(false);}
public void testTypeParameterBoundVisibilityJdk14() throws Exception { doTest(false);}
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));