Java 类java.lang.reflect.MalformedParameterizedTypeException 实例源码

项目:planb-android    文件:DemoAppUtil.java   
public static void throwRandomRuntimeException() {
    String random = "planb:" + UUID.randomUUID().toString();
    RuntimeException[] exceptions = new RuntimeException[]{
            new IllegalStateException("This is a test exception because the sate " + random),
            new IllegalArgumentException("Wrong argument test exception" + random),
            new RuntimeException("This is a test exception " + random),
            new IllegalSelectorException(),
            new IndexOutOfBoundsException("A test index exception " + random),
            new ClassCastException("A test class cast exception " + random),
            new NoSuchElementException("A test no such element exception " + random),
            new MalformedParameterizedTypeException(),
            new BufferOverflowException(),
            new EmptyStackException(),
            new NullPointerException("This is not a real nullpointer " + random),
            new SecurityException("This is not a real security exception " + random),
            new ArithmeticException("This is not a real arithmetic exception " + random),
            new IllegalThreadStateException("This is a test exception with threads " + random),
            new IllegalCharsetNameException("Charset is wrong test exception " + random),
            new IllegalMonitorStateException("This is a test exception with illegal monitor " + random)};

    throw exceptions[new Random().nextInt(exceptions.length)];
}
项目:javify    文件:GenericSignatureParser.java   
Type resolve()
{
    GenericDeclaration d = decl;
    while (d != null)
    {
        for (TypeVariable t : d.getTypeParameters())
        {
            if (t.getName().equals(name))
            {
                return t;
            }
        }
        d = getParent(d);
    }
    throw new MalformedParameterizedTypeException();
}
项目:jvm-stm    文件:GenericSignatureParser.java   
Type resolve()
{
    GenericDeclaration d = decl;
    while (d != null)
    {
        for (TypeVariable t : d.getTypeParameters())
        {
            if (t.getName().equals(name))
            {
                return t;
            }
        }
        d = getParent(d);
    }
    throw new MalformedParameterizedTypeException();
}
项目:cn1    文件:Class.java   
public Type getGenericSuperclass() throws GenericSignatureFormatError, TypeNotPresentException, MalformedParameterizedTypeException  {
    String tmp;
    if (isInterface() || ((tmp = getCanonicalName()) != null && tmp.equals("java.lang.Object")) || isPrimitive()) {
        return null;
    }
    if (isArray()) {
        return (Type) OBJECT_CLASS;
    }

    Class<?> clazz = getSuperclass();
    if (clazz.getTypeParameters().length == 0) {
        return (Type) clazz;
    }

    return getCache().getGenericSuperclass();
}
项目:cn1    文件:WildcardTypeImpl.java   
public Type[] getLowerBounds() throws TypeNotPresentException, MalformedParameterizedTypeException {
    if (lowerBounds == null) {
        if (wildCardTypeBillet.boundsType == false) {
            int l = wildCardTypeBillet.bounds.length;
            lowerBounds = new Type[l];
            for (int i = 0; i < l; i++) {
                // it can be InterimTypeVariable or InterimParameterizedType or InterimClassType.
                // The MalformedParameterizedTypeException and TypeNotPresentException should be raised here if it needs.
                try {
                    lowerBounds[i] = AuxiliaryCreator.createTypeArg(wildCardTypeBillet.bounds[i], this.startPoint);
                } catch(ClassNotFoundException e) {
                    throw new TypeNotPresentException(((InterimClassType)wildCardTypeBillet.bounds[i]).classTypeName.substring(1).replace('/', '.'), e); // ClassNotFoundException may appear here only for InterimClassType, see AuxiliaryCreator.createTypeArg.
                }
            }
        } else {
            lowerBounds = new Type[0];
        }
    }
    return (Type[])this.lowerBounds.clone();
}
项目:cn1    文件:WildcardTypeImpl.java   
public Type[] getUpperBounds() throws TypeNotPresentException, MalformedParameterizedTypeException {
    if (upperBounds == null) {
        if (wildCardTypeBillet.boundsType) {
            int l = wildCardTypeBillet.bounds.length;
            upperBounds = new Type[l];
            for (int i = 0; i < l; i++) {
                // it can be InterimTypeVariable or InterimParameterizedType or InterimClassType.
                // The MalformedParameterizedTypeException and TypeNotPresentException should be raised here if it needs.
                try {
                    upperBounds[i] = AuxiliaryCreator.createTypeArg(wildCardTypeBillet.bounds[i], this.startPoint);
                } catch(ClassNotFoundException e) {
                    throw new TypeNotPresentException(((InterimClassType)wildCardTypeBillet.bounds[i]).classTypeName.substring(1).replace('/', '.'), e); // ClassNotFoundException may appear here only for InterimClassType, see AuxiliaryCreator.createTypeArg.
                }
            }
        } else {
            upperBounds = new Type[1];
            upperBounds[0] = (Type) Object.class;
        }
    }
    return (Type[])this.upperBounds.clone();
}
项目:JamVM-PH    文件:GenericSignatureParser.java   
Type resolve()
{
    GenericDeclaration d = decl;
    while (d != null)
    {
        for (TypeVariable t : d.getTypeParameters())
        {
            if (t.getName().equals(name))
            {
                return t;
            }
        }
        d = getParent(d);
    }
    throw new MalformedParameterizedTypeException();
}
项目:classpath    文件:GenericSignatureParser.java   
Type resolve()
{
    GenericDeclaration d = decl;
    while (d != null)
    {
        for (TypeVariable t : d.getTypeParameters())
        {
            if (t.getName().equals(name))
            {
                return t;
            }
        }
        d = getParent(d);
    }
    throw new MalformedParameterizedTypeException();
}
项目:freeVM    文件:Class.java   
public Type getGenericSuperclass() throws GenericSignatureFormatError, TypeNotPresentException, MalformedParameterizedTypeException  {
    String tmp;
    if (isInterface() || ((tmp = getCanonicalName()) != null && tmp.equals("java.lang.Object")) || isPrimitive()) {
        return null;
    }
    if (isArray()) {
        return (Type) OBJECT_CLASS;
    }

    Class<?> clazz = getSuperclass();
    if (clazz.getTypeParameters().length == 0) {
        return (Type) clazz;
    }

    return getCache().getGenericSuperclass();
}
项目:freeVM    文件:WildcardTypeImpl.java   
public Type[] getLowerBounds() throws TypeNotPresentException, MalformedParameterizedTypeException {
    if (lowerBounds == null) {
        if (wildCardTypeBillet.boundsType == false) {
            int l = wildCardTypeBillet.bounds.length;
            lowerBounds = new Type[l];
            for (int i = 0; i < l; i++) {
                // it can be InterimTypeVariable or InterimParameterizedType or InterimClassType.
                // The MalformedParameterizedTypeException and TypeNotPresentException should be raised here if it needs.
                try {
                    lowerBounds[i] = AuxiliaryCreator.createTypeArg(wildCardTypeBillet.bounds[i], this.startPoint);
                } catch(ClassNotFoundException e) {
                    throw new TypeNotPresentException(((InterimClassType)wildCardTypeBillet.bounds[i]).classTypeName.substring(1).replace('/', '.'), e); // ClassNotFoundException may appear here only for InterimClassType, see AuxiliaryCreator.createTypeArg.
                }
            }
        } else {
            lowerBounds = new Type[0];
        }
    }
    return (Type[])this.lowerBounds.clone();
}
项目:freeVM    文件:WildcardTypeImpl.java   
public Type[] getUpperBounds() throws TypeNotPresentException, MalformedParameterizedTypeException {
    if (upperBounds == null) {
        if (wildCardTypeBillet.boundsType) {
            int l = wildCardTypeBillet.bounds.length;
            upperBounds = new Type[l];
            for (int i = 0; i < l; i++) {
                // it can be InterimTypeVariable or InterimParameterizedType or InterimClassType.
                // The MalformedParameterizedTypeException and TypeNotPresentException should be raised here if it needs.
                try {
                    upperBounds[i] = AuxiliaryCreator.createTypeArg(wildCardTypeBillet.bounds[i], this.startPoint);
                } catch(ClassNotFoundException e) {
                    throw new TypeNotPresentException(((InterimClassType)wildCardTypeBillet.bounds[i]).classTypeName.substring(1).replace('/', '.'), e); // ClassNotFoundException may appear here only for InterimClassType, see AuxiliaryCreator.createTypeArg.
                }
            }
        } else {
            upperBounds = new Type[1];
            upperBounds[0] = (Type) Object.class;
        }
    }
    return (Type[])this.upperBounds.clone();
}
项目:Java-EX    文件:ParameterizedTypeImpl.java   
public ParameterizedTypeImpl(Class<?> rawType, Type ownerType, Type[] actualTypeArguments) {
  this.rawType = rawType;
  this.ownerType = ownerType == null ? rawType.getDeclaringClass() : ownerType;
  this.actualTypeArguments = actualTypeArguments;

  TypeVariable<?>[] formals = rawType.getTypeParameters();
  if (formals.length != actualTypeArguments.length) {
    throw new MalformedParameterizedTypeException();
  }
}
项目:javaide    文件:ParameterizedTypeImpl.java   
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
    }

}
项目:OpenJSharp    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:OpenJSharp    文件:ParameterizedTypeImpl.java   
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
        }
*/
    }
项目:jdk8u-jdk    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:openjdk-jdk10    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:openjdk-jdk10    文件:ParameterizedTypeImpl.java   
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
        }
*/
    }
项目:openjdk9    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:openjdk9    文件:ParameterizedTypeImpl.java   
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
        }
*/
    }
项目:venus    文件:ParameterizedTypeImpl.java   
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
    }

}
项目:Java-EX    文件:ParameterizedTypeImpl.java   
public ParameterizedTypeImpl(Class<?> rawType, Type ownerType, Type[] actualTypeArguments) {
  this.rawType = rawType;
  this.ownerType = ownerType == null ? rawType.getDeclaringClass() : ownerType;
  this.actualTypeArguments = actualTypeArguments;

  TypeVariable<?>[] formals = rawType.getTypeParameters();
  if (formals.length != actualTypeArguments.length) {
    throw new MalformedParameterizedTypeException();
  }
}
项目:jdk8u_jdk    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:ParameterizedTypeImpl.java   
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
        }
*/
    }
项目:LoliXL    文件:ParameterizedTypeUtils.java   
private ParameterizedTypeImpl(Class<?> rawType, Type[] actualTypeArguments) {
    this.actualTypeArguments = actualTypeArguments;
    this.rawType = rawType;
    ownerType = rawType.getDeclaringClass();

    TypeVariable<?>[] formals = rawType.getTypeParameters();
    if (formals.length != actualTypeArguments.length) {
        throw new MalformedParameterizedTypeException();
    }
}
项目:j2objc    文件:MalformedParameterizedTypeExceptionTests.java   
/**
 * 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());
}
项目:infobip-open-jdk-8    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:infobip-open-jdk-8    文件:ParameterizedTypeImpl.java   
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
        }
*/
    }
项目:jdk8u-dev-jdk    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:AutoLoadCache    文件:ParameterizedTypeImpl.java   
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++);
}
项目:cxf-plus    文件:ParameterizedTypeImpl.java   
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
    }

}
项目:In-the-Box-Fork    文件:MalformedParameterizedTypeExceptionTests.java   
/**
 * @tests java.lang.reflect.MalformedParameterizedTypeException#MalformedParameterizedTypeException()
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "Since this constructor is never invoked, this test only verifies its existence.",
    method = "MalformedParameterizedTypeException",
    args = {}
)
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());
}
项目:jdk7-jdk    文件:ParameterizedTypeImpl.java   
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
    }

}
项目:openjdk-source-code-learn    文件:ParameterizedTypeImpl.java   
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
    }

}
项目:class-guard    文件:GenericCollectionTypeResolver.java   
/**
 * Extract the generic type from the given Class object.
 * @param clazz the Class to check
 * @param source the expected raw source type (can be {@code null})
 * @param typeIndex the index of the actual type argument
 * @param nestingLevel the nesting level of the target type
 * @param currentLevel the current nested level
 * @return the generic type as Class, or {@code null} if none
 */
private static Class<?> extractTypeFromClass(Class<?> clazz, Class<?> source, int typeIndex,
        Map<TypeVariable, Type> typeVariableMap, Map<Integer, Integer> typeIndexesPerLevel,
        int nestingLevel, int currentLevel) {

    if (clazz.getName().startsWith("java.util.")) {
        return null;
    }
    if (clazz.getSuperclass() != null && isIntrospectionCandidate(clazz.getSuperclass())) {
        try {
            return extractType(clazz.getGenericSuperclass(), source, typeIndex, typeVariableMap,
                    typeIndexesPerLevel, nestingLevel, currentLevel);
        }
        catch (MalformedParameterizedTypeException ex) {
            // from getGenericSuperclass() - ignore and continue with interface introspection
        }
    }
    Type[] ifcs = clazz.getGenericInterfaces();
    if (ifcs != null) {
        for (Type ifc : ifcs) {
            Type rawType = ifc;
            if (ifc instanceof ParameterizedType) {
                rawType = ((ParameterizedType) ifc).getRawType();
            }
            if (rawType instanceof Class && isIntrospectionCandidate((Class) rawType)) {
                return extractType(ifc, source, typeIndex, typeVariableMap, typeIndexesPerLevel, nestingLevel, currentLevel);
            }
        }
    }
    return null;
}
项目:OLD-OpenJDK8    文件:ParameterizedTypeImpl.java   
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
    }
}
项目:OLD-OpenJDK8    文件:ParameterizedTypeImpl.java   
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
        }
*/
    }
项目:cn1    文件:Class.java   
public Type[] getGenericInterfaces() throws GenericSignatureFormatError, TypeNotPresentException, MalformedParameterizedTypeException {
    if (isArray()) {
        return new Type[]{CLONEABLE_CLASS, SERIALIZABLE_CLASS};
    }
    if (isPrimitive()) {
        return new Type[0];
    }

    return (Type[])getCache().getGenericInterfaces().clone();
}
项目:cn1    文件:MalformedParameterizedTypeExceptionTest.java   
/**
 * @tests java.lang.reflect.MalformedParameterizedTypeException#
 *        MalformedParameterizedTypeException()
 */
@Test
public void testMalformedParameterizedTypeException() {
    MalformedParameterizedTypeException e = new MalformedParameterizedTypeException();
    assertNotNull(e);
    assertNull(e.getMessage());
}