public Declarations getDeclarationUtils() { return delegate.getDeclarationUtils(); }
public boolean isOverriding(MethodDeclaration method, TypeDeclaration base) { ClassDeclaration sc = (ClassDeclaration) base; Declarations declUtil = env.getDeclarationUtils(); while(true) { for (MethodDeclaration m : sc.getMethods()) { if(declUtil.overrides(method,m)) return true; } if(sc.getSuperclass()==null) return false; sc = sc.getSuperclass().getDeclaration(); } }
public boolean isOverriding(MethodDeclaration method, TypeDeclaration base) { ClassDeclaration sc = (ClassDeclaration) base; Declarations declUtil = env.getDeclarationUtils(); while(true) { for (MethodDeclaration m : sc.getMethods()) { if(declUtil.overrides(method,m)) return true; } if(sc.getSuperclass()==null) return false; sc = sc.getSuperclass().getDeclaration(); } }
Declarations utils = env.getDeclarationUtils();
/** * Determines whether a declaration is hidden by any declaration in the given list. * @param declaration The declaration. * @param declarations The declaration list. * @return Whether a declaration is hidden by any declaration in the given list. */ @SuppressWarnings({"unchecked"}) protected boolean hidden(M declaration, ArrayList<M> declarations) { if (declaration instanceof DecoratedDeclaration) { declaration = (M) ((DecoratedDeclaration) declaration).getDelegate(); } boolean hides = false; Declarations declarationUtils = getAnnotationProcessorEnvironment().getDeclarationUtils(); for (M sub : declarations) { if (sub instanceof DecoratedDeclaration) { sub = (M) ((DecoratedDeclaration) sub).getDelegate(); } hides |= declarationUtils.hides(sub, declaration); if ((declaration instanceof MethodDeclaration) && (sub instanceof MethodDeclaration)) { hides |= declarationUtils.overrides((MethodDeclaration) sub, (MethodDeclaration) declaration); } } return hides; }
/** * Whether the specified method is overridden by any of the methods in the specified list. * * @param method The method. * @param resourceMethods The method list. * @return If the methdo is overridden by any of the methods in the list. */ protected boolean isOverridden(DecoratedDeclaration method, ArrayList<? extends DecoratedDeclaration> resourceMethods) { AnnotationProcessorEnvironment env = Context.getCurrentEnvironment(); Declarations decls = env.getDeclarationUtils(); Declaration unwrappedMethod = method.getDelegate(); while (unwrappedMethod instanceof DecoratedDeclaration) { unwrappedMethod = ((DecoratedDeclaration) unwrappedMethod).getDelegate(); } for (DecoratedDeclaration resourceMethod : resourceMethods) { Declaration candidate = resourceMethod.getDelegate(); while (candidate instanceof DecoratedDeclaration) { //unwrap the candidate. candidate = ((DecoratedDeclaration) candidate).getDelegate(); } if (decls.overrides((MethodDeclaration) candidate, (MethodDeclaration) unwrappedMethod)) { return true; } } return false; }
/** * Whether the specified resource parameter is hidden by any of the parameters in the specified list. * * @param param The param to test. * @param resourceParameters The other parameters. * @return If the parameter is hidden by any of the parameters in the specified list. */ private boolean isHidden(ResourceParameter param, List<ResourceParameter> resourceParameters) { AnnotationProcessorEnvironment env = Context.getCurrentEnvironment(); Declarations decls = env.getDeclarationUtils(); Declaration unwrappedParam = param.getDelegate(); while (unwrappedParam instanceof DecoratedDeclaration) { unwrappedParam = ((DecoratedDeclaration) unwrappedParam).getDelegate(); } for (ResourceParameter resourceParameter : resourceParameters) { Declaration candidate = resourceParameter.getDelegate(); while (candidate instanceof DecoratedDeclaration) { //unwrap the candidate. candidate = ((DecoratedDeclaration) candidate).getDelegate(); } if (decls.hides((MemberDeclaration) candidate, (MemberDeclaration) unwrappedParam)) { return true; } } return false; }
Declarations decls = env.getDeclarationUtils();
private String replaceDocInheritance(Set<String> visitedDecls, String currentComment, TypeDeclaration declaringType) { if (declaringType != null && commentNeedsReplacement(currentComment)) { Declarations declarations = Context.getCurrentEnvironment().getDeclarationUtils(); Collection<InterfaceType> superIfaces = declaringType.getSuperinterfaces(); if (superIfaces != null) {