Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5080917

lub computes strange compound types

    Details

    • Subcomponent:
    • Introduced In Build:
      5.0
    • Introduced In Version:
      5.0
    • Resolved In Build:
      b67
    • CPU:
      generic, x86
    • OS:
      generic, linux, windows_xp
    • Verification:
      Verified

      Description

      Steve Sides points out that the compiler generates a strange compound type for this program:

      interface I { }
      class X { }
      class A extends X implements I { }
      class B extends X implements I { }
      class Test {
          void test(A a, B b) {
      X x = (a.hashCode() == b.hashCode()) ? a : b;
          }
      }

      Test.java:7: incompatible types
      found : java.lang.Object&I&X
      required: X
              X x = (a.hashCode() == b.hashCode()) ? a : b;
                                                   ^
      1 error

      The compound type should have been X&I and the assignment should have succeded.

      ###@###.### 2004-07-30

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ahe Peter Ahe
                Reporter:
                ahe Peter Ahe
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: