Java 类java.lang.annotation.AnnotationFormatError 实例源码

项目:guja    文件:AbstractCacheMethodInterceptor.java   
protected CacheKeyGenerator getCacheKeyGenerator(MethodInvocation methodInvocation,
                                                 Class<? extends CacheKeyGenerator> methodCacheKeyGeneratorClass) {

  try {

    if (!methodCacheKeyGeneratorClass.equals(CacheKeyGenerator.class)) {
      // The annotation will return the CacheKeyGenerator class by default
      return methodCacheKeyGeneratorClass.newInstance();
    }

    Class clazz = GuiceCacheKeyInvocationContext.getThisClass(methodInvocation);
    if (clazz.isAnnotationPresent(CacheDefaults.class)) {
      Class<? extends CacheKeyGenerator> cacheKeyGeneratorClass = ((CacheDefaults)clazz.getAnnotation(CacheDefaults.class)).cacheKeyGenerator();
      if (!cacheKeyGeneratorClass.equals(CacheKeyGenerator.class)) {
        // The annotation will return the CacheKeyGenerator class by default
        return cacheKeyGeneratorClass.newInstance();
      }
    }

    return defaultCacheKeyGeneratorProvider.get();

  } catch (Exception e) {
    throw new AnnotationFormatError("Invalid cache key generator class " + methodCacheKeyGeneratorClass.getName());
  }

}
项目:OpenJSharp    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:OpenJSharp    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:OpenJSharp    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:jdk8u-jdk    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:jdk8u-jdk    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:openjdk-jdk10    文件:Constructor.java   
@Override
boolean handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return false; // Can't do reliable parameter counting
    else {
        if (declaringClass.isMemberClass() &&
            ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
            resultLength + 1 == numParameters) {
            return true;
        } else {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:openjdk-jdk10    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof ExceptionProxy) {
        if (result instanceof TypeNotPresentExceptionProxy) {
            TypeNotPresentExceptionProxy proxy = (TypeNotPresentExceptionProxy)result;
            throw new TypeNotPresentException(proxy.typeName(), proxy.getCause());
        }
        throw new AnnotationFormatError("Invalid default: " + this);
    }
    return result;
}
项目:openjdk-jdk10    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:openjdk9    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:openjdk9    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:Java8CN    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:jdk8u_jdk    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:jdk8u_jdk    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:lookaside_java-1.8.0-openjdk    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:infobip-open-jdk-8    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:infobip-open-jdk-8    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:jdk8u-dev-jdk    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:jdk8u-dev-jdk    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:OLD-OpenJDK8    文件:Constructor.java   
@Override
void handleParameterNumberMismatch(int resultLength, int numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() ||
        declaringClass.isAnonymousClass() ||
        declaringClass.isLocalClass() )
        return ; // Can't do reliable parameter counting
    else {
        if (!declaringClass.isMemberClass() || // top-level
            // Check for the enclosing instance parameter for
            // non-static member classes
            (declaringClass.isMemberClass() &&
             ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
             resultLength + 1 != numParameters) ) {
            throw new AnnotationFormatError(
                      "Parameter annotations don't match number of parameters");
        }
    }
}
项目:OLD-OpenJDK8    文件:TypeAnnotation.java   
public static LocationInfo parseLocationInfo(ByteBuffer buf) {
    int depth = buf.get() & 0xFF;
    if (depth == 0)
        return BASE_LOCATION;
    Location[] locations = new Location[depth];
    for (int i = 0; i < depth; i++) {
        byte tag = buf.get();
        short index = (short)(buf.get() & 0xFF);
        if (!(tag == 0 || tag == 1 | tag == 2 || tag == 3))
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        if (tag != 3 && index != 0)
            throw new AnnotationFormatError("Bad Location encoding in Type Annotation");
        locations[i] = new Location(tag, index);
    }
    return new LocationInfo(depth, locations);
}
项目:litiengine    文件:Screen.java   
protected Screen() {
  super(0, 0);
  final ScreenInfo info = this.getClass().getAnnotation(ScreenInfo.class);
  if (info == null) {
    throw new AnnotationFormatError("No ScreenInfo annotation found on screen " + this.getClass());
  }

  this.name = info.name();
}
项目:denbun    文件:TimeRule.java   
private long parse(String iso8601z) {
  try {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:dd'Z'");
    format.setTimeZone(TimeZone.getTimeZone("UTC"));
    return format.parse(iso8601z).getTime();
  } catch (ParseException e) {
    throw new AnnotationFormatError(e);
  }
}
项目:OpenJSharp    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:jdk8u-jdk    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:openjdk-jdk10    文件:AnnotationVerifier.java   
@Test(expectedExceptions = AnnotationFormatError.class)
public void holderE_annotationWithException_equals() {
    AnnotationWithException ann1, ann2;
    try {
        ann1 = HolderE.class.getAnnotation(AnnotationWithException.class);
        ann2 = HolderE2.class.getAnnotation(AnnotationWithException.class);
    } catch (Throwable t) {
        throw new AssertionError("Unexpected exception", t);
    }
    Assert.assertNotNull(ann1);
    Assert.assertNotNull(ann2);

    testEquals(ann1, ann2, true); // this throws AnnotationFormatError
}
项目:openjdk-jdk10    文件:AnnotationVerifier.java   
@Test(expectedExceptions = AnnotationFormatError.class)
public void holderF_annotationWithHashCode_equals() {
    AnnotationWithHashCode ann1, ann2;
    try {
        ann1 = HolderF.class.getAnnotation(AnnotationWithHashCode.class);
        ann2 = HolderF2.class.getAnnotation(AnnotationWithHashCode.class);
    } catch (Throwable t) {
        throw new AssertionError("Unexpected exception", t);
    }
    Assert.assertNotNull(ann1);
    Assert.assertNotNull(ann2);

    testEquals(ann1, ann2, true); // this throws AnnotationFormatError
}
项目:openjdk-jdk10    文件:AnnotationVerifier.java   
@Test(expectedExceptions = AnnotationFormatError.class)
public void holderG_annotationWithDefaultMember_equals() {
    AnnotationWithDefaultMember ann1, ann2;
    try {
        ann1 = HolderG.class.getAnnotation(AnnotationWithDefaultMember.class);
        ann2 = HolderG2.class.getAnnotation(AnnotationWithDefaultMember.class);
    } catch (Throwable t) {
        throw new AssertionError("Unexpected exception", t);
    }
    Assert.assertNotNull(ann1);
    Assert.assertNotNull(ann2);

    testEquals(ann1, ann2, true); // this throws AnnotationFormatError
}
项目:openjdk9    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:Java8CN    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:NonDex    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:jdk8u_jdk    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:lookaside_java-1.8.0-openjdk    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:VarJ    文件:Constructor.java   
/**
    * Returns an array of arrays that represent the annotations on the formal
    * parameters, in declaration order, of the method represented by
    * this <tt>Constructor</tt> object. (Returns an array of length zero if the
    * underlying method is parameterless.  If the method has one or more
    * parameters, a nested array of length zero is returned for each parameter
    * with no annotations.) The annotation objects contained in the returned
    * arrays are serializable.  The caller of this method is free to modify
    * the returned arrays; it will have no effect on the arrays returned to
    * other callers.
    *
    * @return an array of arrays that represent the annotations on the formal
    *    parameters, in declaration order, of the method represented by this
    *    Constructor object
    * @since 1.5
    */
   public Annotation[][] getParameterAnnotations() {
       int numParameters = parameterTypes.length;
       if (parameterAnnotations == null)
           return new Annotation[numParameters][0];

       Annotation[][] result = AnnotationParser.parseParameterAnnotations(
           parameterAnnotations,
           sun.misc.SharedSecrets.getJavaLangAccess().
               getConstantPool(getDeclaringClass()),
           getDeclaringClass());
       if (result.length != numParameters) {
    Class<?> declaringClass = getDeclaringClass();
    if (declaringClass.isEnum() || 
    declaringClass.isAnonymousClass() || 
    declaringClass.isLocalClass() )
    ; // Can't do reliable parameter counting
    else { 
    if (!declaringClass.isMemberClass() || // top-level 
        // Check for the enclosing instance parameter for
        // non-static member classes
        (declaringClass.isMemberClass() && 
         ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  && 
         result.length + 1 != numParameters) ) {
        throw new AnnotationFormatError(
              "Parameter annotations don't match number of parameters");
    }
    }
}
       return result;
   }
项目:VarJ    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this <tt>Method</tt> instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this <tt>Method</tt> instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:jdk-1.7-annotated    文件:Constructor.java   
/**
 * Returns an array of arrays that represent the annotations on the formal
 * parameters, in declaration order, of the method represented by
 * this {@code Constructor} object. (Returns an array of length zero if the
 * underlying method is parameterless.  If the method has one or more
 * parameters, a nested array of length zero is returned for each parameter
 * with no annotations.) The annotation objects contained in the returned
 * arrays are serializable.  The caller of this method is free to modify
 * the returned arrays; it will have no effect on the arrays returned to
 * other callers.
 *
 * @return an array of arrays that represent the annotations on the formal
 *    parameters, in declaration order, of the method represented by this
 *    Constructor object
 * @since 1.5
 */
public Annotation[][] getParameterAnnotations() {
    int numParameters = parameterTypes.length;
    if (parameterAnnotations == null)
        return new Annotation[numParameters][0];

    Annotation[][] result = AnnotationParser.parseParameterAnnotations(
        parameterAnnotations,
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result.length != numParameters) {
        Class<?> declaringClass = getDeclaringClass();
        if (declaringClass.isEnum() ||
            declaringClass.isAnonymousClass() ||
            declaringClass.isLocalClass() )
            ; // Can't do reliable parameter counting
        else {
            if (!declaringClass.isMemberClass() || // top-level
                // Check for the enclosing instance parameter for
                // non-static member classes
                (declaringClass.isMemberClass() &&
                 ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
                 result.length + 1 != numParameters) ) {
                throw new AnnotationFormatError(
                          "Parameter annotations don't match number of parameters");
            }
        }
    }
    return result;
}
项目:jdk-1.7-annotated    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:infobip-open-jdk-8    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}
项目:jdk8u-dev-jdk    文件:Method.java   
/**
 * Returns the default value for the annotation member represented by
 * this {@code Method} instance.  If the member is of a primitive type,
 * an instance of the corresponding wrapper type is returned. Returns
 * null if no default is associated with the member, or if the method
 * instance does not represent a declared member of an annotation type.
 *
 * @return the default value for the annotation member represented
 *     by this {@code Method} instance.
 * @throws TypeNotPresentException if the annotation is of type
 *     {@link Class} and no definition can be found for the
 *     default class value.
 * @since  1.5
 */
public Object getDefaultValue() {
    if  (annotationDefault == null)
        return null;
    Class<?> memberType = AnnotationType.invocationHandlerReturnType(
        getReturnType());
    Object result = AnnotationParser.parseMemberValue(
        memberType, ByteBuffer.wrap(annotationDefault),
        sun.misc.SharedSecrets.getJavaLangAccess().
            getConstantPool(getDeclaringClass()),
        getDeclaringClass());
    if (result instanceof sun.reflect.annotation.ExceptionProxy)
        throw new AnnotationFormatError("Invalid default: " + this);
    return result;
}