Package aQute.bnd.osgi.Descriptors

Examples of aQute.bnd.osgi.Descriptors.TypeRef


  }

  private void verifyActivator() throws Exception {
    String bactivator = main.get(Constants.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(Constants.BUNDLE_ACTIVATOR + " not found on the bundle class path nor in imports: " + bactivator);
      }
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

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

    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

      int outer_class_info_index = in.readShort();
      int inner_name_index = in.readShort();
      int inner_class_access_flags = in.readShort() & 0xFFFF;

      if (cd != null) {
        TypeRef innerClass = null;
        TypeRef outerClass = null;
        String innerName = null;

        if (inner_class_info_index != 0) {
          int nameIndex = intPool[inner_class_info_index];
          innerClass = analyzer.getTypeRef((String) pool[nameIndex]);
View Full Code Here

    int exception_count = in.readUnsignedShort();
    for (int i = 0; i < exception_count; i++) {
      int index = in.readUnsignedShort();
      if (api != null && (Modifier.isPublic(access_flags) || Modifier.isProtected(access_flags))) {
        ClassConstant cc = (ClassConstant) pool[index];
        TypeRef clazz = analyzer.getTypeRef(cc.getName());
        referTo(clazz, access_flags);
      }
    }
  }
View Full Code Here

          if ((methodref == forName || methodref == class$) && lastReference != -1
              && pool[intPool[lastReference]] instanceof String) {
            String fqn = (String) pool[intPool[lastReference]];
            if (!fqn.equals("class") && fqn.indexOf('.') > 0) {
              TypeRef clazz = analyzer.getTypeRefFromFQN(fqn);
              referTo(clazz, 0);
            }
            lastReference = -1;
          }
          break;
View Full Code Here

    } else {
      // We have explicit interfaces set
      component.service = new TypeRef[x.length];
      for (int i = 0; i < x.length; i++) {
        String s = (String) x[i];
        TypeRef ref = analyzer.getTypeRefFromFQN(s);
        component.service[i] = ref;
      }
    }

  }
View Full Code Here

      int access_flags) throws IOException {
    int type_index = in.readUnsignedShort();
    if (annotations == null)
      annotations = new HashSet<TypeRef>();

    TypeRef tr = analyzer.getTypeRef(pool[type_index].toString());
    annotations.add(tr);

    TypeRef name = analyzer.getTypeRef((String) pool[type_index]);
    if (policy == RetentionPolicy.RUNTIME) {
      referTo(type_index, 0);
      hasRuntimeAnnotations = true;
      if (api != null && (Modifier.isPublic(access_flags) || Modifier.isProtected(access_flags)))
        api.add(name.getPackageRef());
    } else {
      hasClassAnnotations = true;
    }
    int num_element_value_pairs = in.readUnsignedShort();
    Map<String,Object> elements = null;
View Full Code Here

      case 'e' : // enum constant
        int type_name_index = in.readUnsignedShort();
        if (policy == RetentionPolicy.RUNTIME) {
          referTo(type_name_index, 0);
          if (api != null && (Modifier.isPublic(access_flags) || Modifier.isProtected(access_flags))) {
            TypeRef name = analyzer.getTypeRef((String) pool[type_name_index]);
            api.add(name.getPackageRef());
          }
        }
        int const_name_index = in.readUnsignedShort();
        return pool[const_name_index];

      case 'c' : // Class
        int class_info_index = in.readUnsignedShort();
        if (policy == RetentionPolicy.RUNTIME) {
          referTo(class_info_index, 0);
          if (api != null && (Modifier.isPublic(access_flags) || Modifier.isProtected(access_flags))) {
            TypeRef name = analyzer.getTypeRef((String) pool[class_info_index]);
            api.add(name.getPackageRef());
          }
        }
        return pool[class_info_index];

      case '@' : // Annotation type
View Full Code Here

          r = parseReferences(descriptor, r + 1, '>', modifiers);
        } else
          sb.append(c);
        r++;
      }
      TypeRef ref = analyzer.getTypeRef(sb.toString());
      if (cd != null)
        cd.addReference(ref);

      referTo(ref, modifiers);
    } else {
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.