Top Description Inners Fields Constructors Methods
sun.tools.jar

pack-priv final Class FingerPrint

extends Object
Class Inheritance
Imports
java.io.IOException, java.lang.reflect.AccessFlag, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.HashSet, .Set, java.util.function.Consumer, java.lang.classfile.AccessFlags, .Attributes, .ClassElement, .ClassFile, .FieldModel, .MethodModel, java.lang.classfile.constantpool.*, java.lang.classfile.attribute.EnclosingMethodAttribute, .InnerClassesAttribute

A FingerPrint is an abstract representation of a JarFile entry that contains information to determine if the entry represents a class or a resource, and whether two entries are identical. If the FingerPrint represents a class, it also contains information to (1) describe the public API; (2) compare the public API of this class with another class; (3) determine whether or not it's a nested class and, if so, the name of the associated outer class; and (4) for an canonically ordered set of classes determine if the class versions are compatible. A set of classes is canonically ordered if the classes in the set have the same name, and the base class precedes the versioned classes and if each versioned class with version n precedes classes with versions > n for all versions n.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final FingerPrint.ClassAttributes
private final String
private static final byte[]
private final String
private final boolean
private static final MessageDigest
private final int
private final byte[]

Constructor Summary

AccessConstructor and Description
public
FingerPrint(String basename, String entryName, int mrversion, byte[] bytes)

Method Summary

Modifier and TypeMethod and Description
public String
public String
public String
private static FingerPrint.ClassAttributes
getClassAttributes(byte[] bytes)

private boolean
isCafeBabe(byte[] bytes)

public boolean
public boolean
private boolean
isEqual(byte[] sha1_1, byte[] sha1_2)

public boolean
public boolean
public boolean
public boolean
public int
public String
private byte[]
sha1(byte[] entry)

private byte[]
sha1(byte[] entry, int offset)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attrsback to summary
private final FingerPrint.ClassAttributes attrs
basenameback to summary
private final String basename
cafeBabeback to summary
private static final byte[] cafeBabe
entryNameback to summary
private final String entryName
isClassEntryback to summary
private final boolean isClassEntry
MDback to summary
private static final MessageDigest MD
mrversionback to summary
private final int mrversion
sha1back to summary
private final byte[] sha1

Constructor Detail

FingerPrintback to summary
public FingerPrint(String basename, String entryName, int mrversion, byte[] bytes) throws IOException

Method Detail

basenameback to summary
public String basename()
classNameback to summary
public String className()
entryNameback to summary
public String entryName()
getClassAttributesback to summary
private static FingerPrint.ClassAttributes getClassAttributes(byte[] bytes)
isCafeBabeback to summary
private boolean isCafeBabe(byte[] bytes)
isClassback to summary
public boolean isClass()
isCompatibleVersionback to summary
public boolean isCompatibleVersion(FingerPrint that)
isEqualback to summary
private boolean isEqual(byte[] sha1_1, byte[] sha1_2)
isIdenticalback to summary
public boolean isIdentical(FingerPrint that)
isNestedClassback to summary
public boolean isNestedClass()
isPublicClassback to summary
public boolean isPublicClass()
isSameAPIback to summary
public boolean isSameAPI(FingerPrint that)
mrversionback to summary
public int mrversion()
outerClassNameback to summary
public String outerClassName()
sha1back to summary
private byte[] sha1(byte[] entry)
sha1back to summary
private byte[] sha1(byte[] entry, int offset)
sun.tools.jar back to summary

private final Class FingerPrint.ClassAttributes

extends Object
implements Consumer<ClassElement>
Class Inheritance
All Implemented Interfaces
java.util.function.Consumer

Field Summary

Modifier and TypeField and Description
private final int
private final Set<FingerPrint.Field>
private final int
private final boolean
private final Set<FingerPrint.Method>
private final String
private String
private final boolean
private final String

Constructor Summary

AccessConstructor and Description
public
ClassAttributes(AccessFlags access, String name, String superName, int majorVersion)

Method Summary

Modifier and TypeMethod and Description
public void
accept(ClassElement
the input argument
cle
)

Implements java.util.function.Consumer.accept.

Performs this operation on the given argument.

public boolean
equals(Object
the reference object with which to compare.
that
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private static boolean
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

accessback to summary
private final int access
fieldsback to summary
private final Set<FingerPrint.Field> fields
majorVersionback to summary
private final int majorVersion
maybeNestedClassback to summary
private final boolean maybeNestedClass
methodsback to summary
private final Set<FingerPrint.Method> methods
nameback to summary
private final String name
outerClassNameback to summary
private String outerClassName
publicClassback to summary
private final boolean publicClass
superNameback to summary
private final String superName

Constructor Detail

ClassAttributesback to summary
public ClassAttributes(AccessFlags access, String name, String superName, int majorVersion)

Method Detail

acceptback to summary
public void accept(ClassElement cle)

Implements java.util.function.Consumer.accept.

Doc from java.util.function.Consumer.accept.

Performs this operation on the given argument.

Parameters
cle:ClassElement

the input argument

Annotations
@Override
equalsback to summary
public boolean equals(Object that)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
that:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isPublicback to summary
private static boolean isPublic(AccessFlags access)
sun.tools.jar back to summary

private final Class FingerPrint.Field

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
Field(int access, String name, String desc)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
that
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

accessback to summary
private final int access
descback to summary
private final String desc
nameback to summary
private final String name

Constructor Detail

Fieldback to summary
pack-priv Field(int access, String name, String desc)

Method Detail

equalsback to summary
public boolean equals(Object that)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
that:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
sun.tools.jar back to summary

private final Class FingerPrint.Method

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final int
private final String
private final Set<String>
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
Method(int access, String name, String desc, Set<String> exceptions)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
that
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

accessback to summary
private final int access
descback to summary
private final String desc
exceptionsback to summary
private final Set<String> exceptions
nameback to summary
private final String name

Constructor Detail

Methodback to summary
pack-priv Method(int access, String name, String desc, Set<String> exceptions)

Method Detail

equalsback to summary
public boolean equals(Object that)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
that:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override