Package aQute.bnd.osgi.Clazz

Examples of aQute.bnd.osgi.Clazz.MethodDef


    // We must do this in the correct order so please
    // keep the linked hashset in place!

    Set<MethodDef> synthetic = new LinkedHashSet<MethodDef>();
    for (Iterator<MethodDef> i = methods.iterator(); i.hasNext();) {
      MethodDef m = i.next();
      if (m.isSynthetic()) {
        synthetic.add(m);
        i.remove();
      }
    }

    //System.out.println("methods/synthetic " + clazz+ " " + methods + " " + synthetic);
    for (MethodDef m : methods) {
     
      Collection<Element> children = annotations.get(m);
      if (children == null)
        children = new HashSet<Element>();

      access(children, m.getAccess(), m.isDeprecated());

      // A final class cannot be extended, ergo,
      // all methods defined in it are by definition
      // final. However, marking them final (either
      // on the method or inheriting it from the class)
      // will create superfluous changes if we
      // override a method from a super class that was not
      // final. So we actually remove the final for methods
      // in a final class.
      if (clazz.isFinal())
        children.remove(FINAL);

      // for covariant types we need to add the return types
      // and all the implemented and extended types. This is already
      // do for us when we get the element of the return type.

      getCovariantReturns(children, m.getType());

      for (Iterator<MethodDef> i = synthetic.iterator(); i.hasNext();) {
        MethodDef s = i.next();
        if (s.getName().equals(m.getName()) && Arrays.equals(s.getPrototype(), m.getPrototype())) {
          i.remove();
          getCovariantReturns(children, s.getType());
        }
      }

      Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()), children, add, remove,
          null);
View Full Code Here


      clazz.parseClassFileWithCollector(new ClassDataCollector() {
//        MethodDef  source;

        @Override
        public void implementsInterfaces(TypeRef names[]) {
          MethodDef def = clazz.getMethodDef(0, "<implements>", "()V");
          // TODO
          for (TypeRef interfaceName : names) {
            for (Map.Entry<MethodDef,List<MethodDef>> entry : catalog.entrySet()) {
              String catalogClass = entry.getKey().getContainingClass().getFQN();
              List<MethodDef> references = entry.getValue();
View Full Code Here

        return;
      }
    }
    for (String lifecycle: LIFECYCLE_METHODS) {
      //lifecycle methods were not specified.... check for non 1.0 signatures.
      MethodDef test = descriptors.get(lifecycle);
      if (descriptors.containsKey(lifecycle) && (!(test.isPublic() || test.isProtected()) ||
          rateLifecycle(test, "deactivate".equals(lifecycle)? allowedDeactivate: allowed) > 1)) {
        cd.updateVersion(AnnotationReader.V1_1);
        return;
      }
    }
View Full Code Here

    // Remove all synthetic methods, we need
    // to treat them special for the covariant returns

    Set<MethodDef> synthetic = Create.set();
    for (Iterator<MethodDef> i = methods.iterator(); i.hasNext();) {
      MethodDef m = i.next();
      if (m.isSynthetic()) {
        synthetic.add(m);
        i.remove();
      }
    }

    for (MethodDef m : methods) {
      List<Element> children = annotations.get(m);
      if (children == null)
        children = new ArrayList<Element>();

      access(children, m.getAccess(), m.isDeprecated());

      // A final class cannot be extended, ergo,
      // all methods defined in it are by definition
      // final. However, marking them final (either
      // on the method or inheriting it from the class)
      // will create superfluous changes if we
      // override a method from a super class that was not
      // final. So we actually remove the final for methods
      // in a final class.
      if (clazz.isFinal())
        children.remove(FINAL);

      // for covariant types we need to add the return types
      // and all the implemented and extended types. This is already
      // do for us when we get the element of the return type.

      getCovariantReturns(children, m.getType());

      for (Iterator<MethodDef> i = synthetic.iterator(); i.hasNext();) {
        MethodDef s = i.next();
        if (s.getName().equals(m.getName()) && Arrays.equals(s.getPrototype(), m.getPrototype())) {
          i.remove();
          getCovariantReturns(children, s.getType());
        }
      }

      Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()), children, add, remove,
          null);
View Full Code Here

        return NAMESPACE_STEM + "/v1.1.0";
      }
    }
    for (String lifecycle: LIFECYCLE_METHODS) {
      //lifecycle methods were not specified.... check for non 1.0 signatures.
      MethodDef test = descriptors.get(lifecycle);
      if (descriptors.containsKey(lifecycle) && (!(test.isPublic() || test.isProtected()) ||
          rateLifecycle(test, "deactivate".equals(lifecycle)? allowedDeactivate: allowed) > 1)) {
        return NAMESPACE_STEM + "/v1.1.0";
      }
    }
    return null;
View Full Code Here

    // We must do this in the correct order so please
    // keep the linked hashset in place!

    Set<MethodDef> synthetic = new LinkedHashSet<MethodDef>();
    for (Iterator<MethodDef> i = methods.iterator(); i.hasNext();) {
      MethodDef m = i.next();
      if (m.isSynthetic()) {
        synthetic.add(m);
        i.remove();
      }
    }

    //System.out.println("methods/synthetic " + clazz+ " " + methods + " " + synthetic);
    for (MethodDef m : methods) {
     
      Collection<Element> children = annotations.get(m);
      if (children == null)
        children = new HashSet<Element>();

      access(children, m.getAccess(), m.isDeprecated());

      // A final class cannot be extended, ergo,
      // all methods defined in it are by definition
      // final. However, marking them final (either
      // on the method or inheriting it from the class)
      // will create superfluous changes if we
      // override a method from a super class that was not
      // final. So we actually remove the final for methods
      // in a final class.
      if (clazz.isFinal())
        children.remove(FINAL);

      // for covariant types we need to add the return types
      // and all the implemented and extended types. This is already
      // do for us when we get the element of the return type.

      getCovariantReturns(children, m.getType());

      /**
       * No longer includes synthetic methods in the tree
       */
//      for (Iterator<MethodDef> i = synthetic.iterator(); i.hasNext();) {
//        MethodDef s = i.next();
//        if (s.getName().equals(m.getName()) && Arrays.equals(s.getPrototype(), m.getPrototype())) {
//          i.remove();
//          getCovariantReturns(children, s.getType());
//        }
//      }

      Element member = new Element(Type.METHOD, m.getName() + toString(m.getPrototype()), children, add, remove,
          null);

      if (!members.add(member)) {
        members.remove(member);
        members.add(member);
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Clazz.MethodDef

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.