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 Project: crnk-framework   Author: crnk-project   File: ExceptionMapperRegistryBuilder.java    License: 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 Project: Bytecoder   Author: mirkosertic   File: ParameterizedTypeImpl.java    License: 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 Project: dragonwell8_jdk   Author: alibaba   File: ParameterizedTypeImpl.java    License: 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 Project: TencentKona-8   Author: Tencent   File: ParameterizedTypeImpl.java    License: 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 #5
Source Project: TencentKona-8   Author: Tencent   File: ParameterizedTypeImpl.java    License: 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 #6
Source Project: jdk8u60   Author: chenghanpeng   File: ParameterizedTypeImpl.java    License: 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 Project: jdk8u60   Author: chenghanpeng   File: ParameterizedTypeImpl.java    License: 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 Project: gadtry   Author: harbby   File: JavaParameterizedTypeImpl.java    License: 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 #9
Source Project: java-n-IDE-for-Android   Author: shenghuntianlang   File: ParameterizedTypeImpl.java    License: 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 #10
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ParameterizedTypeImpl.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: ParameterizedTypeImpl.java    License: 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 #12
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: ParameterizedTypeImpl.java    License: 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 Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: ParameterizedTypeImpl.java    License: 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 Project: javaide   Author: tranleduy2000   File: ParameterizedTypeImpl.java    License: 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 #15
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: ParameterizedTypeImpl.java    License: 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 Project: openjdk-jdk9   Author: AdoptOpenJDK   File: ParameterizedTypeImpl.java    License: 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 Project: jdk8u-jdk   Author: lambdalab-mirror   File: ParameterizedTypeImpl.java    License: 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 Project: hottub   Author: dsrg-uoft   File: ParameterizedTypeImpl.java    License: 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 Project: hottub   Author: dsrg-uoft   File: ParameterizedTypeImpl.java    License: 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 #20
Source Project: openjdk-8-source   Author: keerath   File: ParameterizedTypeImpl.java    License: 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 Project: openjdk-8-source   Author: keerath   File: ParameterizedTypeImpl.java    License: 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 Project: blueocean-plugin   Author: jenkinsci   File: TypeUtil.java    License: 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 #23
Source Project: openjdk-8   Author: bpupadhyaya   File: ParameterizedTypeImpl.java    License: 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 Project: openjdk-8   Author: bpupadhyaya   File: ParameterizedTypeImpl.java    License: 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 #25
Source Project: jdk8u_jdk   Author: JetBrains   File: ParameterizedTypeImpl.java    License: 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 #26
Source Project: jdk8u-jdk   Author: frohoff   File: ParameterizedTypeImpl.java    License: 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 Project: jdk8u-dev-jdk   Author: frohoff   File: ParameterizedTypeImpl.java    License: 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 Project: AutoLoadCache   Author: qiujiayu   File: ParameterizedTypeImpl.java    License: 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 #29
Source Project: j2objc   Author: google   File: MalformedParameterizedTypeExceptionTests.java    License: 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 #30
Source Project: j2objc   Author: google   File: MalformedParameterizedTypeExceptionTest.java    License: 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());
}