Top Description Inners Fields Constructors Methods
jdk.tools.jlink.internal.plugins

public Class StringSharingPlugin

extends AbstractPlugin
implements ResourcePrevisitor
Class Inheritance
All Implemented Interfaces
jdk.tools.jlink.internal.ResourcePrevisitor
Imports
java.lang.classfile.*, java.lang.classfile.attribute.*, java.lang.classfile.constantpool.*, java.io.ByteArrayInputStream, .ByteArrayOutputStream, .DataInputStream, .DataOutputStream, .IOException, java.nio.ByteBuffer, java.util.ArrayList, .HashSet, .List, .Map, .Set, java.util.function.Predicate, jdk.internal.jimage.decompressor.CompressIndexes, .SignatureParser, .StringSharingDecompressor, jdk.tools.jlink.internal.ResourcePoolManager.ResourcePoolImpl, .ResourcePoolManager, .ResourcePrevisitor, .StringTable, jdk.tools.jlink.plugin.PluginException, .ResourcePool, .ResourcePoolBuilder, .ResourcePoolEntry

A Plugin that stores the image classes constant pool UTF_8 entries into the Image StringsTable.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Predicate<String>
private static final int[]
Inherited from jdk.tools.jlink.internal.plugins.AbstractPlugin:
DESCRIPTIONUSAGE

Constructor Summary

AccessConstructor and Description
public
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
configure(Map<String, String>
The plugin configuration.
config
)

Overrides default jdk.tools.jlink.plugin.Plugin.configure.

Configure the plugin based on the passed configuration.

public Plugin.Category
getType()

Overrides default jdk.tools.jlink.plugin.Plugin.getType.

The type of this plugin.

public boolean
hasArguments()

Overrides default jdk.tools.jlink.plugin.Plugin.hasArguments.

Has this plugin require one or more arguments?

public void
previsit(ResourcePool
Read only resources.
resources
,
StringTable
StringTable instance. Add string to the StringTable to track string usage.
strings
)

Implements jdk.tools.jlink.internal.ResourcePrevisitor.previsit.

Previsit the collection of resources.

public ResourcePool
transform(ResourcePool
Read only content.
in
,
ResourcePoolBuilder
The pool to fill with content. This pool must contain the result of the visit.
result
)

Implements jdk.tools.jlink.plugin.Plugin.transform.

Visit the content of the modules that are composing the image.

Inherited from jdk.tools.jlink.internal.plugins.AbstractPlugin:
getArgumentsDescriptiongetDescriptiongetMessagegetNamegetUsagenewClassReadernewClassReader

Field Detail

predicateback to summary
private Predicate<String> predicate
SIZESback to summary
private static final int[] SIZES

Constructor Detail

StringSharingPluginback to summary
public StringSharingPlugin()
StringSharingPluginback to summary
pack-priv StringSharingPlugin(Predicate<String> predicate)

Method Detail

configureback to summary
public void configure(Map<String, String> config)

Overrides default jdk.tools.jlink.plugin.Plugin.configure.

Doc from jdk.tools.jlink.plugin.Plugin.configure.

Configure the plugin based on the passed configuration. This method is called prior to invoke the plugin.

Parameters
config:Map<String, String>

The plugin configuration.

Annotations
@Override
getTypeback to summary
public Plugin.Category getType()

Overrides default jdk.tools.jlink.plugin.Plugin.getType.

Doc from jdk.tools.jlink.plugin.Plugin.getType.

The type of this plugin.

Returns:Plugin.Category

The type of this plugin

Annotations
@Override
hasArgumentsback to summary
public boolean hasArguments()

Overrides default jdk.tools.jlink.plugin.Plugin.hasArguments.

Doc from jdk.tools.jlink.plugin.Plugin.hasArguments.

Has this plugin require one or more arguments? A plugin can have one or more optional arguments.
A plugin option with a single argument is specified as follows:

     --plugin-option=arg_value
 
If there are more than arguments, command line option looks like:
     --plugin-option=arg_value:arg2=value2:arg3=value3...
Returns:boolean

true if arguments are needed.

Annotations
@Override
previsitback to summary
public void previsit(ResourcePool resources, StringTable strings)

Implements jdk.tools.jlink.internal.ResourcePrevisitor.previsit.

Doc from jdk.tools.jlink.internal.ResourcePrevisitor.previsit.

Previsit the collection of resources.

Parameters
resources:ResourcePool

Read only resources.

strings:StringTable

StringTable instance. Add string to the StringTable to track string usage.

Annotations
@Override
transformback to summary
public ResourcePool transform(ResourcePool in, ResourcePoolBuilder result)

Implements jdk.tools.jlink.plugin.Plugin.transform.

Doc from jdk.tools.jlink.plugin.Plugin.transform.

Visit the content of the modules that are composing the image.

Parameters
in:ResourcePool

Read only content.

result:ResourcePoolBuilder

The pool to fill with content. This pool must contain the result of the visit.

Annotations
@Override
jdk.tools.jlink.internal.plugins back to summary

private final Class StringSharingPlugin.CompactCPHelper

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.tools.jlink.internal.plugins.StringSharingPlugin.CompactCPHelper

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private byte[]
optimize(ResourcePoolEntry resource, ResourcePoolBuilder resources, StringTable strings, Set<Integer> descriptorIndexes, byte[] content)

public byte[]
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CompactCPHelperback to summary
private CompactCPHelper()

Method Detail

optimizeback to summary
private byte[] optimize(ResourcePoolEntry resource, ResourcePoolBuilder resources, StringTable strings, Set<Integer> descriptorIndexes, byte[] content) throws Exception
Annotations
@SuppressWarnings:fallthrough
transformback to summary
public byte[] transform(ResourcePoolEntry resource, ResourcePoolBuilder out, StringTable strings) throws IOException, Exception
writeDescriptorReferenceback to summary
private void writeDescriptorReference(DataOutputStream out, List<Integer> indexes) throws IOException
writeUTF8Referenceback to summary
private void writeUTF8Reference(DataOutputStream out, int index) throws IOException
jdk.tools.jlink.internal.plugins back to summary

private final Class StringSharingPlugin.CompactCPHelper.DescriptorsScanner

extends Object
Class Inheritance
  • java.lang.Object
  • jdk.tools.jlink.internal.plugins.StringSharingPlugin.CompactCPHelper.DescriptorsScanner

Field Summary

Modifier and TypeField and Description
private final ClassModel

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private Set<Integer>
scan()

private void
scanAnnotation(Annotation annotation, Set<Integer> utf8Descriptors)

private void
scanAttributes(List<Attribute<?>> attributes, Set<Integer> utf8Descriptors)

private void
scanConstantPool(Set<Integer> utf8Descriptors)

private void
scanElementValue(AnnotationValue value, Set<Integer> utf8Descriptors)

private void
scanFields(Set<Integer> utf8Descriptors)

private void
scanMethods(Set<Integer> utf8Descriptors)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cmback to summary
private final ClassModel cm

Constructor Detail

DescriptorsScannerback to summary
private DescriptorsScanner(ClassModel cm)

Method Detail

scanback to summary
private Set<Integer> scan() throws Exception
scanAnnotationback to summary
private void scanAnnotation(Annotation annotation, Set<Integer> utf8Descriptors) throws Exception
scanAttributesback to summary
private void scanAttributes(List<Attribute<?>> attributes, Set<Integer> utf8Descriptors) throws Exception
scanConstantPoolback to summary
private void scanConstantPool(Set<Integer> utf8Descriptors) throws Exception
scanElementValueback to summary
private void scanElementValue(AnnotationValue value, Set<Integer> utf8Descriptors) throws Exception
scanFieldsback to summary
private void scanFields(Set<Integer> utf8Descriptors) throws Exception
scanMethodsback to summary
private void scanMethods(Set<Integer> utf8Descriptors) throws Exception