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.
/*
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must 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 org.pkl.thirdparty.graalvm.nativeimage.hosted;
import java.lang.reflect.Executable;
import java.lang.reflect.Field;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import org.pkl.thirdparty.graalvm.nativeimage.ImageSingletons;
import org.pkl.thirdparty.graalvm.nativeimage.Platform;
import org.pkl.thirdparty.graalvm.nativeimage.Platforms;
/**
* Features allow clients to intercept the native image generation and run custom initialization
* code at various stages. All code within feature classes is executed during native image
* generation, and never at run time.
*
* Features have several advantages over static class initializers (which also run during native
* image generation):
*
*
The different feature methods are called at different stages during native image generation,
* which gives clients control over when code is executed.
*
Feature methods have an {@code access} parameter that allows callbacks into the native image
* generator.
*
Feature methods run when the {@link ImageSingletons} is already set up, which allows features
* to prepare data structures that are then used at run time by querying the {@link ImageSingletons}
* .
*
*
* Implementation classes must have a no-argument constructor, which is used to instantiate a
* singleton instance for each feature using reflection. The following features are included during
* native image generation:
*
*
Features explicitly specified on the command line.
*
Features referenced as {@link #getRequiredFeatures() required} by another included feature.
* Required features are added transitively, and initialization methods of required features are
* called after invoking the constructor and {@link #isInConfiguration} of the requiring features
* (unless the feature dependencies are cyclic).
*
*
* @since 19.0
*/
@Platforms(Platform.HOSTED_ONLY.class)
public interface Feature {
/**
* A URL to documentation or the sources of the feature.
*
* The URL will be used as a link for the feature in the build output (if supported by the
* user's terminal).
*
* @since 22.2
*/
default String getURL() {
return null;
}
/**
* A short description of the feature (e.g., "Enables Truffle support").
*
* The description is displayed to users as part of the build output.
*
* @since 22.2
*/
default String getDescription() {
return null;
}
/**
* Access methods that are available for all feature methods.
*
* @since 19.0
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface FeatureAccess {
/**
* Returns a class if it is present on the classpath.
*
* @since 19.0
*/
Class> findClassByName(String className);
/**
* Returns the class path of the native image that is currently built.
*
* The returned list does not include the native image generator itself, and does not
* include the JDK.
*
* @since 20.2
*/
List getApplicationClassPath();
/**
* Returns the module path of the native image that is currently built.
*
* The returned list does not include the native image generator itself, and does not
* include the JDK.
*
* @since 20.2
*/
List getApplicationModulePath();
/**
* Returns the {@link ClassLoader} that can find all classes of the class path and module
* path.
*
* @since 20.2
*/
ClassLoader getApplicationClassLoader();
}
/**
* Access methods available for {@link Feature#isInConfiguration}.
*
* @since 19.0
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface IsInConfigurationAccess extends FeatureAccess {
}
/**
* Access methods available for {@link Feature#afterRegistration}.
*
* @since 19.0
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface AfterRegistrationAccess extends FeatureAccess {
}
/**
* Access methods available for {@link Feature#duringSetup}.
*
* @since 19.0
*/
@Platforms(Platform.HOSTED_ONLY.class)
interface DuringSetupAccess extends FeatureAccess {
/**
* Registers the provided function to replace objects.
*
* The function checks if an object should be replaced. In such a case, the function creates
* the new object and returns it. The function must return the original object if the object
* should not be replaced.
*
* @since 19.0
*/
void registerObjectReplacer(Function