Package com.sun.mirror.util

Examples of com.sun.mirror.util.Declarations


    private static final Context.Key<Declarations> declarationsKey =
            new Context.Key<Declarations>();

    public static Declarations instance(Context context) {
        Declarations instance = context.get(declarationsKey);
        if (instance == null) {
            instance = new DeclarationsImpl(context);
        }
        return instance;
    }
View Full Code Here


    }

    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;
View Full Code Here

    if (method == null) {
      return false;
    }
   
    AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
    Declarations decls = env.getDeclarationUtils();

    Declaration unwrappedMethod = method.getDelegate();
    while (unwrappedMethod instanceof DecoratedDeclaration) {
      unwrappedMethod = ((DecoratedDeclaration) unwrappedMethod).getDelegate();
    }

    TypeDeclaration declaringType = method.getDeclaringType();
    if (declaringType instanceof ClassDeclaration) {
      declaringType = ((ClassDeclaration) declaringType).getSuperclass().getDeclaration();
      while (declaringType instanceof ClassDeclaration && !Object.class.getName().equals(declaringType.getQualifiedName())) {
        Collection<? extends MethodDeclaration> methods = declaringType.getMethods();
        for (Declaration candidate : methods) {
          while (candidate instanceof DecoratedDeclaration) {
            //unwrap the candidate.
            candidate = ((DecoratedDeclaration) candidate).getDelegate();
          }

          if (decls.overrides((MethodDeclaration) candidate, (MethodDeclaration) unwrappedMethod)) {
            return true;
          }
        }

        declaringType = ((ClassDeclaration) declaringType).getSuperclass().getDeclaration();
View Full Code Here

   * @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;
View Full Code Here

   * @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;
View Full Code Here

    }

    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;
View Full Code Here

    }

    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;
View Full Code Here

    private static final Context.Key<Declarations> declarationsKey =
            new Context.Key<Declarations>();

    public static Declarations instance(Context context) {
        Declarations instance = context.get(declarationsKey);
        if (instance == null) {
            instance = new DeclarationsImpl(context);
        }
        return instance;
    }
View Full Code Here

    }

    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;
View Full Code Here

TOP

Related Classes of com.sun.mirror.util.Declarations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.