java.lang.reflect.MalformedParameterizedTypeException Java Examples

The following examples show how to use java.lang.reflect.MalformedParameterizedTypeException. 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: ExceptionMapperRegistryBuilder.java    From crnk-framework with Apache License 2.0 6 votes vote down vote up
private Class<? extends Throwable> getGenericType(Class<? extends ExceptionMapper> mapper) {
    try {
        Type[] types = mapper.getGenericInterfaces();
        if (null == types || 0 == types.length) {
            types = new Type[]{mapper.getGenericSuperclass()};
        }

        for (Type type : types) {
            Class<?> rawType = ClassUtils.getRawType(type);
            if (type instanceof ParameterizedType && ExceptionMapper.class.isAssignableFrom(rawType)) {
                //noinspection unchecked
                return (Class<? extends Throwable>) ((ParameterizedType) type).getActualTypeArguments()[0];
            }
        }

        if (isProxy(mapper)) {
            return getGenericType((Class<? extends ExceptionMapper>) mapper.getSuperclass());
        }

        //Won't get in here
        throw new IllegalStateException("unable to discover exception class for " + mapper.getName());
    } catch (MalformedParameterizedTypeException e) {
        throw new IllegalStateException(mapper.getName(), e);
    }
}
 
Example #2
Source File: ParameterizedTypeImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException(String.format("Mismatch of count of " +
                                                                    "formal and actual type " +
                                                                    "arguments in constructor " +
                                                                    "of %s: %d formal argument(s) "+
                                                                    "%d actual argument(s)",
                                                                    rawType.getName(),
                                                                    formals.length,
                                                                    actualTypeArguments.length));
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #3
Source File: ParameterizedTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #4
Source File: MalformedParameterizedTypeExceptionTests.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * java.lang.reflect.MalformedParameterizedTypeException#MalformedParameterizedTypeException()
 */
public void test_Constructor() throws Exception {
    Constructor<MalformedParameterizedTypeException> ctor = MalformedParameterizedTypeException.class
            .getDeclaredConstructor();
    assertNotNull("Parameterless constructor does not exist.", ctor);
    assertTrue("Constructor is not protected", Modifier.isPublic(ctor
            .getModifiers()));
    assertNotNull(ctor.newInstance());
}
 
Example #5
Source File: ParameterizedTypeImpl.java    From AutoLoadCache with Apache License 2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    @SuppressWarnings("rawtypes")
    TypeVariable[] arrayOfTypeVariable = this.rawType.getTypeParameters();

    if (arrayOfTypeVariable.length != this.actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
    // for(int i=0; i < this.actualTypeArguments.length; i++);
}
 
Example #6
Source File: ParameterizedTypeImpl.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #7
Source File: ParameterizedTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #8
Source File: ParameterizedTypeImpl.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #9
Source File: ParameterizedTypeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #10
Source File: ParameterizedTypeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #11
Source File: TypeUtil.java    From blueocean-plugin with MIT License 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }

}
 
Example #12
Source File: ParameterizedTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #13
Source File: ParameterizedTypeImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #14
Source File: ParameterizedTypeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #15
Source File: ParameterizedTypeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #16
Source File: ParameterizedTypeImpl.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #17
Source File: ParameterizedTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #18
Source File: ParameterizedTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #19
Source File: ParameterizedTypeImpl.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }

}
 
Example #20
Source File: ParameterizedTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #21
Source File: ParameterizedTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #22
Source File: ParameterizedTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #23
Source File: ParameterizedTypeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #24
Source File: ParameterizedTypeImpl.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }

}
 
Example #25
Source File: JavaParameterizedTypeImpl.java    From gadtry with Apache License 2.0 5 votes vote down vote up
private void validateConstructorArguments()
{
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #26
Source File: ParameterizedTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #27
Source File: ParameterizedTypeImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #28
Source File: ParameterizedTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
        TypeVariable/*<?>*/[] formals = rawType.getTypeParameters();
        // check correct arity of actual type args
        if (formals.length != actualTypeArguments.length) {
            throw new MalformedParameterizedTypeException();
        }
/*
        for (int i = 0; i < actualTypeArguments.length; i++) {
            // check actuals against formals' bounds
        }
*/
    }
 
Example #29
Source File: ParameterizedTypeImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private void validateConstructorArguments() {
    TypeVariable<?>[] formals = rawType.getTypeParameters();
    // check correct arity of actual type args
    if (formals.length != actualTypeArguments.length){
        throw new MalformedParameterizedTypeException();
    }
    for (int i = 0; i < actualTypeArguments.length; i++) {
        // check actuals against formals' bounds
    }
}
 
Example #30
Source File: MalformedParameterizedTypeExceptionTest.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * java.lang.reflect.MalformedParameterizedTypeException#
 * MalformedParameterizedTypeException()
 */
public void testMalformedParameterizedTypeException() {
    MalformedParameterizedTypeException e = new MalformedParameterizedTypeException();
    assertNotNull(e);
    assertNull(e.getMessage());
}