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

ConcurrentHashTable::NoOp omits return in non-void return method

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 16
    • 11, 15, 16
    • hotspot
    • None
    • b22

      Static analysis complains there is a non-void return method without a return statement:

        struct NoOp {
          void operator()(VALUE*) {}
          const VALUE& operator()() {} // <--- here
          void operator()(bool, VALUE*) {}
        } noOp;

      AFAICS, this is UB, and we have seen cases like these break compilers in other places. Not in this case, though, because noOp is only used as the default functor in remove. Still, it would be good to remove that risky definition, so that it is not used accidentally.

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: