Package org.aspectj.org.eclipse.jdt.internal.compiler.ast

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration


  }

  protected void consumeInterTypeMethodHeaderName(boolean hasMethodTypeParameters, boolean hasGenericTypeParameters) {
    //InterTypeMethodHeaderName ::= Modifiersopt Type OnType '.' JavaIdentifier '('
    this.display();
    MethodDeclaration md = declarationFactory.createInterTypeMethodDeclaration(
        this.compilationUnit.compilationResult);

    //identifier
    char[] name = identifierStack[identifierPtr];
    long selectorSource = identifierPositionStack[identifierPtr--];
View Full Code Here


  }

  protected void consumeInterTypeConstructorHeaderName(boolean hasConstructorTypeParameters, boolean hasTargetTypeParameters) {
    //InterTypeConstructorHeaderName ::= Modifiersopt Name '.' 'new' '('
    this.display();
    MethodDeclaration md = declarationFactory.createInterTypeConstructorDeclaration(
        this.compilationUnit.compilationResult);

    //identifier
//    md.selector = identifierStack[identifierPtr];
//    long selectorSource = identifierPositionStack[identifierPtr--];
View Full Code Here

  /**
   * Recovery rule for when someone tries to use * or + in an ITD
   */
  private void consumeInterTypeFieldHeaderIllegallyAttemptingToUseATypePattern(String badToken) {
    consumeInterTypeFieldHeader(false); // make the best of what we did get
    MethodDeclaration errorNode = (MethodDeclaration) astStack[astPtr];
    problemReporter().parseErrorDeleteToken(errorNode.sourceStart -2// '+.'
                                        errorNode.sourceStart, 
                                        TokenNameIdentifier,
                                        badToken.toCharArray(),
                                        badToken);    
View Full Code Here

  /**
   * Recovery rule for when someone tries to use * or + in an ITD
   */
  private void consumeInterTypeConstructorHeaderNameIllegallyUsingTypePattern(String badToken) {
    consumeInterTypeConstructorHeaderName(false,false); // make the best of what we did get
    MethodDeclaration errorNode = (MethodDeclaration) astStack[astPtr];
    problemReporter().parseErrorDeleteToken(errorNode.sourceStart -2// '+.'
                                        errorNode.sourceStart, 
                                        TokenNameIdentifier,
                                        badToken.toCharArray(),
                                        badToken);      
View Full Code Here

  /**
   * Recovery rule for when someone tries to use * or + in an ITD
   */
  private void consumeInterTypeMethodHeaderNameIllegallyUsingTypePattern(String badToken) {
    consumeInterTypeMethodHeaderName(false,false); // make the best of what we did get
    MethodDeclaration errorNode = (MethodDeclaration) astStack[astPtr];
    problemReporter().parseErrorDeleteToken(errorNode.sourceStart -2// '+.'
                                        errorNode.sourceStart, 
                                        TokenNameIdentifier,
                                        badToken.toCharArray(),
                                        badToken);      
View Full Code Here

    AstUtil.addMethodDeclaration(typeDec, testMethod);
  }

  // XXX todo: make sure that errors in Arguments only get displayed once
  private MethodDeclaration makeMethod(CompilationResult result, MethodDeclaration enclosingDec) {
    MethodDeclaration ret = new IfMethodDeclaration(result, pointcut);
    ret.modifiers = ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccPublic;
    ret.returnType = AstUtil.makeTypeReference(TypeBinding.BOOLEAN);
    // create a more stable name 277508
    StringBuffer ifSelector = new StringBuffer();
    ifSelector.append("ajc$if$");
View Full Code Here

    // Use reset() rather than init()
    // XXX We need a scope to keep reset happy, initializerScope is *not* the right one, but it works !
    // codeStream.init(classFile);
    // codeStream.initializeMaxLocals(methodBinding);
    MethodDeclaration md = AstUtil.makeMethodDeclaration(methodBinding);
    md.scope = initializerScope;
    codeStream.reset(md, classFile);
    // body starts here
    gen.generate(codeStream);
    // body ends here
View Full Code Here

    UnresolvedType aspectTypeX = world.fromBinding(binding.declaringClass);
    UnresolvedType targetTypeX = world.fromBinding(onTypeBinding);

    ArrayBinding objectArrayBinding = scope.createArrayType(scope.getJavaLangObject(), 1);

    MethodDeclaration pre = new MethodDeclaration(compilationResult);
    pre.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
    pre.returnType = AstUtil.makeTypeReference(objectArrayBinding);
    pre.selector = NameMangler.postIntroducedConstructor(aspectTypeX, targetTypeX).toCharArray();

    pre.arguments = AstUtil.copyArguments(this.arguments);

    // XXX should do exceptions

    pre.scope = new MethodScope(scope, pre, true);
    // ??? do we need to do anything with scope???

    // Use the factory to build a semi-correct resolvedmember - then patch it up with
    // reset calls. This is SAFE
    ResolvedMemberImpl preIntroducedConstructorRM = world.makeResolvedMember(binding);
    preIntroducedConstructorRM.resetName(NameMangler.preIntroducedConstructor(aspectTypeX, targetTypeX));
    preIntroducedConstructorRM.resetModifiers(Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
    preIntroducedConstructorRM.resetReturnTypeToObjectArray();

    pre.binding = world.makeMethodBinding(preIntroducedConstructorRM);

    pre.bindArguments();
    pre.bindThrownExceptions();

    if (explicitConstructorCall == null) {
      pre.statements = new Statement[] {};
    } else {
      pre.statements = new Statement[] { explicitConstructorCall };
    }

    InterTypeScope newParent = new InterTypeScope(scope, onTypeBinding);
    pre.scope.parent = newParent;

    pre.resolveStatements(); // newParent);

    int nParams = pre.arguments.length;
    MethodBinding explicitConstructor = null;
    if (explicitConstructorCall != null) {
      explicitConstructor = explicitConstructorCall.binding;
View Full Code Here

  public static ReturnStatement makeReturnStatement(Expression expr) {
    return new ReturnStatement(expr, 0, 0);
  }

  public static MethodDeclaration makeMethodDeclaration(MethodBinding binding) {
    MethodDeclaration ret = new MethodDeclaration(null);
    ret.binding = binding;
    int nargs = binding.parameters.length;
    ret.arguments = new Argument[nargs];
    for (int i = 0; i < nargs; i++) {
      ret.arguments[i] = makeFinalArgument(("arg" + i).toCharArray(), binding.parameters[i]);
View Full Code Here

    if (method.isConstructor()) {
      ConstructorDeclaration decl = new ConstructorDeclaration(compilationResult);
      decl.bits &= ~ASTNode.IsDefaultConstructor;
      methodDeclaration = decl;
    } else {
      MethodDeclaration decl = type.isAnnotation() ? new AnnotationMethodDeclaration(compilationResult) : new MethodDeclaration(compilationResult);
      /* convert return type */
      decl.returnType = createTypeReference(Signature.toString(method.getReturnType()).toCharArray());
      methodDeclaration = decl;
    }
    methodDeclaration.selector = method.getElementName().toCharArray();
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration

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.