Java Code Examples for sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl#make()

The following examples show how to use sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl#make() . 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: SinkTest.java    From sylph with Apache License 2.0 5 votes vote down vote up
@Test
public void genericTest()
{
    Type[] type = TestSink.class.getGenericInterfaces();

    Type checkType = ParameterizedTypeImpl.make(Sink.class, new Type[] {ParameterizedTypeImpl.make(List.class, new Type[] {String.class}, null)}, null);
    Assert.assertArrayEquals(type, new Type[] {checkType});
}
 
Example 2
Source File: HbaseRowSerializerUtil.java    From presto-connectors with Apache License 2.0 4 votes vote down vote up
public MyTypeReference(Class<?> keyType, Class<?> valueType)
{
    this.type = ParameterizedTypeImpl.make(Map.class, new java.lang.reflect.Type[] {keyType, valueType}, null);
}
 
Example 3
Source File: MalformedParameterizedTypeExceptionServlet.java    From easybuggy with Apache License 2.0 4 votes vote down vote up
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    ParameterizedTypeImpl.make(List.class, new Type[]{}, null);
}
 
Example 4
Source File: TypeResolver.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 5
Source File: TypeResolver.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 6
Source File: TypeResolver.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 7
Source File: TypeResolver.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 8
Source File: TypeResolver.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 9
Source File: TypeResolver.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 10
Source File: TypeResolver.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 11
Source File: TypeResolver.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 12
Source File: TypeResolver.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 13
Source File: TypeResolver.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 14
Source File: TypeResolver.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 15
Source File: TypeResolver.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 16
Source File: TypeResolver.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}
 
Example 17
Source File: TypeResolver.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Replaces a {@link Class Class} with type parameters
 * with a {@link ParameterizedType ParameterizedType}
 * where every parameter is bound to itself.
 * When calling {@link #resolveInClass} in the context of {@code inClass},
 * we can't just pass {@code inClass} as the {@code actual} parameter,
 * because if {@code inClass} has type parameters
 * that would be interpreted as accessing the raw type,
 * so we would get unwanted erasure.
 * This is why we bind each parameter to itself.
 * If {@code inClass} does have type parameters and has methods
 * where those parameters appear in the return type or argument types,
 * we will correctly leave those types alone.
 *
 * @param inClass  the base class used to resolve
 * @return a parameterized type for the class,
 *         or the same class as {@code inClass}
 */
private static Type getActualType(Class<?> inClass) {
    Type[] params = inClass.getTypeParameters();
    return (params.length == 0)
            ? inClass
            : ParameterizedTypeImpl.make(
                    inClass, params, inClass.getEnclosingClass());
}