private void initializeClassData(Object mock) {
    Class<?> mockClassOfMockObj = mock.getClass();
    if (mockClass == null) {
      synchronized (this) {
        if (mockClass == null) {
          finalMethods = Arrays.stream(mockClassOfMockObj.getMethods())
            .filter(m -> !ModifierSupport.isStatic(m))
            .collect(Collectors.groupingBy(Method::getName))
            .entrySet()
            .stream()
            .filter(e -> e.getValue()
              .stream()
              .allMatch(ModifierSupport::isFinal))
            .map(Map.Entry::getKey)
            .collect(Collectors.toSet());

          mockClass = mockClassOfMockObj;
        }
      }
    }

    if (mockClass != mockClassOfMockObj) {
      throw new IllegalStateException();
    }
  }
{@link ByteBuddyMockInteractionValidator} validates the {@link IMockInteraction} for {@link ByteBuddyMockMaker} mocks.

<ul>
  <li>Checks for method interactions on final methods</li>
  <li>Checks for property interactions on final methods</li>
</ul>

<p>Implementation note: The {@link ByteBuddyMockFactory} create a single instance for each mocked class
and the same validation is used for multiple mocks of the same class.

@author Andreas Turban
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockInteractionValidator.java