content: /*
   * DazzleConf
   * Copyright © 2025 Anand Beh
   *
   * DazzleConf is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * DazzleConf is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU Lesser General Public License for more details.
   *
   * You should have received a copy of the GNU Lesser General Public License
   * along with DazzleConf. If not, see <https://www.gnu.org/licenses/>
   * and navigate to version 3 of the GNU Lesser General Public License.
   */
  
  package space.arim.dazzleconf.internals;
  
  import space.arim.dazzleconf.internals.jdk11.AccessCheckingJPMS;
  
  import java.lang.reflect.Modifier;
  
  /**
   * Java 8 users are the reason this class exists. Please update to JDK 11 or later.
   */
  public final class AccessChecking {
  
  	private static final boolean JPMS;
  
  	static {
  		boolean jpms;
  		try {
  			Class.forName("java.lang.Module");
  			jpms = true;
  		} catch (ClassNotFoundException java8) {
  			jpms = false;
  		}
  		JPMS = jpms;
  	}
  
  	private AccessChecking() {}
  
  	public static boolean isAccessible(Class<?> type) {
  		return Modifier.isPublic(type.getModifiers())
  				&& (!JPMS || AccessCheckingJPMS.isAccessible(type));
  	}
  
  }
  