@Override public ITypeBinding getReturnTypeBinding() { IMethodBinding methodBinding= lambdaExpression.resolveMethodBinding(); if (methodBinding != null && methodBinding.getReturnType() != null) { return methodBinding.getReturnType(); } return null; }
protected ITypeBinding getReturnTypeBinding() { IMethodBinding methodBinding= fMethodDecl.resolveBinding(); if (methodBinding != null && methodBinding.getReturnType() != null) { return methodBinding.getReturnType(); } return null; }
private ITypeBinding getReturnTypeBinding() { IMethodBinding methodBinding= fMethodDecl.resolveBinding(); if (methodBinding != null && methodBinding.getReturnType() != null) { return methodBinding.getReturnType(); } return null; }
protected ITypeBinding getReturnTypeBinding() { IMethodBinding methodBinding= fMethodDecl.resolveBinding(); if (methodBinding != null && methodBinding.getReturnType() != null) { return methodBinding.getReturnType(); } return null; }
protected ITypeBinding getReturnTypeBinding() { IMethodBinding methodBinding= fMethodDecl.resolveBinding(); if (methodBinding != null && methodBinding.getReturnType() != null) { return methodBinding.getReturnType(); } return null; }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
private void init() { this.value = buildDOMValue(this.internalPair.getValue(), this.bindingResolver); if (this.value == null) this.value = NoValue; IMethodBinding methodBinding = getMethodBinding(); if (methodBinding.getReturnType().isArray() && !this.value.getClass().isArray()) { this.value = new Object[] { this.value }; } }
private boolean isVoidMethod() { // if we have an initializer if (fEnclosingMethodBinding == null) return true; ITypeBinding binding= fEnclosingMethodBinding.getReturnType(); if (fEnclosingBodyDeclaration.getAST().resolveWellKnownType("void").equals(binding)) //$NON-NLS-1$ return true; return false; }
private boolean isSpecialCloneInvocation(IMethodBinding methodBinding, Expression receiver) { return fAssumeCloneReturnsSameType && "clone".equals(methodBinding.getName()) //$NON-NLS-1$ && methodBinding.getParameterTypes().length == 0 && receiver != null && receiver.resolveTypeBinding() != methodBinding.getMethodDeclaration().getReturnType(); }
private boolean isSpecialCloneInvocation(IMethodBinding methodBinding, Expression receiver) { return fAssumeCloneReturnsSameType && "clone".equals(methodBinding.getName()) //$NON-NLS-1$ && methodBinding.getParameterTypes().length == 0 && receiver != null && receiver.resolveTypeBinding() != methodBinding.getMethodDeclaration().getReturnType(); }
private boolean isSpecialCloneInvocation(IMethodBinding methodBinding, Expression receiver) { return fAssumeCloneReturnsSameType && "clone".equals(methodBinding.getName()) //$NON-NLS-1$ && methodBinding.getParameterTypes().length == 0 && receiver != null && receiver.resolveTypeBinding() != methodBinding.getMethodDeclaration().getReturnType(); }
public static boolean sameErasedSignatureAndReturnType(IMethodBinding met1, IMethodBinding met2) { if (!met1.getReturnType().getErasure().isEqualTo(met2.getReturnType().getErasure())) return false; ITypeBinding[] params1 = met1.getParameterTypes(); ITypeBinding[] params2 = met2.getParameterTypes(); if (params1.length != params2.length) return false; for (int i = 0; i < params1.length; i++) if (!params1[i].getErasure().isEqualTo(params2[i].getErasure())) return false; return true; }
private CSTypeReferenceExpression mappedReturnType(MethodDeclaration node) { IMethodBinding overriden = getOverridedMethod(node); if (overriden != null) return mappedTypeReference (overriden.getReturnType()); return mappedTypeReference(node.getReturnType2()); }
public static void changeLambdaBodyToBlock(LambdaExpression lambda, AST ast, ASTRewrite rewrite) { Expression bodyExpr = (Expression) rewrite.createMoveTarget(lambda.getBody()); Block blockBody = getBlockBodyForLambda(bodyExpr, lambda.resolveMethodBinding().getReturnType(), ast); rewrite.set(lambda, LambdaExpression.BODY_PROPERTY, blockBody, null); }
private ITypeConstraint[] getReturnTypeConstraint(Expression invocation, IMethodBinding methodBinding){ if (methodBinding == null || methodBinding.isConstructor() || methodBinding.getReturnType().isPrimitive()) return new ITypeConstraint[0]; ConstraintVariable returnTypeVariable= fConstraintVariableFactory.makeReturnTypeVariable(methodBinding); ConstraintVariable invocationVariable= fConstraintVariableFactory.makeExpressionOrTypeVariable(invocation, getContext()); return fTypeConstraintFactory.createDefinesConstraint(invocationVariable, returnTypeVariable); }
private CSProperty newAbstractPropertyStubFor(IMethodBinding method) { CSProperty stub = new CSProperty(mappedMethodName(method), mappedTypeReference(method.getReturnType())); stub.modifier(CSMethodModifier.Abstract); stub.visibility(mapVisibility(method.getModifiers())); stub.getter(new CSBlock()); return stub; }
private static IMethodBinding findGetter(ProposalParameter context) { ITypeBinding returnType= context.variableBinding.getType(); String getterName= GetterSetterUtil.getGetterName(context.variableBinding, context.compilationUnit.getJavaProject(), null, isBoolean(context)); ITypeBinding declaringType= context.variableBinding.getDeclaringClass(); IMethodBinding getter= Bindings.findMethodInHierarchy(declaringType, getterName, new ITypeBinding[0]); if (getter != null && getter.getReturnType().isAssignmentCompatible(returnType) && Modifier.isStatic(getter.getModifiers()) == Modifier.isStatic(context.variableBinding.getModifiers())) return getter; return null; }
private static IMethodBinding findGetter(ProposalParameter context) { ITypeBinding returnType = context.variableBinding.getType(); String getterName = GetterSetterUtil.getGetterName(context.variableBinding, context.compilationUnit.getJavaProject(), null, isBoolean(context)); ITypeBinding declaringType = context.variableBinding.getDeclaringClass(); if (declaringType == null) { return null; } IMethodBinding getter = Bindings.findMethodInHierarchy(declaringType, getterName, new ITypeBinding[0]); if (getter != null && getter.getReturnType().isAssignmentCompatible(returnType) && Modifier.isStatic(getter.getModifiers()) == Modifier.isStatic(context.variableBinding.getModifiers())) { return getter; } return null; }
private static IMethodBinding findGetter(ProposalParameter context) { ITypeBinding returnType= context.variableBinding.getType(); String getterName= GetterSetterUtil.getGetterName(context.variableBinding, context.compilationUnit.getJavaProject(), null, isBoolean(context)); ITypeBinding declaringType= context.variableBinding.getDeclaringClass(); if (declaringType == null) return null; IMethodBinding getter= Bindings.findMethodInHierarchy(declaringType, getterName, new ITypeBinding[0]); if (getter != null && getter.getReturnType().isAssignmentCompatible(returnType) && Modifier.isStatic(getter.getModifiers()) == Modifier.isStatic(context.variableBinding.getModifiers())) return getter; return null; }
private CSMethod newAbstractMethodStubFor(IMethodBinding method) { CSMethod stub = new CSMethod(mappedMethodName(method)); stub.modifier(CSMethodModifier.Abstract); stub.visibility(mapVisibility(method.getModifiers())); stub.returnType(mappedTypeReference(method.getReturnType())); ITypeBinding[] parameters = method.getParameterTypes(); for (int i = 0; i < parameters.length; ++i) { stub.addParameter(new CSVariableDeclaration("arg" + (i + 1), mappedTypeReference(parameters[i]))); } return stub; }