private void addCaughtException(Type type) { ITypeBinding typeBinding= type.resolveBinding(); if (typeBinding != null) { fCaughtExceptions.add(typeBinding); } }
private void addCaughtException(Type type) { ITypeBinding typeBinding= type.resolveBinding(); if (typeBinding != null) { fCaughtExceptions.add(typeBinding); } }
private static boolean isNotYetThrown(ITypeBinding binding, List<Type> thrownExceptions) { for (Type thrownException : thrownExceptions) { ITypeBinding elem = thrownException.resolveBinding(); if (elem != null) { if (Bindings.isSuperType(elem, binding)) { // existing exception is base class of new return false; } } } return true; }
private static boolean isNotYetThrown(ITypeBinding binding, List<Type> thrownExceptions) { for (int i= 0; i < thrownExceptions.size(); i++) { Type name= thrownExceptions.get(i); ITypeBinding elem= name.resolveBinding(); if (elem != null) { if (Bindings.isSuperType(elem, binding)) { // existing exception is base class of new return false; } } } return true; }
private boolean isReferenceToRemovedType(Type node) { BodyDeclaration typeDeclaration = findDeclaringNode(node.resolveBinding()); if (null == typeDeclaration) return false; return hasRemoveAnnotation(typeDeclaration); }
static ITypeBinding resolveBinding(Type type) { ITypeBinding binding= type.resolveBinding(); if (binding == null || binding.isRecovered()) throw new MissingBindingException(type); return binding; }
public void endVisit(SingleVariableDeclaration node) { ownValue = scopeManager.pop(); IConstructor type = bindingsResolver.resolveType(node.getType().resolveBinding(), false); insert(types, ownValue, type); }
public void endVisit(AnnotationTypeMemberDeclaration node) { ownValue = scopeManager.pop(); IConstructor type = bindingsResolver.resolveType(node.getType().resolveBinding(), true); insert(types, ownValue, type); }
private void getInterfaces(TypeDeclaration node) { if(node.superInterfaceTypes()!=null) { for(Object o : node.superInterfaceTypes()) { String interfaceName = ((Type)o).resolveBinding().getBinaryName(); interfaces.add(interfaceName); } } }
@Override public void endVisit(AnonymousClassDeclaration node) { if (node.getParent() instanceof ClassInstanceCreation) { ClassInstanceCreation parent = (ClassInstanceCreation) node.getParent(); ITypeBinding typeBinding = parent.getType().resolveBinding(); if (typeBinding != null && typeBinding.isFromSource()) { containerStack.pop(); } } }
public TypeVariable(Type type){ super(type.resolveBinding()); fSource= type.toString(); ICompilationUnit cu= ASTCreator.getCu(type); Assert.isNotNull(cu); fTypeRange= new CompilationUnitRange(cu, ASTNodes.getElementType(type)); }
private static void addExceptionToThrows(AST ast, MethodDeclaration methodDeclaration, ASTRewrite rewrite, Type type2) { ITypeBinding binding = type2.resolveBinding(); if (binding == null || isNotYetThrown(binding, methodDeclaration.thrownExceptionTypes())) { Type newType = (Type) ASTNode.copySubtree(ast, type2); ListRewrite listRewriter = rewrite.getListRewrite(methodDeclaration, MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY); listRewriter.insertLast(newType, null); } }
static boolean hasReference(MethodDeclaration node) { try { SuperThisReferenceFinder finder = new SuperThisReferenceFinder(); ClassInstanceCreation cic = (ClassInstanceCreation) node.getParent().getParent(); finder.fFunctionalInterface = cic.getType().resolveBinding(); finder.fMethodDeclaration = node; node.accept(finder); } catch (AbortSearchException e) { return true; } return false; }
private static void addExceptionToThrows(AST ast, MethodDeclaration methodDeclaration, ASTRewrite rewrite, Type type2) { ITypeBinding binding= type2.resolveBinding(); if (binding == null || isNotYetThrown(binding, methodDeclaration.thrownExceptionTypes())) { Type newType= (Type) ASTNode.copySubtree(ast, type2); ListRewrite listRewriter= rewrite.getListRewrite(methodDeclaration, MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY); listRewriter.insertLast(newType, null); } }
@Override public void endVisit(Type node) { if (node.isParameterizedType()) { // retain already parameterized types ImmutableTypeVariable2 typeVariable= fTCModel.makeImmutableTypeVariable(node.resolveBinding(), /*no boxing*/null); setConstraintVariable(node, typeVariable); } else { TypeVariable2 typeVariable= fTCModel.makeTypeVariable(node); setConstraintVariable(node, typeVariable); } }
private static void addExceptionToThrows(AST ast, MethodDeclaration methodDeclaration, ASTRewrite rewrite, Type type2) { ITypeBinding binding= type2.resolveBinding(); if (binding == null || isNotYetThrown(binding, methodDeclaration.thrownExceptionTypes())) { Type newType= (Type) ASTNode.copySubtree(ast, type2); ListRewrite listRewriter= rewrite.getListRewrite(methodDeclaration, MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY); listRewriter.insertLast(newType, null); } }
static boolean hasReference(MethodDeclaration node) { try { SuperThisReferenceFinder finder= new SuperThisReferenceFinder(); ClassInstanceCreation cic= (ClassInstanceCreation) node.getParent().getParent(); finder.fFunctionalInterface= cic.getType().resolveBinding(); finder.fMethodDeclaration= node; node.accept(finder); } catch (AbortSearchException e) { return true; } return false; }
public boolean visit(CastExpression node) { pushExpression(new CSCastExpression(mappedTypeReference(node.getType()), mapExpression(node.getExpression()))); // Make all byte casts unchecked if (node.getType().resolveBinding().getName().equals("byte")) pushExpression(new CSUncheckedExpression (popExpression())); return false; }
@Override public ITypeConstraint[] create(InstanceofExpression instanceofExpression){ Expression expression= instanceofExpression.getLeftOperand(); Type type= instanceofExpression.getRightOperand(); if (isClassBinding(expression.resolveTypeBinding()) && isClassBinding(type.resolveBinding())) { ConstraintVariable expressionVar= fConstraintVariableFactory.makeExpressionOrTypeVariable(expression, getContext()); ConstraintVariable typeVariable= fConstraintVariableFactory.makeTypeVariable(type); return createOrOrSubtypeConstraint(expressionVar, typeVariable); } else return new ITypeConstraint[0]; }
@Override public ITypeConstraint[] create(InstanceofExpression instanceofExpression){ Expression expression= instanceofExpression.getLeftOperand(); Type type= instanceofExpression.getRightOperand(); if (isClassBinding(expression.resolveTypeBinding()) && isClassBinding(type.resolveBinding())) { ConstraintVariable expressionVar= fConstraintVariableFactory.makeExpressionOrTypeVariable(expression, getContext()); ConstraintVariable typeVariable= fConstraintVariableFactory.makeTypeVariable(type); return createOrOrSubtypeConstraint(expressionVar, typeVariable); } else return new ITypeConstraint[0]; }