• Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P4 P4
    • 19
    • None
    • core-libs
    • b23

      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."

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

              Created:
              Updated:
              Resolved: