java.lang.annotation.AnnotationFormatError Java Examples

The following examples show how to use java.lang.annotation.AnnotationFormatError. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TypeAnnotation.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: TypeAnnotation.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: Constructor.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #4
Source File: TypeAnnotation.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: Constructor.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #6
Source File: TypeAnnotation.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #7
Source File: Constructor.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #8
Source File: Constructor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #9
Source File: Constructor.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #10
Source File: TypeAnnotation.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #11
Source File: TypeAnnotation.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #12
Source File: Constructor.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #13
Source File: Constructor.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #14
Source File: Constructor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #15
Source File: TypeAnnotation.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #16
Source File: TypeAnnotation.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #17
Source File: Constructor.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #18
Source File: Method.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #19
Source File: Constructor.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #20
Source File: TypeAnnotation.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #21
Source File: Constructor.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #22
Source File: Method.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #23
Source File: TypeAnnotation.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #24
Source File: TypeAnnotation.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #25
Source File: Constructor.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #26
Source File: TypeAnnotation.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #27
Source File: Constructor.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #28
Source File: Constructor.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
@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");
        }
    }
}
 
Example #29
Source File: TypeAnnotation.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #30
Source File: Constructor.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@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");
        }
    }
}