*/
private boolean process(TypeDeclaration typeDeclaration) {
CompilationResult compResult = typeDeclaration.compilationResult;
currentSeparatorPositions = compResult.lineSeparatorPositions;
currentFileName = String.valueOf(compResult.fileName);
SourceTypeBinding binding = typeDeclaration.binding;
if (binding.constantPoolName() == null) {
/*
* Weird case: if JDT determines that this local class is totally
* uninstantiable, it won't bother allocating a local name.
*/
return false;
}
JReferenceType type = (JReferenceType) typeMap.get(binding);
try {
if (binding.isNestedType() && !binding.isStatic()) {
// add synthetic fields for outer this and locals
assert (type instanceof JClassType);
NestedTypeBinding nestedBinding = (NestedTypeBinding) binding;
if (nestedBinding.enclosingInstances != null) {
for (int i = 0; i < nestedBinding.enclosingInstances.length; ++i) {
SyntheticArgumentBinding arg = nestedBinding.enclosingInstances[i];
if (arg.matchingField != null) {
createField(arg, type);
}
}
}
if (nestedBinding.outerLocalVariables != null) {
for (int i = 0; i < nestedBinding.outerLocalVariables.length; ++i) {
SyntheticArgumentBinding arg = nestedBinding.outerLocalVariables[i];
createField(arg, type);
}
}
}
ReferenceBinding superClassBinding = binding.superclass();
if (superClassBinding != null) {
assert (binding.superclass().isClass());
JClassType superClass = (JClassType) typeMap.get(superClassBinding);
type.extnds = superClass;
}
ReferenceBinding[] superInterfaces = binding.superInterfaces();
for (int i = 0; i < superInterfaces.length; ++i) {
ReferenceBinding superInterfaceBinding = superInterfaces[i];
assert (superInterfaceBinding.isInterface());
JInterfaceType superInterface = (JInterfaceType) typeMap.get(superInterfaceBinding);
type.implments.add(superInterface);