IDEA-120784 "Class is public should be declared in a file named <Classname>.java" for inner interface

This commit is contained in:
Alexey Kudravtsev
2014-02-18 13:55:52 +04:00
parent 65642d998f
commit c7b78f76a2
309 changed files with 381 additions and 364 deletions
@@ -1,10 +1,10 @@
public class CssPropertyValueImpl extends CssTableValueBase<CssPropertyValue, Object> implements CssPropertyValue {
class CssPropertyValueImpl extends CssTableValueBase<CssPropertyValue, Object> implements CssPropertyValue {
public CssPropertyValueImpl(final Type type) {
super(type);
}
}
public abstract class CssTableValueBase<V extends CssTableValue, T> implements CssTableValue<V, T> {
abstract class CssTableValueBase<V extends CssTableValue, T> implements CssTableValue<V, T> {
protected CssTableValueBase(final Type type) {
}
@@ -1,5 +1,5 @@
@Deprecated @SuppressWarnings("")
<error descr="Class 'Foo' must either be declared abstract or implement abstract method 'run()' in 'Runnable'">public class Foo implements Runnable</error> {
<error descr="Class 'Foo' must either be declared abstract or implement abstract method 'run()' in 'Runnable'">class Foo implements Runnable</error> {
}
@@ -1,4 +1,4 @@
public class Autoboxing {
class Autoboxing {
public boolean compare(short s, Integer i) {
return i == s; //OK, i is unboxed
}
@@ -1,4 +1,4 @@
public class Test {
class Test {
public Test(Object a) {
}
@@ -1,4 +1,4 @@
public class Autoboxing {
class Autoboxing {
void method(int i) {
System.out.println("i = " + i);
}
@@ -19,7 +19,7 @@ public class Autoboxing {
m2(new Integer(10));
}
}
public class Autoboxing1 {
class Autoboxing1 {
void method(String s, int i) {
System.out.println("i = " + i);
}
@@ -1,4 +1,4 @@
public class Main {
class Main {
public <T> T getAttribute() {return null;}
public <T> T getAttribute(T def) {return null;}
@@ -16,7 +16,7 @@
import java.util.*;
public class Test {
class Test {
public static void bar() {
<error descr="Incompatible types. Found: 'java.lang.Class<capture<? extends java.util.Iterator>>', required: 'java.lang.Class<? extends java.util.Iterator<?>>'">Class<? extends Iterator<?>> c = foo();</error>
}
@@ -12,7 +12,7 @@ abstract class CCC2<T> extends DT<T> implements I<T> {
}
class a extends b<d, c> implements c<d, c<c,c>>, d<b<c<c,c>,d>> {}
public class b<K,V> implements c<K, c<V,V>> { }
class b<K,V> implements c<K, c<V,V>> { }
interface c<K,V> extends d<b<V,K>> {}
interface d<K> {}
@@ -28,7 +28,7 @@ class GenericExtendItself<T, U extends T>
////////////////////
public abstract class ZZZZ<E> {
abstract class ZZZZ<E> {
public abstract E getElement();
}
abstract class Z<E> extends ZZZZ<E> {}
@@ -5,7 +5,7 @@ interface YO<<warning descr="Type parameter 'T' is never used">T</warning>> {}
interface YO1 extends YO<String> {}
interface YO2 extends YO<Integer> {}
public class ConvertibleTest {
class ConvertibleTest {
YO2 bar (YO1 s) {
return <error descr="Inconvertible types; cannot cast 'YO1' to 'YO2'">(YO2) s</error>;
@@ -19,7 +19,7 @@ interface Interface2 {}
class Implementation implements Interface1 {}
public class InconvertibleTypesTest <E extends Interface2>
class InconvertibleTypesTest <E extends Interface2>
{
E thing;
@@ -1,6 +1,6 @@
import java.util.List;
public class Test {
class Test {
interface P {
@@ -1,6 +1,6 @@
import java.util.Comparator;
public class Main2 {
class Main2 {
static class OfRef<T> {
public OfRef() {
this((Comparator<? super T>) naturalOrder());
@@ -5,7 +5,7 @@ interface EntityId<E extends BusinessEntity> {
E getEntity();
}
public class MyTest {
class MyTest {
<T extends BusinessEntity<T>> T getEntity(EntityId<T> defaultValue) {
return getEntityID(defaultValue).getEntity();
}
@@ -1,7 +1,7 @@
import java.util.*;
public class MyList extends ArrayList {}
class MyList extends ArrayList {}
public class Test {
class Test {
public void test() {
List<? super List> list = new ArrayList<List>();
list.add(new MyList());
@@ -1,4 +1,4 @@
public class TestGenericMap<A extends Comparable<A>, B extends Comparable<B>>
class TestGenericMap<A extends Comparable<A>, B extends Comparable<B>>
{
public TestGenericMap<B, A> inverse()
{
@@ -9,7 +9,7 @@ interface Bar {
<T extends FooObject, I extends FooId<? extends T>> Collection<T> get(Collection<I> keys);
}
public class Target {
class Target {
void foo(Bar bar) {
final Set<FooId<?>> keys = null;
final Collection<FooObject> values = bar.get(keys);
@@ -1,6 +1,6 @@
import java.util.Map;
public class Test {
class Test {
void bar(Prop p) {
Map<? extends String, ? extends String> map = <error descr="Inconvertible types; cannot cast 'Prop' to 'java.util.Map<? extends java.lang.String,? extends java.lang.String>'">(Map<? extends String, ? extends String>)p</error>;
}
@@ -1,6 +1,6 @@
import java.io.Serializable;
public abstract class Test {
abstract class Test {
abstract <T> T test(Class<T> cls);
@@ -1,4 +1,4 @@
public class Test {
class Test {
{
final <error descr="Incompatible types. Found: 'java.lang.Object', required: 'MyResult'">MyResult hello = parseXML(new Parser());</error>
}
@@ -1,7 +1,7 @@
import java.util.Collections;
import java.util.Set;
public class Test<Y> {
class Test<Y> {
public static <K> Test<K> doTest(K k){
return null;
@@ -1,6 +1,6 @@
import java.util.Collection;
public class IncorrectError extends NarrowClass {
class IncorrectError extends NarrowClass {
public Collection<String> bar() {
return super.doStuff();
}
@@ -1,6 +1,6 @@
import java.io.Serializable;
public class Test {
class Test {
public <T extends Serializable> void foo(byte[] data) {
T foo = (T) data;
}
@@ -1,6 +1,6 @@
import java.util.List;
public class MyTest {
class MyTest {
static void m(List<? extends List> c) {
List<? extends List<?>> d = <warning descr="Unchecked cast: 'java.util.List<capture<? extends java.util.List>>' to 'java.util.List<? extends java.util.List<?>>'">(List<? extends List<?>>)c</warning>;
@@ -1,7 +1,7 @@
import java.util.Comparator;
import java.util.List;
public class IdeaBugTest {
class IdeaBugTest {
public void foo(List<Base> base) {
MyCollection.fun<error descr="'fun(java.util.List<? extends Base>, java.util.Comparator<? super Base>)' in 'MyCollection' cannot be applied to '(java.util.List<Base>, SubComparator)'">(base, new SubComparator())</error>;
}
@@ -1,8 +1,7 @@
import java.util.Collection;
import java.util.List;
public class Testsss {
class Testsss {
public <TA, CA extends Iterable<TA>> void that(Iterable<TA> target) {}
@@ -1,4 +1,4 @@
public interface I<K> {
interface I<K> {
}
abstract class SpringHighlightingTestCase<T extends I>{
@@ -1,4 +1,4 @@
public abstract class BiFunction<A,B> {
abstract class BiFunction<A,B> {
public abstract B apply(A a);
public abstract A unapply(B b);
public BiFunction<B,A> flip() {
@@ -1,4 +1,4 @@
public class GoodCodeIsRed {
class GoodCodeIsRed {
public void test() {
FileIF file = new FileImpl();
@@ -1,7 +1,7 @@
import java.util.Collection;
import java.util.Collections;
public class IDEABug {
class IDEABug {
static class ClassA {
static <T> void sayHello(Collection<? extends T> msg) {}
@@ -1,7 +1,7 @@
import java.util.Collection;
import java.util.Collections;
public class IDEABug {
class IDEABug {
static class ClassA {
static <T> void sayHello(Collection<? extends T> msg) {}
@@ -1,6 +1,6 @@
import java.util.List;
public class SubClass extends BaseClass<String> {
class SubClass extends BaseClass<String> {
public static void main(String[] args) {
new SubClass().method(null);
}
@@ -1,4 +1,4 @@
public class IdeaBugTest {
class IdeaBugTest {
interface A<T> {
}
@@ -1,5 +1,5 @@
import java.util.*;
public class IdeaGenericsTest {
class IdeaGenericsTest {
interface Animal<T extends Animal<T>> {
List<T> getFriends();
}
@@ -1,7 +1,7 @@
import java.util.Comparator;
import java.util.Set;
public class CastError {
class CastError {
public void foo(Comparator<? super byte[]> comparator) throws Exception {
MyComparator comparator1 = (MyComparator) comparator;
}
@@ -7,7 +7,7 @@ class B<T> {
B(List<A<?>> list) {}
}
public class Bug {
class Bug {
private static B case1(A<?> a) {
return new B(Collections.singletonList(a));
@@ -1,4 +1,4 @@
public class C1<T extends C1<T>>{
class C1<T extends C1<T>>{
public static class C2<K extends C1<K>> extends C1<K>{}
public static class C3<Z> extends C2<<error descr="No wildcard expected">? extends C3<Z></error>>{}
}
@@ -1,6 +1,6 @@
import java.util.*;
public class Test<T>
class Test<T>
{
List<Collection<T>> getList ()
{
@@ -1,7 +1,7 @@
import java.util.Collections;
import java.util.Map;
public class IDEA74899 {
class IDEA74899 {
void foo() {
Map<String, String> m = Collections.emptyMap();
if (<error descr="Operator '==' cannot be applied to 'java.util.Map<java.lang.String,java.lang.String>', 'java.util.Map<java.lang.Object,java.lang.Object>'">m == Collections.emptyMap()</error>) {
@@ -1,5 +1,5 @@
import java.util.*;
public class IDEA76283 {
class IDEA76283 {
}
interface Parametrized<T extends Number> {
@@ -1,6 +1,6 @@
import java.util.List;
public class IDEA80386 {
class IDEA80386 {
void foo(Class<List> listClass) {
<error descr="Incompatible types. Found: 'java.lang.Class<java.util.List>', required: 'java.lang.Class<? extends java.util.List<?>>'">Class<? extends List<?>> cls = listClass;</error>
Class < ?extends List > cls1 = listClass;
@@ -1,6 +1,6 @@
import java.util.Iterator;
public class WildcardGenericAndPrivateField {
class WildcardGenericAndPrivateField {
private Object field;
@@ -3,7 +3,7 @@ import java.util.ArrayList;
import java.util.List;
/** @noinspection UnusedDeclaration*/
public class GenericsTest98 {
class GenericsTest98 {
public static void main(String[] args) throws Exception{
List<Movable<? extends Serializable>> list = new ArrayList<Movable<? extends Serializable>> ();
Factory factory = Factory.newInstance();
@@ -1,7 +1,7 @@
import java.util.List;
import java.util.Arrays;
public class ZZZ {
class ZZZ {
List<Class<?>> f(Class<?>[] exceptionTypes) {
List<Class<?>> nd = Arrays.asList(exceptionTypes);
@@ -38,7 +38,7 @@ class BreakpointTree<TP> {
class Node {}
class XBreakpoint<SR>{}
public class GenericInnerClass<E> {
class GenericInnerClass<E> {
private void problem( Base base ) {
if ( base instanceof First) {}
}
@@ -1,6 +1,6 @@
import java.lang.annotation.Annotation;
public @interface Foo {
@interface Foo {
String id();
}
@@ -8,7 +8,7 @@ class CLS {
}
}
//////////////////////////////
public abstract class ZZZ<K> {
abstract class ZZZ<K> {
public abstract <T extends String> ZZZ<T> get();
}
class Z2<K> extends ZZZ<K> {
@@ -44,7 +44,7 @@ interface Callable<V> {
class B extends A {}
}
//////////////////////////
public class BadCodeGreen<T, C extends Collection<? extends T>> {
class BadCodeGreen<T, C extends Collection<? extends T>> {
public BadCodeGreen(C c, T t) {
c.add<error descr="'add(capture<? extends T>)' in 'java.util.Collection' cannot be applied to '(T)'">(t)</error>;
}
@@ -1,4 +1,4 @@
public class ExampleProblem {
class ExampleProblem {
<T> void asserting(T t, Simple<T> l){
}
@@ -1,5 +1,4 @@
public class NestedGenericGoodCodeIsRed {
class NestedGenericGoodCodeIsRed {
public void main( String[] args ) {
satisfiesAllOf(isPositive(), isEqualTo(10.9));
@@ -1,7 +1,7 @@
import java.util.*;
import Node.Details;
public class Node<E> {
class Node<E> {
public class Details {
public E data;
}
@@ -167,7 +167,7 @@ class Axx {
}
///////////////
interface L {}
public class MaximalType {
class MaximalType {
public static <T> T getParentOfType(Class<? extends T>... classes) {
classes.hashCode();
return null;
@@ -11,5 +11,5 @@ class ExampleSuperClass {
}
public class ExampleSubClass extends ExampleSuperClass implements ExampleInterface {
class ExampleSubClass extends ExampleSuperClass implements ExampleInterface {
}
@@ -116,7 +116,7 @@ abstract class A8 implements II1<Integer>, II2<Number>{}
abstract class HasGenericMethods<T> {
abstract <P> void toArray(P[] p);
}
public class RawOverridesGenericMethods extends HasGenericMethods{
class RawOverridesGenericMethods extends HasGenericMethods{
public void toArray(Object[] ps) {
}
}
@@ -160,7 +160,7 @@ class BarIU {
interface IU {
public <I> I[] toArray(I[] ts);
}
public class BarIUBarIU extends BarIU implements IU{
class BarIUBarIU extends BarIU implements IU{
public <T> T[] toArray(T[] ts) {
return null;
}
@@ -339,7 +339,7 @@ final class Manista extends Super<Collection> {
//end of IDEADEV-8393
///////////////////
public class Prim {
class Prim {
Object g() {
return null;
}
@@ -366,7 +366,7 @@ class BubbleTypeDispatcher extends DefaultDispatcher<Node, String> {
//end of IDEADEV-21921
////////////////////////////////////////
public class Bug2 extends SmartList<Bug2> implements Places {
class Bug2 extends SmartList<Bug2> implements Places {
}
interface Places extends java.util.List<Bug2> {}
@@ -433,37 +433,37 @@ interface PsiElement {
String toString();
}
///////////////////////IDEADEV-24300 ////////////////////////
public class ActionContext<A extends ContextAction> {
class ActionContext<A extends ContextAction> {
}
public abstract class ContextAction<AC extends ActionContext> {
abstract class ContextAction<AC extends ActionContext> {
protected abstract void performAction(AC context);
}
public class OurAction extends TableContextAction<Object> {
class OurAction extends TableContextAction<Object> {
protected void performAction(TableContext<Object> context) {
}
}
public class TableContext<TCP> extends ActionContext<TableContextAction<TCP>> {
class TableContext<TCP> extends ActionContext<TableContextAction<TCP>> {
}
public abstract class TableContextAction<RO> extends ContextAction<TableContext<RO>> {
abstract class TableContextAction<RO> extends ContextAction<TableContext<RO>> {
}
///////////////////////////////IDEADEV-23176 /////////////////////
public interface MyListModel { }
public interface MyList {
interface MyListModel { }
interface MyList {
Object get(int i);
int hashCode();
}
public interface MutableListModel extends MyListModel, MyList {
interface MutableListModel extends MyListModel, MyList {
}
public class ListModelImpl {
class ListModelImpl {
public Object get(int i) {
return null;
}
}
public class MutableListModelImpl extends ListModelImpl implements MutableListModel {
class MutableListModelImpl extends ListModelImpl implements MutableListModel {
}
///////////////////////////////////////////////////////////////
public class InheritanceBug {
class InheritanceBug {
interface A {
Object clone();
}
@@ -1,6 +1,6 @@
import java.util.Comparator;
public abstract class A implements <error descr="'A.B' has private access in 'A'">Comparator<A.B></error> {
abstract class A implements <error descr="'A.B' has private access in 'A'">Comparator<A.B></error> {
private static class B {
}
@@ -159,7 +159,7 @@ class Test1<X> {
/////////////// signatures in non-parameterized class are not erased
public class C3 {
class C3 {
public int get(Class<?> c) {
return 0;
}
@@ -11,8 +11,8 @@ class Bar {
foo.getText(prop);
}
}
public abstract class Hashtable<K,V> implements Map<K,V>, Cloneable {
abstract class Hashtable<K,V> implements Map<K,V>, Cloneable {
}
public abstract class Properties extends Hashtable<Object,Object> {
abstract class Properties extends Hashtable<Object,Object> {
}
@@ -38,10 +38,10 @@ class Primitives<T> {
/////// calling super on generic bound class
public class Generic<T> {
class Generic<T> {
Generic(T t){}
}
public class Bound extends Generic<String>{
class Bound extends Generic<String>{
public Bound(String s) {
super(s);
}
@@ -1,4 +1,4 @@
public class SOE {
class SOE {
}
abstract class VersionEntity<V extends Version<V, R>, R extends Ref<V, R>>
implements Version<V, R>{}
@@ -14,7 +14,7 @@ class SameSignatureTest {
void f(Object o) {}
}
public class Test1 {
class Test1 {
<error descr="'bug(String)' clashes with 'bug(String)'; both methods have same erasure">public void bug(String s)</error> {
}
@@ -1,9 +1,8 @@
import static java.util.Arrays.asList;
import static java.util.Arrays.sort;
<warning descr="Unused import statement">import static java.util.Arrays.binarySearch;</warning>
public class StaticImports {
class StaticImports {
{
asList(new Object[]{});
}
@@ -1,6 +1,6 @@
import java.util.*;
public class MyClass implements Comparator<String> {
class MyClass implements Comparator<String> {
<error descr="Static method 'compare(String, String)' in 'MyClass' cannot override instance method 'compare(T, T)' in 'java.util.Comparator'">public static int compare(String a, String b)</error> {
return 42;
@@ -78,7 +78,7 @@ class U {
//end of IDEADEV-6738
///////////////////////////////////
public class Err {
class Err {
void f() {
Decl[] extensions = getExtensions(Decl.EXTENSION_POINT_NAME);
}
@@ -16,7 +16,7 @@ abstract class Foo<T extends Foo<T>> {
}
}
public class Bug {
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
@@ -8,7 +8,7 @@ class A {
}
}
public class Bug {
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
@@ -20,7 +20,7 @@ class Stuff<X extends Stuff & Runnable> {
}
////////////////
public class TypeParameters {
class TypeParameters {
class X {}
static <T extends X> void f(Class<T> t){}
@@ -1,4 +1,4 @@
public class WithingBounds {
class WithingBounds {
interface I {
}
interface I1 {
@@ -9,7 +9,7 @@ import java.util.Comparator;
* Time: 8:08:44 PM
* To change this template use File | Settings | File Templates.
*/
public class VarianceTesting {
class VarianceTesting {
void method(List<? extends VarianceTesting> l) {
// l.add(new VarianceTesting());
l.add(null);
@@ -9,7 +9,7 @@ abstract class AbstractNumberConverter<N extends Number> implements IConverter<N
class DoubleConverter extends AbstractNumberConverter<Double> {
}
public class Test {
class Test {
public static <C> IConverter<C> getConverter(Class<C> type) {
return (IConverter<C>)new DoubleConverter() {
};
@@ -1,4 +1,4 @@
public class Test {
class Test {
interface A {}
interface B {}
@@ -130,7 +130,7 @@ class BoundedWildcard {
//end of IDEADEV-5816
interface I33 {}
public class Q<T extends I33> {
class Q<T extends I33> {
T t;
<V extends I33> List<V> foo(Q<V> v) {
v.hashCode();
@@ -1,6 +1,6 @@
import java.util.List;
public class Main<T> {
class Main<T> {
Object get(List<DiagramNode<T>> nodes, A a) {
return null;
}