List of usage examples for org.eclipse.jdt.internal.compiler.lookup ParameterizedTypeBinding erasure
@Override
public TypeBinding erasure()
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 www . j a v 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.eclipse.objectteams.otdt.internal.core.compiler.mappings.MethodMappingImplementor.java
License:Open Source License
/** If original is a type variable or contains a type variable replace that type variable * with a corresponding type variable from variables. * This method is used to adjust the scope of type variables that originally were * resolved in the method mappings scope, but should be resolved in the wrapper method scope. *//*from w w w. j a va 2s .c o m*/ TypeBinding substituteVariables(TypeBinding original, TypeVariableBinding[] variables) { if (original.isTypeVariable()) { for (int i = 0; i < variables.length; i++) if (CharOperation.equals(original.internalName(), variables[i].sourceName)) return variables[i]; } else if (original.isParameterizedType()) { ParameterizedTypeBinding pt = (ParameterizedTypeBinding) original; TypeBinding[] args = pt.arguments; if (args != null) { int l = args.length; System.arraycopy(args, 0, args = new TypeBinding[l], 0, l); boolean changed = false; for (int i = 0; i < l; i++) { TypeBinding tb = substituteVariables(args[i], variables); if (TypeBinding.notEquals(tb, args[i])) { args[i] = tb; changed = true; } } if (changed) return new ParameterizedTypeBinding((ReferenceBinding) pt.erasure(), args, pt.enclosingType(), pt.environment); } } return original; }