This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Class.hashCode() broken?


public class HashTest {
    public static void main(String[] args) {
        HashTest ht = new HashTest();

        System.err.println(ht.hashCode());
        System.err.println(ht.getClass().hashCode());
    }
}

gives me:

134770680
Aborted

gdb says:

Program received signal SIGSEGV, Segmentation fault.
0x0 in ?? ()
(gdb) bt
#0  0x0 in ??()
#1  0x804ad4f in HashTest.main (args=0x806eff0) at
    HashTest.java:6

Weird... hashCode() works in java.lang.Object, but fails in
java.lang.Class, which inherits from Object and does not override
hashCode().

-- 
Jeff Sturm
jsturm@sigma6.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]