Package aQute.bnd.component.error

Examples of aQute.bnd.component.error.DeclarativeServicesAnnotationError


    @Override
    public List<MarkerData> generateMarkerData(IProject project, Project model, Location location) throws Exception {
        List<MarkerData> result = new ArrayList<MarkerData>();

        DeclarativeServicesAnnotationError dsError = (DeclarativeServicesAnnotationError) location.details;

        IJavaProject javaProject = JavaCore.create(project);

        Map<String,Object> attribs = new HashMap<String,Object>();
        attribs.put(IMarker.MESSAGE, location.message.trim());
View Full Code Here


          break;

        Clazz ec = analyzer.findClass(extendsClass);
        if (ec == null) {
          analyzer.error("Missing super class for DS annotations: " + extendsClass + " from "
              + clazz.getClassName()).details(new DeclarativeServicesAnnotationError(className.getFQN(), null, null,
                  ErrorType.UNABLE_TO_LOCATE_SUPER_CLASS));
        } else {
          ec.parseClassFileWithCollector(this);
        }
      }
    }
    for (ReferenceDef rdef : component.references.values()) {
      if (rdef.bind != null) {
        rdef.unbind = referredMethod(analyzer, rdef, rdef.unbind, "add(.*)", "remove$1", "(.*)", "un$1");
        rdef.updated = referredMethod(analyzer, rdef, rdef.updated, "(add|set|bind)(.*)", "updated$2", "(.*)",
            "updated$1");

        if (rdef.policy == ReferencePolicy.DYNAMIC && rdef.unbind == null)
          analyzer.error("In component %s, reference %s is dynamic but has no unbind method.", component.name, rdef.name)
          .details(new DeclarativeServicesAnnotationError(className.getFQN(), rdef.bind, rdef.bindDescriptor,
              ErrorType.DYNAMIC_REFERENCE_WITHOUT_UNBIND));
      }
    }
    return component;
  }
View Full Code Here

          rdef.bind, component.implementation, value, rdef.service, methods);
      //We make this a separate loop because we shouldn't add warnings until we know that there was no match
      for(String descriptor : methods.get(value)) {
        analyzer.warning(
          "  descriptor: %s", descriptor).details(
              new DeclarativeServicesAnnotationError(className.getFQN(), value, descriptor,
              ErrorType.UNSET_OR_MODIFY_WITH_WRONG_SIGNATURE));
      }
    }
    return null;
  }
View Full Code Here

          hasMapReturnType = m.group(4) != null;
          processAnnotationArguments(methodDescriptor);
        } else
          analyzer.error(
              "Activate method for %s descriptor %s is not acceptable.",
              clazz, method.getDescriptor()).details(new DeclarativeServicesAnnotationError(className.getFQN(), method.getName(), methodDescriptor,
                  ErrorType.ACTIVATE_SIGNATURE_ERROR));
      }
    }
    checkMapReturnType(hasMapReturnType);
View Full Code Here

          hasMapReturnType = m.group(6) != null;
          processAnnotationArguments(methodDescriptor);
        } else
          analyzer.error(
              "Deactivate method for %s descriptor %s is not acceptable.",
              clazz, method.getDescriptor()).details(new DeclarativeServicesAnnotationError(className.getFQN(), method.getName(), methodDescriptor,
                  ErrorType.DEACTIVATE_SIGNATURE_ERROR));
      }
    }
    checkMapReturnType(hasMapReturnType);
  }
View Full Code Here

        processAnnotationArguments(methodDescriptor);
      } else

        analyzer.error(
            "Modified method for %s descriptor %s is not acceptable.",
            clazz, method.getDescriptor()).details(new DeclarativeServicesAnnotationError(className.getFQN(), method.getName(), methodDescriptor,
                ErrorType.MODIFIED_SIGNATURE_ERROR));
    }
    checkMapReturnType(hasMapReturnType);
  }
View Full Code Here

      Matcher m = BINDNAME.matcher(method.getName());
      if (m.matches())
        def.name = m.group(2);
      else
        analyzer.error("Invalid name for bind method %s", method.getName()).details(
            new DeclarativeServicesAnnotationError(className.getFQN(), method.getName(), method.getDescriptor().toString(),
            ErrorType.INVALID_REFERENCE_BIND_METHOD_NAME));
    }

    def.unbind = reference.unbind();
    def.updated = reference.updated();
    def.bind = method.getName();
    def.bindDescriptor = method.getDescriptor().toString();

    String annoService = raw.get("service");
    if (annoService != null)
      annoService = Clazz.objectDescriptorToFQN(annoService);
    ReferenceScope scope = reference.scope();

    String service = determineReferenceType(method.getDescriptor().toString(), def, annoService, scope);
   
    def.service = service;
    if (service == null)
      analyzer.error(
          "In component %s, method %s,  cannot recognize the signature of the descriptor: %s",
          component.name, def.name, method.getDescriptor());

    // Check if we have a target, this must be a filter
    def.target = reference.target();
   
    if (def.target != null) {
      String error = Verifier.validateFilter(def.target);
      if (error != null)
        analyzer.error("Invalid target filter %s for %s: %s", def.target, def.name, error)
          .details(new DeclarativeServicesAnnotationError(className.getFQN(), def.bind, def.bindDescriptor,
              ErrorType.INVALID_TARGET_FILTER));
    }
   

    if (component.references.containsKey(def.name))
      analyzer.error(
          "In component %s, multiple references with the same name: %s. Previous def: %s, this def: %s",
          component.implementation, component.references.get(def.name), def.service, "")
          .details(new DeclarativeServicesAnnotationError(className.getFQN(), null, null,
              ErrorType.MULTIPLE_REFERENCES_SAME_NAME));
    else
      component.references.put(def.name, def);

    def.cardinality = reference.cardinality();
View Full Code Here

        if (entry.contains("=")) {
          analyzer.error(
              "Found an = sign in an OSGi DS Component annotation on %s. In the bnd annotation "
                  + "this is an actual property but in the OSGi, this element must refer to a path with Java properties. "
                  + "However, found a path with an '=' sign which looks like a mixup (%s) with the 'property' element.",
              clazz, entry).details(new DeclarativeServicesAnnotationError(className.getFQN(), null, null,
                  ErrorType.COMPONENT_PROPERTIES_ERROR));
        }
        component.properties.add(entry);
      }
View Full Code Here

      if (dynamic.contains(referenceName)) {
        rd.policy = ReferencePolicy.DYNAMIC;
        if (rd.unbind == null)
          error("In component %s, reference %s is dynamic but has no unbind method.", cd.name, rd.name)
          .details(new DeclarativeServicesAnnotationError(cd.implementation.getFQN(), null, null, ErrorType.DYNAMIC_REFERENCE_WITHOUT_UNBIND));
      }
     
      if (greedy.contains(referenceName)) {
        rd.policyOption = ReferencePolicyOption.GREEDY;
      }
View Full Code Here

TOP

Related Classes of aQute.bnd.component.error.DeclarativeServicesAnnotationError

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.