Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* This file is part of ClassGraph.
*
* Author: Luke Hutchison
*
* Hosted at: https://github.com/classgraph/classgraph
*
* --
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Luke Hutchison
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
* EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
* OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.hazelcast.shaded.nonapi.io.github.classgraph.classpath;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Deque;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import com.hazelcast.shaded.io.github.classgraph.ModuleRef;
import com.hazelcast.shaded.nonapi.io.github.classgraph.reflection.ReflectionUtils;
import com.hazelcast.shaded.nonapi.io.github.classgraph.scanspec.ScanSpec;
import com.hazelcast.shaded.nonapi.io.github.classgraph.utils.CollectionUtils;
import com.hazelcast.shaded.nonapi.io.github.classgraph.utils.LogNode;
/** A class to find the visible modules. */
public class ModuleFinder {
/** The system module refs. */
private List systemModuleRefs;
/** The non system module refs. */
private List nonSystemModuleRefs;
/** If true, must forcibly scan {@code java.class.path}, since there was an anonymous module layer. */
private boolean forceScanJavaClassPath;
private final ReflectionUtils reflectionUtils;
// -------------------------------------------------------------------------------------------------------------
/**
* Get the system modules as {@link ModuleRef} wrappers.
*
* @return The system modules as {@link ModuleRef} wrappers, or null if no modules were found (e.g. on JDK 7 or
* 8).
*/
public List getSystemModuleRefs() {
return systemModuleRefs;
}
/**
* Get the non-system modules as {@link ModuleRef} wrappers.
*
* @return The non-system modules as {@link ModuleRef} wrappers, or null if no modules were found (e.g. on JDK 7
* or 8).
*/
public List getNonSystemModuleRefs() {
return nonSystemModuleRefs;
}
/**
* Force scan java class path.
*
* @return If true, must forcibly scan {@code java.class.path}, since there was an anonymous module layer.
*/
public boolean forceScanJavaClassPath() {
return forceScanJavaClassPath;
}
// -------------------------------------------------------------------------------------------------------------
/**
* Recursively find the topological sort order of ancestral layers.
*
*
* (The JDK (as of 10.0.0.1) uses a broken (non-topological) DFS ordering for layer resolution in
* ModuleLayer#layers() and Configuration#configurations() but when I reported this bug on the Jigsaw mailing
* list, Alan didn't see what the problem was.)
*
* @param layer
* the layer
* @param layerVisited
* layer visited
* @param parentLayers
* the parent layers
* @param layerOrderOut
* the layer order
*/
private void findLayerOrder(final Object /* ModuleLayer */ layer,
final Set