Generics: Class RuntimeEnum references subclass t

I get this error, but the class compiles fine.



public abstract class RuntimeEnum implements Comparable]]> {


public int getOrdinal() {
return ordinal;
}

The "t" is underlined
vvv
public int compareTo( t o ) {
return new Integer( getOrdinal() ).compareTo( o.getOrdinal() );
}
}



Any ideas, comments?

Johannes Schneider

2 comments
Comment actions Permalink

No idea, I just fail to reproduce your example.
Can you post a selfcontained fragment?

Eugene.

"Johannes Schneider" <shake@web.de> wrote in message
news:d7ifal$peh$1@is.intellij.net...

I get this error, but the class compiles fine.

>
>
>

public abstract class RuntimeEnum<t extends RuntimeEnum> implements
Comparable<t> {

>


public int getOrdinal() {
return ordinal;
}

>

The "t" is underlined
vvv
public int compareTo( t o ) {
return new Integer( getOrdinal() ).compareTo( o.getOrdinal() );
}
}

>
>
>

Any ideas, comments?

>

Johannes Schneider



0
Comment actions Permalink

Eugene Vigdorchik (JetBrains) wrote:

No idea, I just fail to reproduce your example.
Can you post a selfcontained fragment?


Well, maybe i should have mentioned, that I have subclassed RuntimeEnum
as follows:


public class MockRuntimeEnum extends RuntimeEnum {
public static EnumHolder getEnumHolder() { return RuntimeEnum.getEnumHolder( MockRuntimeEnum.class ); } public static void addElement( MockRuntimeEnum mockRuntimeEnum ) { getEnumHolder().add( mockRuntimeEnum ); } public static void clear() { getEnumHolder( ).clear(); } public static List]]> getElements() {
return getEnumHolder().getElements();
}

public static MockRuntimeEnum valueOf( String name ) {
return getEnumHolder().valueOf( name );
}



protected MockRuntimeEnum( ) {
}

public MockRuntimeEnum( String name ) {
super( name );
}


}




Is it now possible to reproduce the warning?

Eugene.

"Johannes Schneider" <shake@web.de> wrote in message
news:d7ifal$peh$1@is.intellij.net...

>>I get this error, but the class compiles fine.
>>
>>
>>
>>public abstract class RuntimeEnum implements >>Comparable { >> >>]]>
>> public int getOrdinal() {
>> return ordinal;
>> }
>>
>> The "t" is underlined
>> vvv
>> public int compareTo( t o ) {
>> return new Integer( getOrdinal() ).compareTo( o.getOrdinal() );
>> }
>>}
>>
>>
>>
>>Any ideas, comments?
>>
>>Johannes Schneider


0

Please sign in to leave a comment.