Java Code Examples for org.codehaus.groovy.ast.ClassNode#setUsingGenerics()

The following examples show how to use org.codehaus.groovy.ast.ClassNode#setUsingGenerics() . 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: StaticTypeCheckingSupport.java    From groovy with Apache License 2.0 5 votes vote down vote up
private static ClassNode makeRawType(final ClassNode receiver) {
    if (receiver.isArray()) {
        return makeRawType(receiver.getComponentType()).makeArray();
    }
    ClassNode raw = receiver.getPlainNodeReference();
    raw.setUsingGenerics(false);
    raw.setGenericsTypes(null);
    return raw;
}
 
Example 2
Source File: GenericsUtils.java    From groovy with Apache License 2.0 5 votes vote down vote up
public static ClassNode nonGeneric(ClassNode type) {
    if (type.isUsingGenerics()) {
        final ClassNode nonGen = ClassHelper.makeWithoutCaching(type.getName());
        nonGen.setRedirect(type);
        nonGen.setGenericsTypes(null);
        nonGen.setUsingGenerics(false);
        return nonGen;
    }
    if (type.isArray() && type.getComponentType().isUsingGenerics()) {
        return type.getComponentType().getPlainNodeReference().makeArray();
    }
    return type;
}