Java Code Examples for org.eclipse.jdt.internal.corext.dom.Bindings#getBoxedTypeBinding()

The following examples show how to use org.eclipse.jdt.internal.corext.dom.Bindings#getBoxedTypeBinding() . 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: TypeMismatchSubProcessor.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public static ITypeBinding boxUnboxPrimitives(ITypeBinding castType, ITypeBinding toCast, AST ast) {
	/*
	 * e.g:
	 * 	void m(toCast var) {
	 * 		castType i= var;
	 * 	}
	 */
	if (castType.isPrimitive() && !toCast.isPrimitive()) {
		return Bindings.getBoxedTypeBinding(castType, ast);
	} else if (!castType.isPrimitive() && toCast.isPrimitive()) {
		return Bindings.getUnboxedTypeBinding(castType, ast);
	} else {
		return castType;
	}
}
 
Example 2
Source File: InferTypeArgumentsTCModel.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private TType getBoxedType(ITypeBinding typeBinding, Expression expression) {
	if (typeBinding == null)
		return null;

	if (! typeBinding.isPrimitive())
		return createTType(typeBinding);

	if (expression == null || ! expression.resolveBoxing())
		return null;

	ITypeBinding boxed= Bindings.getBoxedTypeBinding(typeBinding, expression.getAST());
	return createTType(boxed);
}
 
Example 3
Source File: TypeMismatchSubProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static ITypeBinding boxUnboxPrimitives(ITypeBinding castType, ITypeBinding toCast, AST ast) {
	/*
	 * e.g:
	 * 	void m(toCast var) {
	 * 		castType i= var;
	 * 	}
	 */
	if (castType.isPrimitive() && !toCast.isPrimitive()) {
		return Bindings.getBoxedTypeBinding(castType, ast);
	} else if (!castType.isPrimitive() && toCast.isPrimitive()) {
		return Bindings.getUnboxedTypeBinding(castType, ast);
	} else {
		return castType;
	}
}