From dab1c48d59251865218dbf5e9b79cbf1deefd8c0 Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 4 Apr 2012 19:59:17 +0200 Subject: [PATCH] additional testdata for inaccessible type params members from IDEA-66305 --- .../TypeParameterBoundVisibility.java | 24 +++++++++++++++++++ .../TypeParameterBoundVisibilityJdk14.java | 24 +++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibility.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibility.java index 406efc451e3d..f93f67b83582 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibility.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibility.java @@ -15,3 +15,27 @@ abstract class Foo> { return t.field; } } + +public class Bug { + // Idea incorrectly analyses this code with JDK 7 + public 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.mPrivate(); + // Not redundant with JDK 6 or 7 + ((Bug)other).mPrivate(); + } + + private void mPrivate() { + } +} + +class SubClass extends Bug { +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibilityJdk14.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibilityJdk14.java index ce2e57ded675..df04ee7de906 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibilityJdk14.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting/TypeParameterBoundVisibilityJdk14.java @@ -6,4 +6,28 @@ class A { System.out.println(t.value); } } +} + +public class Bug { + // Idea incorrectly analyses this code with JDK 7 + public 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.mPrivate(); + // Not redundant with JDK 6 or 7 + ((Bug)other).mPrivate(); + } + + private void mPrivate() { + } +} + +class SubClass extends Bug { } \ No newline at end of file