Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
    • Resolved In Build:
      b23

      Description

      Existing code within java.base uses implicit casts for a variety of compound assignments.
      8244681: proposes to add compiler warnings for possible lossy conversions

      The warnings should be addressed to clear up the warnings by adding explicit casts to replace the implicit casts.
      In most cases, the cast matches the type of the right-hand side to type of the compound assignment.
      Since these casts are truncating the value, there might be a different refactoring that avoids the cast.

      From the CSR:

      "If the type of the right-hand operand of a compound assignment is not assignment compatible with the type of the variable, a cast is implied and possible lossy conversion may silently occur. While similar situations are resolved as compilation errors for primitive assignments, there are no similar rules defined for compound assignments."

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rriggs Roger Riggs
              Reporter:
              asotona Adam Sotona
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: