Overriding jdk1.5 collection class methods
I'm sorry if this has been asked before, but since using jdk1.5 IDEA gives
errors on
code where I override a collection class method, although it compiles and
runs fine.
For example:
LinkedHashMap cache = new LinkedHashMap(400) {
protected boolean removeEldestEntry(Map.Entry eldest) {
return size() > 5000;
}
};
It overrides this method of LinkedHashMap:
protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
IDEA complains that my override clashes with the base class version of the
method.
Is this something that still has to be fixed for 4.5.2?
--
- Rene Smit
Please sign in to leave a comment.
For me the code you posted is OK with 4.5.1
Eugene..
"Rene Smit" <rene@artsoft.nl> wrote in message
news:opsfcvxzweh23fjb@news.intellij.com...
>
>
>
>
>
>
>
>
Hmm, after I did a rebuild project it's ok here too.
On Wed, 6 Oct 2004 14:52:46 +0400, Evgueny Vigdorchik <ven@intellij.com>
wrote:
>
>
>> I'm sorry if this has been asked before, but since using jdk1.5 IDEA
>> gives
>> errors on
>> code where I override a collection class method, although it compiles
>> and
>> runs fine.
>> For example:
>>
>> LinkedHashMap cache = new LinkedHashMap(400) {
>> protected boolean removeEldestEntry(Map.Entry eldest) {
>> return size() > 5000;
>> }
>> };
>>
>>
>> It overrides this method of LinkedHashMap:
>>
>> protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
>>
>> IDEA complains that my override clashes with the base class version of
>> the
>> method.
>>
>> Is this something that still has to be fixed for 4.5.2?
>>
>> --
>>
>> - Rene Smit
>
>
--
- Rene Smit
If you only get the problem when you are using language level 1.4 and a
5.0 JDK then it sounds like you're tripping over
http://www.intellij.net/tracker/idea/viewSCR?publicId=38174
Maybe you should try a rebuild project too then. It worked for me.
I got another weird error before I did the rebuild, but this time by the
compiler.
It said something like: "Trove discovered that hashCode and equals are
inconsistent"
(I can't remember the message exactly).
However, I did not have those methods in my class, and I have no idea what
Trove is.
This was solved after a rebuild too.
On Thu, 07 Oct 2004 17:10:37 +0200, Robert Gibson
<robbie_usenet@yahoo.co.uk> wrote:
--
- Rene Smit