Top Description Inners Fields Constructors Methods
com.sun.tools.javac.model

public Class AnnotationProxyMaker

extends Object
Class Inheritance
Imports
java.io.IOException, .ObjectInputStream, java.lang.annotation.*, java.lang.reflect.Array, .Method, java.util.LinkedHashMap, .Map, java.util.stream.Collectors, sun.reflect.annotation.*, javax.lang.model.type.MirroredTypeException, .MirroredTypesException, .TypeMirror, com.sun.tools.javac.code.*, com.sun.tools.javac.code.Symbol.*, .Type.ArrayType, com.sun.tools.javac.util.*

A generator of dynamic proxy implementations of java.lang.annotation.Annotation.

The "dynamic proxy return form" of an annotation element value is the form used by sun.reflect.annotation.AnnotationInvocationHandler.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
AnnotationProxyMaker.MirroredTypeExceptionProxy

ExceptionProxy for MirroredTypeException.

private static class
AnnotationProxyMaker.MirroredTypesExceptionProxy

ExceptionProxy for MirroredTypesException.

private class

Field Summary

Modifier and TypeField and Description
private final Attribute.Compound
private final Class<? extends Annotation>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <A extends Annotation> A
generateAnnotation(Attribute.Compound anno, Class<A> annoType)

Returns a dynamic proxy for an annotation mirror.

private Annotation
generateAnnotation()

Returns a dynamic proxy for an annotation mirror.

private Object
generateValue(Symbol.MethodSymbol meth, Attribute attr)

Converts an element value to its "dynamic proxy return form".

private Map<String, Object>
getAllReflectedValues()

Returns a map from element names to their values in "dynamic proxy return form".

private Map<Symbol.MethodSymbol, Attribute>
getAllValues()

Returns a map from element symbols to their values.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

annoback to summary
private final Attribute.Compound anno
annoTypeback to summary
private final Class<? extends Annotation> annoType

Constructor Detail

AnnotationProxyMakerback to summary
private AnnotationProxyMaker(Attribute.Compound anno, Class<? extends Annotation> annoType)

Method Detail

generateAnnotationback to summary
public static <A extends Annotation> A generateAnnotation(Attribute.Compound anno, Class<A> annoType)

Returns a dynamic proxy for an annotation mirror.

generateAnnotationback to summary
private Annotation generateAnnotation()

Returns a dynamic proxy for an annotation mirror.

generateValueback to summary
private Object generateValue(Symbol.MethodSymbol meth, Attribute attr)

Converts an element value to its "dynamic proxy return form". Returns an exception proxy on some errors, but may return null if a useful exception cannot or should not be generated at this point.

getAllReflectedValuesback to summary
private Map<String, Object> getAllReflectedValues()

Returns a map from element names to their values in "dynamic proxy return form". Includes all elements, whether explicit or defaulted.

getAllValuesback to summary
private Map<Symbol.MethodSymbol, Attribute> getAllValues()

Returns a map from element symbols to their values. Includes all elements, whether explicit or defaulted.

com.sun.tools.javac.model back to summary

private final Class AnnotationProxyMaker.MirroredTypeExceptionProxy

extends ExceptionProxy
Class Inheritance

ExceptionProxy for MirroredTypeException. The toString, hashCode, and equals methods forward to the underlying type.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
private transient TypeMirror
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

Overrides java.lang.Object.equals.

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

protected RuntimeException
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides sun.reflect.annotation.ExceptionProxy.serialVersionUID.

typeback to summary
private transient TypeMirror type
typeStringback to summary
private final String typeString

Constructor Detail

MirroredTypeExceptionProxyback to summary
pack-priv MirroredTypeExceptionProxy(TypeMirror t)

Method Detail

equalsback to summary
public boolean equals(Object obj)

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
obj:Object

the reference object with which to compare.

Returns:boolean

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

generateExceptionback to summary
protected RuntimeException generateException()

Implements abstract sun.reflect.annotation.ExceptionProxy.generateException.

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

readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

com.sun.tools.javac.model back to summary

private final Class AnnotationProxyMaker.MirroredTypesExceptionProxy

extends ExceptionProxy
Class Inheritance

ExceptionProxy for MirroredTypesException. The toString, hashCode, and equals methods forward to the underlying types.

Field Summary

Modifier and TypeField and Description
pack-priv static final long
private transient List<TypeMirror>
private final String

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

Overrides java.lang.Object.equals.

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

protected RuntimeException
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides sun.reflect.annotation.ExceptionProxy.serialVersionUID.

typesback to summary
private transient List<TypeMirror> types
typeStringsback to summary
private final String typeStrings

Constructor Detail

MirroredTypesExceptionProxyback to summary
pack-priv MirroredTypesExceptionProxy(List<TypeMirror> ts)

Method Detail

equalsback to summary
public boolean equals(Object obj)

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
obj:Object

the reference object with which to compare.

Returns:boolean

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

generateExceptionback to summary
protected RuntimeException generateException()

Implements abstract sun.reflect.annotation.ExceptionProxy.generateException.

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

readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

com.sun.tools.javac.model back to summary

private Class AnnotationProxyMaker.ValueVisitor

extends Object
implements Visitor
Class Inheritance
All Implemented Interfaces
com.sun.tools.javac.code.Attribute.Visitor

Field Summary

Modifier and TypeField and Description
private Symbol.MethodSymbol
private Class<?>
private Object

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Object
private void
typeMismatch(Method method, final Attribute attr)

Sets "value" to an ExceptionProxy indicating a type mismatch.

public void
public void
public void
public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

methback to summary
private Symbol.MethodSymbol meth
returnClassback to summary
private Class<?> returnClass
valueback to summary
private Object value

Constructor Detail

ValueVisitorback to summary
pack-priv ValueVisitor(Symbol.MethodSymbol meth)

Method Detail

getValueback to summary
pack-priv Object getValue(Attribute attr)
typeMismatchback to summary
private void typeMismatch(Method method, final Attribute attr)

Sets "value" to an ExceptionProxy indicating a type mismatch.

visitArrayback to summary
public void visitArray(Attribute.Array a)

Implements com.sun.tools.javac.code.Attribute.Visitor.visitArray.

visitClassback to summary
public void visitClass(Attribute.Class c)

Implements com.sun.tools.javac.code.Attribute.Visitor.visitClass.

visitCompoundback to summary
public void visitCompound(Attribute.Compound c)

Implements com.sun.tools.javac.code.Attribute.Visitor.visitCompound.

visitConstantback to summary
public void visitConstant(Attribute.Constant c)

Implements com.sun.tools.javac.code.Attribute.Visitor.visitConstant.

visitEnumback to summary
public void visitEnum(Attribute.Enum e)

Implements com.sun.tools.javac.code.Attribute.Visitor.visitEnum.

Annotations
@SuppressWarnings:unchecked, rawtypes
visitErrorback to summary
public void visitError(Attribute.Error e)

Implements com.sun.tools.javac.code.Attribute.Visitor.visitError.