}
public ResolvedType fromEclipse(ReferenceBinding binding) {
- if (binding == null)
+ if (binding == null) {
return ResolvedType.MISSING;
+ }
// ??? this seems terribly inefficient
// System.err.println("resolving: " + binding.getClass() + ", name = " + getName(binding));
ResolvedType ret = getWorld().resolve(fromBinding(binding));
}
public ResolvedType fromTypeBindingToRTX(TypeBinding tb) {
- if (tb == null)
+ if (tb == null) {
return ResolvedType.MISSING;
+ }
ResolvedType ret = getWorld().resolve(fromBinding(tb));
return ret;
}
// Create an unresolved parameterized type. We can't create a resolved one as the
// act of resolution here may cause recursion problems since the parameters may
// be type variables that we haven't fixed up yet.
- if (arguments == null)
+ if (arguments == null) {
arguments = new UnresolvedType[0];
+ }
// StringBuffer parameterizedSig = new StringBuffer();
// parameterizedSig.append(ResolvedType.PARAMETERIZED_TYPE_IDENTIFIER);
//
tVars[i] = ((TypeVariableReference) fromTypeVariableBinding(eclipseV)).getTypeVariable();
}
// TODO asc generics - temporary guard....
- if (!(binding instanceof SourceTypeBinding))
+ if (!(binding instanceof SourceTypeBinding)) {
throw new RuntimeException("Cant get the generic sig for " + binding.debugName());
+ }
return UnresolvedType.forGenericType(getName(binding), tVars, CharOperation.charToString(((SourceTypeBinding) binding)
.genericSignature()));
}
tv.setDeclaringElementKind(TypeVariable.TYPE);
// // tv.setDeclaringElement(fromBinding(aTypeVariableBinding.declaringElement));
}
- if (aTypeVariableBinding.declaringElement instanceof MethodBinding)
+ if (aTypeVariableBinding.declaringElement instanceof MethodBinding) {
typeVariablesForThisMember.put(new String(aTypeVariableBinding.sourceName), ret);
+ }
typeVariableBindingsInProgress.remove(aTypeVariableBinding);
return ret;
}
public UnresolvedType[] fromBindings(TypeBinding[] bindings) {
- if (bindings == null)
+ if (bindings == null) {
return UnresolvedType.NONE;
+ }
int len = bindings.length;
UnresolvedType[] ret = new UnresolvedType[len];
for (int i = 0; i < len; i++) {
for (Iterator i = baseTypeMungers.iterator(); i.hasNext();) {
ConcreteTypeMunger munger = (ConcreteTypeMunger) i.next();
EclipseTypeMunger etm = makeEclipseTypeMunger(munger);
- if (etm != null)
+ if (etm != null) {
ret.add(etm);
+ }
}
finishedTypeMungers = ret;
}
public ResolvedMember makeResolvedMember(MethodBinding binding, Shadow.Kind shadowKind) {
MemberKind memberKind = binding.isConstructor() ? Member.CONSTRUCTOR : Member.METHOD;
- if (shadowKind == Shadow.AdviceExecution)
+ if (shadowKind == Shadow.AdviceExecution) {
memberKind = Member.ADVICE;
+ }
return makeResolvedMember(binding, binding.declaringClass, memberKind);
}
// AMC these next two lines shouldn't be needed once we sort out generic types properly in the world map
ResolvedType realDeclaringType = world.resolve(fromBinding(declaringType));
- if (realDeclaringType.isRawType())
+ if (realDeclaringType.isRawType()) {
realDeclaringType = realDeclaringType.getGenericType();
+ }
ResolvedMemberImpl ret = new EclipseResolvedMember(binding, memberKind, realDeclaringType, binding.modifiers,
fromBinding(binding.returnType), new String(binding.selector), fromBindings(binding.parameters),
fromBindings(binding.thrownExceptions), this);
public ResolvedMember makeResolvedMember(FieldBinding binding, TypeBinding receiverType) {
// AMC these next two lines shouldn't be needed once we sort out generic types properly in the world map
ResolvedType realDeclaringType = world.resolve(fromBinding(receiverType));
- if (realDeclaringType.isRawType())
+ if (realDeclaringType.isRawType()) {
realDeclaringType = realDeclaringType.getGenericType();
+ }
ResolvedMemberImpl ret = new EclipseResolvedMember(binding, Member.FIELD, realDeclaringType, binding.modifiers, world
.resolve(fromBinding(binding.type)), new String(binding.name), UnresolvedType.NONE);
return ret;
// return true if this is type variables are in the type arguments
private boolean isParameterizedWithTypeVariables(UnresolvedType typeX) {
- if (!typeX.isParameterizedType())
+ if (!typeX.isParameterizedType()) {
return false;
+ }
UnresolvedType[] typeArguments = typeX.getTypeParameters();
if (typeArguments != null) {
for (int i = 0; i < typeArguments.length; i++) {
- if (typeArguments[i].isTypeVariableReference())
+ if (typeArguments[i].isTypeVariableReference()) {
return true;
+ }
}
}
return false;
private TypeBinding makeTypeBinding1(UnresolvedType typeX) {
if (typeX.isPrimitiveType()) {
- if (typeX == ResolvedType.BOOLEAN)
+ if (typeX == ResolvedType.BOOLEAN) {
return TypeBinding.BOOLEAN;
- if (typeX == ResolvedType.BYTE)
+ }
+ if (typeX == ResolvedType.BYTE) {
return TypeBinding.BYTE;
- if (typeX == ResolvedType.CHAR)
+ }
+ if (typeX == ResolvedType.CHAR) {
return TypeBinding.CHAR;
- if (typeX == ResolvedType.DOUBLE)
+ }
+ if (typeX == ResolvedType.DOUBLE) {
return TypeBinding.DOUBLE;
- if (typeX == ResolvedType.FLOAT)
+ }
+ if (typeX == ResolvedType.FLOAT) {
return TypeBinding.FLOAT;
- if (typeX == ResolvedType.INT)
+ }
+ if (typeX == ResolvedType.INT) {
return TypeBinding.INT;
- if (typeX == ResolvedType.LONG)
+ }
+ if (typeX == ResolvedType.LONG) {
return TypeBinding.LONG;
- if (typeX == ResolvedType.SHORT)
+ }
+ if (typeX == ResolvedType.SHORT) {
return TypeBinding.SHORT;
- if (typeX == ResolvedType.VOID)
+ }
+ if (typeX == ResolvedType.VOID) {
return TypeBinding.VOID;
+ }
throw new RuntimeException("weird primitive type " + typeX);
} else if (typeX.isArray()) {
int dim = 0;
bound = makeTypeBinding(brt.getLowerBound());
}
TypeBinding[] otherBounds = null;
- if (brt.getAdditionalBounds() != null && brt.getAdditionalBounds().length != 0)
+ if (brt.getAdditionalBounds() != null && brt.getAdditionalBounds().length != 0) {
otherBounds = makeTypeBindings(brt.getAdditionalBounds());
+ }
WildcardBinding wb = lookupEnvironment.createWildcard(baseTypeForParameterizedType,
indexOfTypeParameterBeingConverted, bound, otherBounds, boundkind);
return wb;
.getReturnType()), makeTypeBindings(member.getParameterTypes()), makeReferenceBindings(member.getExceptions()),
declaringType);
- if (tvbs != null)
+ if (tvbs != null) {
mb.typeVariables = tvbs;
+ }
typeVariableToTypeBinding.clear();
currentType = null;
TypeVariableBinding tvBinding = (TypeVariableBinding) typeVariableToTypeBinding.get(tv.getName());
if (currentType != null) {
TypeVariableBinding tvb = currentType.getTypeVariable(tv.getName().toCharArray());
- if (tvb != null)
+ if (tvb != null) {
return tvb;
+ }
}
if (tvBinding == null) {
Binding declaringElement = null;
if (!cName.isMissing()) {
complexName = (ReferenceType) cName;
complexName = (ReferenceType) complexName.getGenericType();
- if (complexName == null)
+ if (complexName == null) {
complexName = new ReferenceType(complexTx, world);
+ }
} else {
complexName = new ReferenceType(complexTx, world);
}