private static void addDefaultHashCodeMethod ( ClassWriter cw , String implClassName ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , INDENT + "adding method : hashCode ()I" ) ; // ----------------------------------------------------------------------- // public int hashCode() // { // ----------------------------------------------------------------------- final String desc = "()I" ; MethodVisitor mv = cw . visitMethod ( ACC_PUBLIC , "hashCode" , desc , null , null ) ; GeneratorAdapter mg = new GeneratorAdapter ( mv , ACC_PUBLIC , "hashCode" , desc ) ; mg . visitCode ( ) ; // ----------------------------------------------------------------------- // return System.identityHashCode(this); // ----------------------------------------------------------------------- mg . loadThis ( ) ; mg . visitMethodInsn ( INVOKESTATIC , "java/lang/System" , "identityHashCode" , "(Ljava/lang/Object;)I" ) ; mg . returnValue ( ) ; // ----------------------------------------------------------------------- // } // ----------------------------------------------------------------------- mg . endMethod ( ) ; mg . visitEnd ( ) ; }
Adds the default definition for the Object . hashCode method .