Package com.sun.tools.javac.code.Attribute

Examples of com.sun.tools.javac.code.Attribute.Compound


  };

  @Override
  public final Description matchVariable(VariableTree variableTree, VisitorState state) {
    if (constructorAssistedParameterMatcher.matches(variableTree, state)) {
      Compound thisParamsAssisted = null;
      for (Compound c : ASTHelpers.getSymbol(variableTree).getAnnotationMirrors()) {
        if (((TypeElement) c.getAnnotationType().asElement()).getQualifiedName()
            .contentEquals(ASSISTED_ANNOTATION)) {
          thisParamsAssisted = c;
        }
      }
      MethodTree enclosingMethod = (MethodTree) state.getPath().getParentPath().getLeaf();
      // count the number of parameters of this type and value. One is expected since we
      // will be iterating through all parameters including the one we're matching.
      int numIdentical = 0;
      for (VariableTree parameter : enclosingMethod.getParameters()) {
        if (Matchers.<VariableTree>isSameType(variableTree).matches(parameter, state)) {
          Compound otherParamsAssisted = null;
          for (Compound c : ASTHelpers.getSymbol(parameter).getAnnotationMirrors()) {
            if (((TypeElement) c.getAnnotationType().asElement()).getQualifiedName()
                .contentEquals(ASSISTED_ANNOTATION)) {
              otherParamsAssisted = c;
            }
          }
          if (otherParamsAssisted != null) {
            if (thisParamsAssisted.getElementValues().isEmpty()
                && otherParamsAssisted.getElementValues().isEmpty()) {
              //both have unnamed @Assisted annotations
              numIdentical++;
            }
            //if value is specified, check that they are equal
            //also, there can only be one value which is why I didn't check for equality
            //in both directions
            for (MethodSymbol m : thisParamsAssisted.getElementValues().keySet())
              if (otherParamsAssisted.getElementValues().get(m).getValue()
                  .equals(thisParamsAssisted.getElementValues().get(m).getValue())) {
                numIdentical++;
              }
          }
          if (numIdentical > 1) {
View Full Code Here


    }
    return Description.NO_MATCH;
  }

  public Description describe(ClassTree classTree, VisitorState state) {
    Compound target = ASTHelpers.getSymbol(classTree).attribute(
        state.getSymbolFromString(TARGET_ANNOTATION));
    if (target == null) {
      return describeMatch(classTree, SuggestedFix.builder()
          .addImport("java.lang.annotation.Target")
          .addStaticImport("java.lang.annotation.ElementType.TYPE")
View Full Code Here

    public Warner convertWarner(DiagnosticPosition pos, Type found, Type expected) {
        return new ConversionWarner(pos, "unchecked.assign", found, expected);
    }

    public void checkFunctionalInterface(JCClassDecl tree, ClassSymbol cs) {
        Compound functionalType = cs.attribute(syms.functionalInterfaceType.tsym);

        if (functionalType != null) {
            try {
                types.findDescriptorSymbol((TypeSymbol)cs);
            } catch (Types.FunctionDescriptorLookupError ex) {
View Full Code Here

TOP

Related Classes of com.sun.tools.javac.code.Attribute.Compound

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.