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

Remove explicit casts in CollectorPolicy hierarchy

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b84
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        There are presently several unchecked C-style downcasts to classes in the CollectorPolicy hierarchy. All of these appear to be unnecessary, and could be replaced using existing mechanisms that provide checkable conversions.

        There are also a couple of explicit C-style upcasts to CollectorPolicy* that should be unnecessary. One of them can simply be removed. The other (in G1CollectedHeap::collector_policy) is problematic, as the source class (G1CollectorPolicy) is incomplete in this context. This could result in the explicit cast being treated as a reinterpret_cast, which would be wrong. Alternatively, we could end up with an ODR violation.

        Note that there don't appear to be any explicit C++ style casts involving this hierarchy.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kbarrett Kim Barrett
                  Reporter:
                  kbarrett Kim Barrett
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: