Example usage for org.eclipse.jdt.internal.compiler.lookup WildcardBinding erasure

List of usage examples for org.eclipse.jdt.internal.compiler.lookup WildcardBinding erasure

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup WildcardBinding erasure.

Prototype

@Override
    public TypeBinding erasure() 

Source Link

Usage

From source file:com.google.gwt.dev.jjs.impl.TypeMap.java

License:Apache License

private JNode get(Binding binding, boolean failOnNull) {
    if (binding instanceof TypeVariableBinding) {
        TypeVariableBinding tvb = (TypeVariableBinding) binding;
        return get(tvb.erasure(), failOnNull);
    } else if (binding instanceof ParameterizedTypeBinding) {
        ParameterizedTypeBinding ptb = (ParameterizedTypeBinding) binding;
        return get(ptb.erasure(), failOnNull);
    } else if (binding instanceof ParameterizedMethodBinding) {
        ParameterizedMethodBinding pmb = (ParameterizedMethodBinding) binding;
        return get(pmb.original(), failOnNull);
    } else if (binding instanceof ParameterizedFieldBinding) {
        ParameterizedFieldBinding pfb = (ParameterizedFieldBinding) binding;
        return get(pfb.original(), failOnNull);
    } else if (binding instanceof WildcardBinding) {
        WildcardBinding wcb = (WildcardBinding) binding;
        return get(wcb.erasure(), failOnNull);
    }/*w w w .  j  ava  2  s .  c  o m*/
    JNode result = internalGet(binding, failOnNull);
    if (result == null && failOnNull) {
        InternalCompilerException ice = new InternalCompilerException("Failed to get JNode");
        ice.addNode(binding.getClass().getName(), binding.toString(), null);
        throw ice;
    }
    return result;
}

From source file:org.codehaus.jdt.groovy.internal.compiler.ast.JDTClassNodeBuilder.java

License:Open Source License

private TypeBinding[] getUpperbounds(WildcardBinding wildcardType) {
    if (wildcardType.boundKind == Wildcard.EXTENDS) {
        List<TypeBinding> bounds = new ArrayList<TypeBinding>();
        bounds.add(wildcardType.bound);//from   ww  w.j  a v a2s. co m
        if (wildcardType.otherBounds != null) {
            for (int b = 0; b < wildcardType.otherBounds.length; b++) {
                bounds.add(wildcardType.otherBounds[b]);
            }
        }
        return bounds.toArray(new TypeBinding[bounds.size()]);
    }
    return new TypeBinding[] { wildcardType.erasure() };
    // return new TypeBinding[] { resolver.getScope().getJavaLangObject() };
}