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

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

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.lookup TypeVariableBinding 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);
    }//from  w  ww . j av a 2s. 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[] getBounds(TypeVariableBinding tv) {
    List<TypeBinding> bounds = new ArrayList<TypeBinding>();
    if (tv.firstBound == null) {
        return new TypeBinding[] { tv.erasure() }; // Should be JLObject
        // return new TypeBinding[] { resolver.getScope().getJavaLangObject() };
        // return null;
    }/*from ww w. j a  v a 2s .co m*/
    bounds.add(tv.firstBound);
    TypeBinding[] obs = tv.otherUpperBounds();
    for (int i = 0; i < obs.length; i++) {
        bounds.add(obs[i]);
    }
    return bounds.toArray(new TypeBinding[bounds.size()]);
}