additional testdata for inaccessible type params members from IDEA-66305

This commit is contained in:
anna
2012-04-05 09:57:05 +02:00
parent 3156fab144
commit dab1c48d59
2 changed files with 48 additions and 0 deletions
@@ -15,3 +15,27 @@ abstract class Foo<T extends Foo<T>> {
return t.<error descr="'field' has private access in 'Foo'">field</error>;
}
}
public class Bug {
// Idea incorrectly analyses this code with JDK 7
public <T extends Bug> void doit(T other) {
// Oops, was legal with JDK 6, no longer legal with JDK 7
other.<error descr="'mPrivate()' has private access in 'Bug'">mPrivate</error>();
// Redundant with JDK 6, not a redundant cast with JDK 7
((Bug)other).mPrivate();
}
// Idea correctly analyses this code
public void doit2(SubClass other) {
// Not legal with JDK 6 or 7
other.<error descr="'mPrivate()' has private access in 'Bug'">mPrivate</error>();
// Not redundant with JDK 6 or 7
((Bug)other).mPrivate();
}
private void mPrivate() {
}
}
class SubClass extends Bug {
}
@@ -6,4 +6,28 @@ class A {
System.out.println(t.value);
}
}
}
public class Bug {
// Idea incorrectly analyses this code with JDK 7
public <T extends Bug> void doit(T other) {
// Oops, was legal with JDK 6, no longer legal with JDK 7
other.mPrivate();
// Redundant with JDK 6, not a redundant cast with JDK 7
((Bug)other).mPrivate();
}
// Idea correctly analyses this code
public void doit2(SubClass other) {
// Not legal with JDK 6 or 7
other.<error descr="'mPrivate()' has private access in 'Bug'">mPrivate</error>();
// Not redundant with JDK 6 or 7
((Bug)other).mPrivate();
}
private void mPrivate() {
}
}
class SubClass extends Bug {
}