Examples of ConstructorDeclaration


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

    if (bodyDeclarations != null) {
      return internalFormatClassBodyDeclarations(source, indentationLevel, lineSeparator, bodyDeclarations, offset, length);
    }

    // probe for statements
    ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false);
    if (constructorDeclaration.statements != null) {
      return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, offset, length);
    }

    // this has to be a compilation unit
View Full Code Here

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

    if (this.sourceLength == -1) {
      this.sourceLength = this.rawSource.length;
    }
    switch(this.astKind) {
      case K_STATEMENTS :
        ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements(this.rawSource, this.sourceOffset, this.sourceLength, this.compilerOptions, true, this.statementsRecovery);
        RecoveryScannerData data = constructorDeclaration.compilationResult.recoveryScannerData;
        if(data != null) {
          Scanner scanner = converter.scanner;
          converter.scanner = new RecoveryScanner(scanner, data.removeUnused());
          converter.docParser.scanner = converter.scanner;
View Full Code Here

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

    if (block != null){
      methodDeclaration.statements = block.statements;

      /* first statement might be an explict constructor call destinated to a special slot */
      if (methodDeclaration.isConstructor()) {
        ConstructorDeclaration constructor = (ConstructorDeclaration)methodDeclaration;
        if (methodDeclaration.statements != null
          && methodDeclaration.statements[0] instanceof ExplicitConstructorCall){
          constructor.constructorCall = (ExplicitConstructorCall)methodDeclaration.statements[0];
          int length = methodDeclaration.statements.length;
          System.arraycopy(
View Full Code Here

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

  private static AbstractMethodDeclaration convert(IMethod method, IType type, CompilationResult compilationResult) throws JavaModelException {

    AbstractMethodDeclaration methodDeclaration;

    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 */
 
View Full Code Here

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

        compilerOptions.defaultEncoding);

    final CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, compilerOptions.maxProblemsPerUnit);
    CompilationUnitDeclaration compilationUnitDeclaration = new CompilationUnitDeclaration(problemReporter, compilationResult, length);   

    ConstructorDeclaration constructorDeclaration = new ConstructorDeclaration(compilationResult);
    constructorDeclaration.sourceEnd  = -1;
    constructorDeclaration.declarationSourceEnd = offset + length - 1;
    constructorDeclaration.bodyStart = offset;
    constructorDeclaration.bodyEnd = offset + length - 1;
   
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration

    }
    return internalFormatExpression(source, indentationLevel, lineSeparator, expression, regions, includeComments);
  }

  private TextEdit formatStatements(String source, int indentationLevel, String lineSeparator, IRegion[] regions, boolean includeComments) {
    ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false);

    if (constructorDeclaration.statements == null) {
      // a problem occured while parsing the source
      return null;
    }
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration

    if (bodyDeclarations != null) {
      return internalFormatClassBodyDeclarations(source, indentationLevel, lineSeparator, bodyDeclarations, regions, includeComments);
    }

    // probe for statements
    ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true, false);
    if (constructorDeclaration.statements != null) {
      return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, regions, includeComments);
    }

    // this has to be a compilation unit
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration

    return;
  }

  if (methodDeclaration.isDefaultConstructor()) {
    if (reportReferenceInfo) {
      ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
      ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall;
      if (constructorCall != null) {
        switch(constructorCall.accessMode) {
          case ExplicitConstructorCall.This :
            requestor.acceptConstructorReference(
              typeNames[nestedTypeIndex-1],
              constructorCall.arguments == null ? 0 : constructorCall.arguments.length,
              constructorCall.sourceStart);
            break;
          case ExplicitConstructorCall.Super :
          case ExplicitConstructorCall.ImplicitSuper :         
            requestor.acceptConstructorReference(
              superTypeNames[nestedTypeIndex-1],
              constructorCall.arguments == null ? 0 : constructorCall.arguments.length,
              constructorCall.sourceStart);
            break;
        }
      }
    } 
    return
 
  char[][] argumentTypes = null;
  char[][] argumentNames = null;
  boolean isVarArgs = false;
  Argument[] arguments = methodDeclaration.arguments;
  if (arguments != null) {
    char[][][] argumentTypesAndNames = this.getArguments(arguments);
    argumentTypes = argumentTypesAndNames[0];
    argumentNames = argumentTypesAndNames[1];
   
    isVarArgs = arguments[arguments.length-1].isVarArgs();
  }
  char[][] thrownExceptionTypes = getThrownExceptions(methodDeclaration);
  // by default no selector end position
  int selectorSourceEnd = -1;
  if (methodDeclaration.isConstructor()) {
    selectorSourceEnd = this.sourceEnds.get(methodDeclaration);
    if (isInRange){
      int currentModifiers = methodDeclaration.modifiers;
      if (isVarArgs)
        currentModifiers |= ClassFileConstants.AccVarargs;
     
      // remember deprecation so as to not lose it below
      boolean deprecated = (currentModifiers & ClassFileConstants.AccDeprecated) != 0 || hasDeprecatedAnnotation(methodDeclaration.annotations);
     
      ISourceElementRequestor.MethodInfo methodInfo = new ISourceElementRequestor.MethodInfo();
      methodInfo.isConstructor = true;
      methodInfo.declarationStart = methodDeclaration.declarationSourceStart;
      methodInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag;
      methodInfo.name = methodDeclaration.selector;
      methodInfo.nameSourceStart = methodDeclaration.sourceStart;
      methodInfo.nameSourceEnd = selectorSourceEnd;
      methodInfo.parameterTypes = argumentTypes;
      methodInfo.parameterNames = argumentNames;
      methodInfo.exceptionTypes = thrownExceptionTypes;
      methodInfo.typeParameters = getTypeParameterInfos(methodDeclaration.typeParameters());
      methodInfo.categories = (char[][]) this.nodesToCategories.get(methodDeclaration);
      methodInfo.annotations = methodDeclaration.annotations;
      methodInfo.node = methodDeclaration;
      requestor.enterConstructor(methodInfo);
    }
    if (reportReferenceInfo) {
      ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) methodDeclaration;
      ExplicitConstructorCall constructorCall = constructorDeclaration.constructorCall;
      if (constructorCall != null) {
        switch(constructorCall.accessMode) {
          case ExplicitConstructorCall.This :
            requestor.acceptConstructorReference(
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration

}
private void visitIfNeeded(AbstractMethodDeclaration method) {
  if (this.localDeclarationVisitor != null
    && (method.bits & ASTNode.HasLocalType) != 0) {
      if (method instanceof ConstructorDeclaration) {
        ConstructorDeclaration constructorDeclaration = (ConstructorDeclaration) method;
        if (constructorDeclaration.constructorCall != null) {
          constructorDeclaration.constructorCall.traverse(this.localDeclarationVisitor, method.scope);
        }
      }
      if (method.statements != null) {
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration

    if (this.sourceLength == -1) {
      this.sourceLength = this.rawSource.length;
    }
    switch(this.astKind) {
      case K_STATEMENTS :
        ConstructorDeclaration constructorDeclaration = codeSnippetParsingUtil.parseStatements(
            this.rawSource,
            this.sourceOffset,
            this.sourceLength,
            this.compilerOptions,
            true,
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.