Class Plugin.Engine.Default.SourceEntryPrependingClassFileLocator

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, ClassFileLocator
    Enclosing class:
    Plugin.Engine.Default

    @Enhance
    protected static class Plugin.Engine.Default.SourceEntryPrependingClassFileLocator
    extends java.lang.Object
    implements ClassFileLocator
    A class file locator that shadows a given Plugin.Engine.Source.Element's type with the explicit element. This avoids that caching yields the wrong class file in case of multi-release jars.
    • Field Detail

      • name

        private final java.lang.String name
        The name of the represented type.
      • delegate

        private final ClassFileLocator delegate
        The actual class file locator to query for all other types.
    • Constructor Detail

      • SourceEntryPrependingClassFileLocator

        protected SourceEntryPrependingClassFileLocator​(java.lang.String name,
                                                        Plugin.Engine.Source.Element element,
                                                        ClassFileLocator delegate)
        Creates a class file locator that prepends a Plugin.Engine.Source.Element.
        Parameters:
        name - The name of the represented type.
        element - The corresponding source element.
        delegate - The actual class file locator to query for all other types.
    • Method Detail

      • locate

        public ClassFileLocator.Resolution locate​(java.lang.String name)
                                           throws java.io.IOException
        Locates the class file for a given type and returns the binary data of the class file.
        Specified by:
        locate in interface ClassFileLocator
        Parameters:
        name - The name of the type to locate a class file representation for.
        Returns:
        Any binary representation of the type which might be illegal.
        Throws:
        java.io.IOException - If reading a class file causes an error.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException