Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IMethod


    IJavaElement[] children = type.getChildren();
    for (int i = 0; i < children.length && !monitor.isCanceled(); i++) {
      IJavaElement child = children[i];
      switch (child.getElementType()) {
      case IJavaElement.METHOD:
        IMethod method = (IMethod) child;
        if (methodvisitor != null) {
          methodvisitor.visit(method, resolver.resolve(method));
        }
        processAnonymousInnerTypes(visitor, aenum, method, monitor);
        break;
View Full Code Here


      return;
    }
    try {
      MethodLocator locator = new MethodLocator(type);
      for (IMethodCoverage methodCoverage : classCoverage.getMethods()) {
        final IMethod method = locator.findMethod(methodCoverage.getName(),
            methodCoverage.getDesc());
        if (method != null) {
          coveragemap.put(method, methodCoverage);
        } else {
          TRACER
View Full Code Here

            + o);
      break;
    }

    case IJavaElement.METHOD: {
      final IMethod m = (IMethod) o;
      final String retType = m.getReturnType();
      if (!isValidTypeSignature(retType))
        throw new IllegalArgumentException(Messages.Worklist_IllegalWorklistElement
            + o);

      break;
View Full Code Here

   * @throws JavaModelException
   *             From framework.
   */
  public static IMethod getTopMostSourceMethod(IMethod meth,
      IProgressMonitor monitor) throws JavaModelException {
    IMethod top = MethodChecks.isVirtual(meth) ? MethodChecks
        .getTopmostMethod(meth, meth.getDeclaringType()
            .newSupertypeHierarchy(monitor), monitor) : meth;

    if (top == null)
      top = meth;

    if (top.isBinary())
      return null;
    else
      return top;
  }
View Full Code Here

  }

  private void findFormalsForVariable(ClassInstanceCreation ctorCall)
      throws JavaModelException, CoreException {
    final int paramNumber = getParamNumber(ctorCall.arguments(), this.name);
    IMethod meth = (IMethod) ctorCall.resolveConstructorBinding()
        .getJavaElement();
    if (meth == null && ctorCall.getAnonymousClassDeclaration() != null) {
      // most likely an anonymous class.
      final AnonymousClassDeclaration acd = ctorCall
          .getAnonymousClassDeclaration();
      final ITypeBinding binding = acd.resolveBinding();
      final ITypeBinding superBinding = binding.getSuperclass();
      for (final Iterator it = Arrays.asList(
          superBinding.getDeclaredMethods()).iterator(); it.hasNext();) {
        final IMethodBinding imb = (IMethodBinding) it.next();
        if (imb.isConstructor()) {
          final ITypeBinding[] itb = imb.getParameterTypes();
          if (itb.length > paramNumber) {
            final ITypeBinding ithParamType = itb[paramNumber];
            if (ithParamType.isEqualTo(((Expression) ctorCall
                .arguments().get(paramNumber))
                .resolveTypeBinding())) {
              meth = (IMethod) imb.getJavaElement();
              break;
            }
          }
        }
      }
    }

    final IMethod top = Util.getTopMostSourceMethod(meth, this.monitor);

    if (top == null)
      throw new DefinitelyNotEnumerizableException(Messages.ASTNodeProcessor_SourceNotPresent,
          ctorCall);
    else
View Full Code Here

      this.findFormalsForVariable(top, paramNumber);
  }

  private void findFormalsForVariable(ConstructorInvocation ctorCall)
      throws JavaModelException, CoreException {
    final IMethod meth = (IMethod) ctorCall.resolveConstructorBinding()
        .getJavaElement();
    final IMethod top = Util.getTopMostSourceMethod(meth, this.monitor);

    if (top == null)
      throw new DefinitelyNotEnumerizableException(Messages.ASTNodeProcessor_SourceNotPresent,
          ctorCall);
    else
View Full Code Here

    this.findParameters(paramNumber, pattern);
  }

  private void findFormalsForVariable(MethodInvocation mi)
      throws JavaModelException, CoreException {
    final IMethod meth = (IMethod) mi.resolveMethodBinding()
        .getJavaElement();
    final IMethod top = Util.getTopMostSourceMethod(meth, this.monitor);

    if (top == null)
      throw new DefinitelyNotEnumerizableException(Messages.ASTNodeProcessor_SourceNotPresent,
          mi);
    else
View Full Code Here

          this.name));
  }

  private void findFormalsForVariable(SuperConstructorInvocation ctorCall)
      throws JavaModelException, CoreException {
    final IMethod meth = (IMethod) ctorCall.resolveConstructorBinding()
        .getJavaElement();
    final IMethod top = Util.getTopMostSourceMethod(meth, this.monitor);

    if (top == null)
      throw new DefinitelyNotEnumerizableException(Messages.ASTNodeProcessor_SourceNotPresent,
          ctorCall);
    else
View Full Code Here

          .arguments(), this.name));
  }

  private void findFormalsForVariable(SuperMethodInvocation smi)
      throws JavaModelException, CoreException {
    final IMethod meth = (IMethod) smi.resolveMethodBinding()
        .getJavaElement();
    final IMethod top = Util.getTopMostSourceMethod(meth, this.monitor);

    if (top == null)
      throw new DefinitelyNotEnumerizableException(Messages.ASTNodeProcessor_SourceNotPresent,
          smi);
    else
View Full Code Here

  private void findVariablesForFormal(SingleVariableDeclaration svd)
      throws CoreException {

    // Find invocations of the corresponding method.
    final IMethod meth = (IMethod) svd.resolveBinding()
        .getDeclaringMethod().getJavaElement();

    final SearchPattern pattern = SearchPattern.createPattern(meth,
        IJavaSearchConstants.REFERENCES, SearchPattern.R_EXACT_MATCH);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IMethod

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.