Sponsoring getting 5015163 "(str) String merge/join that is the inverse of String.split()" into JDK 7

Neal Gafter neal at gafter.com
Tue Oct 27 14:53:49 UTC 2009


Try adding

  public static hashCode(Object key) {
      return 3;
  }

to MyClass.  Such a class is broken by the proposed change.

On Tue, Oct 27, 2009 at 2:49 AM, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:

> Correction:
>
>
> public class MyClass1 {
>  private final int value;
>
>  public MyClass1(int value) {
>      this.value = value;
>  }
>
>  public static int hashCode(MyClass1 obj) {
>      return 3 * obj.value;
>  }
>
>  public static void main(String... args) {
>      MyClass1 c = new MyClass1(99);
>      System.out.println(c.hashCode());
>      System.out.println(hashCode(c));
>      System.out.println(Object.hashCode(c)); // compile error if using
> official version of class Object
>  }
> }
>
>
> -Ulf
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20091027/2189588e/attachment.html>


More information about the core-libs-dev mailing list