1 /* 2 * Copyright (c) 2017 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 package org.mockito.internal.creation.bytebuddy; 6 7 import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; 8 9 /** 10 * A subclass loader is responsible for resolving a class loading strategy for a mock that is implemented as a subclass. 11 */ 12 public interface SubclassLoader { 13 14 /** 15 * Checks if this loader does not require a module to be open. 16 * 17 * @return {@code true} if this loader is not constraint to a target module being opened for loading a class. 18 */ isDisrespectingOpenness()19 boolean isDisrespectingOpenness(); 20 21 /** 22 * Resolves a class loading strategy. 23 * 24 * @param mockedType The type being mocked. 25 * @param classLoader The class loader being used. 26 * @param localMock {@code true} if the mock is loaded within the runtime package of the mocked type. 27 * @return An appropriate class loading strategy. 28 */ resolveStrategy( Class<?> mockedType, ClassLoader classLoader, boolean localMock)29 ClassLoadingStrategy<ClassLoader> resolveStrategy( 30 Class<?> mockedType, ClassLoader classLoader, boolean localMock); 31 } 32