Package aQute.bnd.osgi.Descriptors

Examples of aQute.bnd.osgi.Descriptors.TypeRef


    Object o = pool[methodRefPoolIndex];
    if (o != null && o instanceof Assoc) {
      Assoc assoc = (Assoc) o;
      if (assoc.tag == 10) {
        int string_index = intPool[assoc.a];
        TypeRef className = analyzer.getTypeRef((String) pool[string_index]);
        int name_and_type_index = assoc.b;
        Assoc name_and_type = (Assoc) pool[name_and_type_index];
        if (name_and_type.tag == 12) {
          // Name and Type
          int name_index = name_and_type.a;
View Full Code Here


    String min = null;
    String[] optionLabels = null;
    String[] optionValues = null;
    String description = null;

    TypeRef typeRef = reporter.getTypeRefFromFQN(rtype);
    Clazz c = reporter.findClass(typeRef);
    if (c != null && c.isEnum()) {
      optionValues = parseOptionValues(c);
    }
View Full Code Here

    if(ifaces != null) {
      for(TypeRef ref : ifaces) {
        parseAndMergeInheritedMetadata(ref, child);
      }
    }
    TypeRef superClazz = child.getSuper();
    if(superClazz != null) {
      parseAndMergeInheritedMetadata(superClazz, child);
    }
  }
View Full Code Here

    final Set<Element> members = new LinkedHashSet<Element>();
    final Set<MethodDef> methods = new LinkedHashSet<MethodDef>();
    final Set<Clazz.FieldDef> fields = Create.set();
    final MultiMap<Clazz.Def,Element> annotations = new MultiMap<Clazz.Def,Element>();

    final TypeRef name = clazz.getClassName();

    final String fqn = name.getFQN();
    final String shortName = name.getShortName();

    // Check if this clazz is actually a provider or not
    // providers must be listed in the exported package in the
    // PROVIDER_TYPE directive.
    Instructions matchers = providerMatcher.get(name.getPackageRef());
    boolean p = matchers != null && matchers.matches(shortName);
    final AtomicBoolean provider = new AtomicBoolean(p);

    //
    // Check if we already had this clazz in the cache
    //

    Element before = cache.get(clazz); // for super classes
    if (before != null)
      return before;

    clazz.parseClassFileWithCollector(new ClassDataCollector() {
      boolean      memberEnd;
      Clazz.FieldDef  last;

      @Override
      public void version(int minor, int major) {
        javas.add(Clazz.JAVA.getJava(major, minor));
      }

      @Override
      public void method(MethodDef defined) {
        if ((defined.isProtected() || defined.isPublic())) {
          last = defined;
          methods.add(defined);
        } else {
          last = null;
        }
      }

      @Override
      public void deprecated() {
        if (memberEnd)
          clazz.setDeprecated(true);
        else if (last != null)
          last.setDeprecated(true);
      }

      @Override
      public void field(Clazz.FieldDef defined) {
        if (defined.isProtected() || defined.isPublic()) {
          last = defined;
          fields.add(defined);
        } else
          last = null;
      }

      @Override
      public void constant(Object o) {
        if (last != null) {
          // Must be accessible now
          last.setConstant(o);
        }
      }

      @Override
      public void extendsClass(TypeRef name) throws Exception {
        String comment = null;
        if (!clazz.isInterface())
          comment = inherit(members, name);

        Clazz c = analyzer.findClass(name);
        if ((c == null || c.isPublic()) && !name.isObject())
          members.add(new Element(Type.EXTENDS, name.getFQN(), null, MICRO, MAJOR, comment));
      }

      @Override
      public void implementsInterfaces(TypeRef names[]) throws Exception {
        // TODO is interface reordering important for binary
        // compatibility??

        for (TypeRef name : names) {

          String comment = null;
          if (clazz.isInterface() || clazz.isAbstract())
            comment = inherit(members, name);
          members.add(new Element(Type.IMPLEMENTS, name.getFQN(), null, MINOR, MAJOR, comment));
        }
      }

      /**
       * @param members
       * @param name
       * @param comment
       * @return
       */
      Set<Element>  OBJECT  = Create.set();

      public String inherit(final Set<Element> members, TypeRef name) throws Exception {
        if (name.isObject()) {
          if (OBJECT.isEmpty()) {
            Clazz c = analyzer.findClass(name);
            Element s = classElement(c);
            for (Element child : s.children) {
              if (INHERITED.contains(child.type)) {
View Full Code Here

      // Assume the impl==name, but allow override
      String impl = name;
      if (info.containsKey(COMPONENT_IMPLEMENTATION))
        impl = info.get(COMPONENT_IMPLEMENTATION);

      TypeRef implRef = analyzer.getTypeRefFromFQN(impl);
      // Check if such a class exists
      analyzer.referTo(implRef);

      boolean designate = designate(name, info.get(COMPONENT_DESIGNATE), false)
          || designate(name, info.get(COMPONENT_DESIGNATEFACTORY), true);
View Full Code Here

    private boolean designate(String name, String config, boolean factory) throws Exception {
      if (config == null)
        return false;

      for (String c : Processor.split(config)) {
        TypeRef ref = analyzer.getTypeRefFromFQN(c);
        Clazz clazz = analyzer.findClass(ref);
        if (clazz != null) {
          analyzer.referTo(ref);
          MetaTypeReader r = new MetaTypeReader(clazz, analyzer);
          r.setDesignate(name, factory);
View Full Code Here

      if (o instanceof Assoc && ((Assoc) o).tag == 12) {
        referTo(((Assoc) o).b, 0); // Descriptor
      } else if (o instanceof ClassConstant) {
        String binaryClassName = (String) pool[((ClassConstant) o).cname];
        TypeRef typeRef = analyzer.getTypeRef(binaryClassName);
        referTo(typeRef, 0);
      }
    }

    /*
 
View Full Code Here

    int cIndex = in.readShort();
    int mIndex = in.readShort();

    if (cd != null) {
      int nameIndex = intPool[cIndex];
      TypeRef cName = analyzer.getTypeRef((String) pool[nameIndex]);

      String mName = null;
      String mDescriptor = null;

      if (mIndex != 0) {
View Full Code Here

  }

  private void verifyActivator() throws Exception {
    String bactivator = main.get("Bundle-Activator");
    if (bactivator != null) {
      TypeRef ref = analyzer.getTypeRefFromFQN(bactivator);
      if (analyzer.getClassspace().containsKey(ref))
        return;

      PackageRef packageRef = ref.getPackageRef();
      if (packageRef.isDefaultPackage())
        error("The Bundle Activator is not in the bundle and it is in the default package ");
      else if (!analyzer.isImported(packageRef)) {
        error("Bundle-Activator not found on the bundle class path nor in imports: " + bactivator);
      }
View Full Code Here

        try {
          for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) {
            String key = entry.getKey();
            Resource r = entry.getValue();
            if (key.endsWith(".class")) {
              TypeRef ref = analyzer.getTypeRefFromPath(key);
              if (filter.matches(ref.toString())) {
                set.add(ref);

                InputStream in = r.openInputStream();
                Clazz clazz = new Clazz(analyzer, key, r);

                // TODO use the proper bcp instead
                // of using the default layout
                Set<TypeRef> s = clazz.parseClassFile();
                for (Iterator<TypeRef> t = s.iterator(); t.hasNext();) {
                  TypeRef tr = t.next();
                  if (tr.isJava() || tr.isPrimitive())
                    t.remove();
                  else
                    packages.add(ref.getPackageRef(), tr.getPackageRef());
                }
                table.addAll(ref, s);
                set.addAll(s);
                in.close();
              }
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Descriptors.TypeRef

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.