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

Compiler improperly implements a casting conversion from Object to int

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      FULL PRODUCT VERSION :
      All java 7 versions after Changeset: d3ead6731a91 improperly purporting to "fix" the "bug" (which wasn't actually a bug) 6979683


      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Enterprise 64-bit

      A DESCRIPTION OF THE PROBLEM :
      javac was changed in changeset d3ead6731a91 to accept many casting conversions that are not specified in the JLS. This must be fixed before the product is released, otherise the existence of customer code depending on this misfeature will prevent the bug fix. In other words, if fixed after the next product release, it would be a breaking change.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile these lines in a method:

      Object o = 3;
      int i = (int) o;

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should fail to compile.
      ACTUAL -
      Compiles without error.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      none (unfortunately)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See steps to reproduce
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Use jdk 6

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mcimadamore Maurizio Cimadamore
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: