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

The following examples show how to use org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding#isBinaryBinding() . 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: Main.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private ReferenceBinding[] processClassNames(LookupEnvironment environment) {
	// check for .class file presence in case of apt processing
	int length = this.classNames.length;
	ReferenceBinding[] referenceBindings = new ReferenceBinding[length];
	for (int i = 0; i < length; i++) {
		String currentName = this.classNames[i];
		char[][] compoundName = null;
		if (currentName.indexOf('.') != -1) {
			// consider names with '.' as fully qualified names
			char[] typeName = currentName.toCharArray();
			compoundName = CharOperation.splitOn('.', typeName);
		} else {
			compoundName = new char[][] { currentName.toCharArray() };
		}
		ReferenceBinding type = environment.getType(compoundName);
		if (type != null && type.isValidBinding()) {
			if (type.isBinaryBinding()) {
				referenceBindings[i] = type;
			}
		} else {
			throw new IllegalArgumentException(
					this.bind("configure.invalidClassName", currentName));//$NON-NLS-1$
		}
	}
	return referenceBindings;
}
 
Example 2
Source File: TypeBinding.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public boolean isFromSource() {
	if (isClass() || isInterface() || isEnum()) {
		ReferenceBinding referenceBinding = (ReferenceBinding) this.binding;
		if (referenceBinding.isRawType()) {
			return !((RawTypeBinding) referenceBinding).genericType().isBinaryBinding();
		} else if (referenceBinding.isParameterizedType()) {
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) referenceBinding;
			org.eclipse.jdt.internal.compiler.lookup.TypeBinding erasure = parameterizedTypeBinding.erasure();
			if (erasure instanceof ReferenceBinding) {
				return !((ReferenceBinding) erasure).isBinaryBinding();
			}
			return false;
		} else {
			return !referenceBinding.isBinaryBinding();
		}
	} else if (isTypeVariable()) {
		final TypeVariableBinding typeVariableBinding = (TypeVariableBinding) this.binding;
		final Binding declaringElement = typeVariableBinding.declaringElement;
		if (declaringElement instanceof MethodBinding) {
			MethodBinding methodBinding = (MethodBinding) declaringElement;
			return !methodBinding.declaringClass.isBinaryBinding();
		} else {
			final org.eclipse.jdt.internal.compiler.lookup.TypeBinding typeBinding = (org.eclipse.jdt.internal.compiler.lookup.TypeBinding) declaringElement;
			if (typeBinding instanceof ReferenceBinding) {
				return !((ReferenceBinding) typeBinding).isBinaryBinding();
			} else if (typeBinding instanceof ArrayBinding) {
				final ArrayBinding arrayBinding = (ArrayBinding) typeBinding;
				final org.eclipse.jdt.internal.compiler.lookup.TypeBinding leafComponentType = arrayBinding.leafComponentType;
				if (leafComponentType instanceof ReferenceBinding) {
					return !((ReferenceBinding) leafComponentType).isBinaryBinding();
				}
			}
		}

	} else if (isCapture()) {
		CaptureBinding captureBinding = (CaptureBinding) this.binding;
		return !captureBinding.sourceType.isBinaryBinding();
	}
	return false;
}
 
Example 3
Source File: MethodBinding.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see IMethodBinding#isDefaultConstructor()
 * @since 3.0
 */
public boolean isDefaultConstructor() {
	final ReferenceBinding declaringClassBinding = this.binding.declaringClass;
	if (declaringClassBinding.isRawType()) {
		RawTypeBinding rawTypeBinding = (RawTypeBinding) declaringClassBinding;
		if (rawTypeBinding.genericType().isBinaryBinding()) {
			return false;
		}
		return (this.binding.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0;
	}
	if (declaringClassBinding.isBinaryBinding()) {
		return false;
	}
	return (this.binding.modifiers & ExtraCompilerModifiers.AccIsDefaultConstructor) != 0;
}