Examples of MethodDef


Examples of aQute.bnd.osgi.Clazz.MethodDef

        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

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(), m.getGenericReturnType());

      /**
       * 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());
//        }
//      }

      String signature = m.getSignature();
      Matcher matcher;
      if (signature !=null && (matcher = PARAMETERS_P.matcher(signature)).matches()) {
        signature = matcher.group(1);
      } else
        signature = toString(m.getPrototype());
     
      Element member = new Element(Type.METHOD, m.getName() + signature, children, add, remove,
          null);

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

Examples of aQute.bnd.osgi.Clazz.MethodDef

    // 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

Examples of aQute.bnd.osgi.Clazz.MethodDef

        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

Examples of com.thoughtworks.qdox.parser.structs.MethodDef

        fieldDef.dimensions = getDimension(fieldType);
        binaryBuilder.addField(fieldDef);
    }

    private void addMethodOrConstructor(Member member, ModelBuilder binaryBuilder) {
        MethodDef methodDef = new MethodDef();
        // The name of constructors are qualified. Need to strip it.
        // This will work for regular methods too, since -1 + 1 = 0
        int lastDot = member.getName().lastIndexOf('.');
        methodDef.name = member.getName().substring(lastDot + 1);
View Full Code Here

Examples of com.thoughtworks.qdox.parser.structs.MethodDef

        fieldDef.dimensions = getDimension(fieldType);
        binaryBuilder.addField(fieldDef);
    }

    private void addMethodOrConstructor(Member member, ModelBuilder binaryBuilder) {
        MethodDef methodDef = new MethodDef();
        // The name of constructors are qualified. Need to strip it.
        // This will work for regular methods too, since -1 + 1 = 0
        int lastDot = member.getName().lastIndexOf('.');
        methodDef.name = member.getName().substring(lastDot + 1);
View Full Code Here

Examples of com.thoughtworks.qdox.parser.structs.MethodDef

        setupLex(Parser.BRACECLOSE);
        setupLex(0);

        // expectations
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        builder.addExpectedAddMethodValues(mth);

        // execute
View Full Code Here

Examples of com.thoughtworks.qdox.parser.structs.MethodDef

        setupLex(Parser.BRACECLOSE);
        setupLex(0);

        // expectations
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "void";
        builder.addExpectedAddMethodValues(mth);

        // execute
View Full Code Here

Examples of com.thoughtworks.qdox.parser.structs.MethodDef

        setupLex(Parser.BRACECLOSE);
        setupLex(0);

        // expectations
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "Something";
        builder.addExpectedAddMethodValues(mth);

        // execute
View Full Code Here

Examples of com.thoughtworks.qdox.parser.structs.MethodDef

        setupLex(Parser.BRACECLOSE);
        setupLex(0);

        // expectations
        MethodDef mth = new MethodDef();
        mth.name = "doSomething";
        mth.returns = "com.blah.Something";
        builder.addExpectedAddMethodValues(mth);

        // execute
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.