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

Remove explicit casts in CollectorPolicy hierarchy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • None
    • gc
    • b84
    • generic
    • generic

        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.

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

                Created:
                Updated:
                Resolved: