Java Code Examples for org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fieldCount()

The following examples show how to use org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#fieldCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeElementImpl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public List<? extends Element> getEnclosedElements() {
	ReferenceBinding binding = (ReferenceBinding)_binding;
	List<Element> enclosed = new ArrayList<Element>(binding.fieldCount() + binding.methods().length);
	for (MethodBinding method : binding.methods()) {
		ExecutableElement executable = new ExecutableElementImpl(_env, method);
		enclosed.add(executable);
	}
	for (FieldBinding field : binding.fields()) {
		// TODO no field should be excluded according to the JLS
		if (!field.isSynthetic()) {
			 VariableElement variable = new VariableElementImpl(_env, field);
			 enclosed.add(variable);
		}
	}
	for (ReferenceBinding memberType : binding.memberTypes()) {
		TypeElement type = new TypeElementImpl(_env, memberType, null);
		enclosed.add(type);
	}
	return Collections.unmodifiableList(enclosed);
}
 
Example 2
Source File: UnconditionalFlowInfo.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
static int numberOfEnclosingFields(ReferenceBinding type){
	int count = 0;
	type = type.enclosingType();
	while(type != null) {
		count += type.fieldCount();
		type = type.enclosingType();
	}
	return count;
}