当前位置: 首页>>代码示例>>Java>>正文


Java QualifiedAllocationExpression类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression的典型用法代码示例。如果您正苦于以下问题:Java QualifiedAllocationExpression类的具体用法?Java QualifiedAllocationExpression怎么用?Java QualifiedAllocationExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


QualifiedAllocationExpression类属于org.eclipse.jdt.internal.compiler.ast包,在下文中一共展示了QualifiedAllocationExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
private QualifiedAllocationExpression convert(
    IJavaElement localType, FieldDeclaration enumConstant, CompilationResult compilationResult)
    throws JavaModelException {
  TypeDeclaration anonymousLocalTypeDeclaration =
      convert((SourceType) localType, compilationResult);
  QualifiedAllocationExpression expression =
      new QualifiedAllocationExpression(anonymousLocalTypeDeclaration);
  expression.type = anonymousLocalTypeDeclaration.superclass;
  anonymousLocalTypeDeclaration.superclass = null;
  anonymousLocalTypeDeclaration.superInterfaces = null;
  anonymousLocalTypeDeclaration.allocation = expression;
  if (enumConstant != null) {
    anonymousLocalTypeDeclaration.modifiers &= ~ClassFileConstants.AccEnum;
    expression.enumConstant = enumConstant;
    expression.type = null;
  }
  return expression;
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:SourceTypeConverter.java

示例2: getInterfaceNames

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected char[][] getInterfaceNames(TypeDeclaration typeDeclaration) {
	char[][] interfaceNames = null;
	int superInterfacesLength = 0;
	TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
	if (superInterfaces != null) {
		superInterfacesLength = superInterfaces.length;
		interfaceNames = new char[superInterfacesLength][];
	} else {
		if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
			// see PR 3442
			QualifiedAllocationExpression alloc = typeDeclaration.allocation;
			if (alloc != null && alloc.type != null) {
				superInterfaces = new TypeReference[] { alloc.type};
				superInterfacesLength = 1;
				interfaceNames = new char[1][];
			}
		}
	}
	if (superInterfaces != null) {
		for (int i = 0; i < superInterfacesLength; i++) {
			interfaceNames[i] =
				CharOperation.concatWith(superInterfaces[i].getParameterizedTypeName(), '.');
		}
	}
	return interfaceNames;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:SourceElementNotifier.java

示例3: updatedStatement

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public Statement updatedStatement(int depth, Set knownTypes){

	// ignore closed anonymous type
	if ((this.typeDeclaration.bits & ASTNode.IsAnonymousType) != 0 && !this.preserveContent){
		return null;
	}

	TypeDeclaration updatedType = updatedTypeDeclaration(depth + 1, knownTypes);
	if (updatedType != null && (updatedType.bits & ASTNode.IsAnonymousType) != 0){
		/* in presence of an anonymous type, we want the full allocation expression */
		QualifiedAllocationExpression allocation = updatedType.allocation;

		if (allocation.statementEnd == -1) {
			allocation.statementEnd = updatedType.declarationSourceEnd;
		}
		return allocation;
	}
	return updatedType;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:RecoveredType.java

示例4: consumeClassInstanceCreationExpressionQualified

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeClassInstanceCreationExpressionQualified() {
	// ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
	// ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
	classInstanceCreation(true);

	QualifiedAllocationExpression qae =
		(QualifiedAllocationExpression) this.expressionStack[this.expressionPtr];
	
	if (qae.anonymousType == null) {
		this.expressionLengthPtr--;
		this.expressionPtr--;
		qae.enclosingInstance = this.expressionStack[this.expressionPtr];
		this.expressionStack[this.expressionPtr] = qae;
	}
	qae.sourceStart = qae.enclosingInstance.sourceStart;
	consumeInvocationExpression();
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:Parser.java

示例5: getInterfaceNames

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected char[][] getInterfaceNames(TypeDeclaration typeDeclaration) {
	char[][] interfaceNames = null;
	int superInterfacesLength = 0;
	TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
	if (superInterfaces != null) {
		superInterfacesLength = superInterfaces.length;
		interfaceNames = new char[superInterfacesLength][];
	} else {
		if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
			// see PR 3442
			QualifiedAllocationExpression alloc = typeDeclaration.allocation;
			if (alloc != null && alloc.type != null) {
				superInterfaces = new TypeReference[] { alloc.type};
				superInterfacesLength = 1;
				interfaceNames = new char[1][];
			}
		}
	}
	if (superInterfaces != null) {
		int superInterfaceCount = 0;
		next: for (int i = 0; i < superInterfacesLength; i++) {
			TypeReference superInterface = superInterfaces[i];

			if (superInterface instanceof CompletionOnKeyword) continue next;
			if (CompletionUnitStructureRequestor.hasEmptyName(superInterface, this.assistNode)) continue next;

			interfaceNames[superInterfaceCount++] = CharOperation.concatWith(superInterface.getParameterizedTypeName(), '.');
		}

		if (superInterfaceCount == 0) return null;
		if (superInterfaceCount < superInterfacesLength) {
			System.arraycopy(interfaceNames, 0, interfaceNames = new char[superInterfaceCount][], 0, superInterfaceCount);
		}
	}
	return interfaceNames;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:CompletionElementNotifier.java

示例6: sourceEnd

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
private int sourceEnd(TypeDeclaration typeDeclaration) {
	if ((typeDeclaration.bits & ASTNode.IsAnonymousType) != 0) {
		QualifiedAllocationExpression allocation = typeDeclaration.allocation;
		if (allocation.enumConstant != null) // case of enum constant body
			return allocation.enumConstant.sourceEnd;
		return allocation.type.sourceEnd;
	} else {
		return typeDeclaration.sourceEnd;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:SourceElementNotifier.java

示例7: consumeAllocationHeader

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeAllocationHeader() {
	// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt

	// ClassBodyopt produces a null item on the astStak if it produces NO class body
	// An empty class body produces a 0 on the length stack.....

	if (this.currentElement == null){
		return; // should never occur, this consumeRule is only used in recovery mode
	}
	if (this.currentToken == TokenNameLBRACE){
		// beginning of an anonymous type
		TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
		anonymousType.name = CharOperation.NO_CHAR;
		anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);
		anonymousType.sourceStart = this.intStack[this.intPtr--];
		anonymousType.declarationSourceStart = anonymousType.sourceStart;
		anonymousType.sourceEnd = this.rParenPos; // closing parenthesis
		QualifiedAllocationExpression alloc = new QualifiedAllocationExpression(anonymousType);
		alloc.type = getTypeReference(0);
		alloc.sourceStart = anonymousType.sourceStart;
		alloc.sourceEnd = anonymousType.sourceEnd ;
		this.lastCheckPoint = anonymousType.bodyStart = this.scanner.currentPosition;
		this.currentElement = this.currentElement.add(anonymousType, 0);
		this.lastIgnoredToken = -1;
		if (!isIndirectlyInsideLambdaExpression())
			this.currentToken = 0; // opening brace already taken into account
		return;
	}
	this.lastCheckPoint = this.scanner.startPosition; // force to restart at this exact position
	this.restartRecovery = true; // request to restart from here on
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:Parser.java

示例8: missingTypeInConstructor

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public void missingTypeInConstructor(ASTNode location, MethodBinding constructor) {
	List missingTypes = constructor.collectMissingTypes(null);
	if (missingTypes == null) {
		System.err.println("The constructor " + constructor + " is wrongly tagged as containing missing types"); //$NON-NLS-1$ //$NON-NLS-2$
		return;
	}
	TypeBinding missingType = (TypeBinding) missingTypes.get(0);
	int start = location.sourceStart;
	int end = location.sourceEnd;
	if (location instanceof QualifiedAllocationExpression) {
		QualifiedAllocationExpression qualifiedAllocation = (QualifiedAllocationExpression) location;
		if (qualifiedAllocation.anonymousType != null) {
			start = qualifiedAllocation.anonymousType.sourceStart;
			end = qualifiedAllocation.anonymousType.sourceEnd;
		}
	}
	this.handle(
			IProblem.MissingTypeInConstructor,
			new String[] {
			        new String(constructor.declaringClass.readableName()),
			        typesAsString(constructor, false),
			       	new String(missingType.readableName()),
			},
			new String[] {
			        new String(constructor.declaringClass.shortReadableName()),
			        typesAsString(constructor, true),
			       	new String(missingType.shortReadableName()),
			},
			start,
			end);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ProblemReporter.java

示例9: endVisit

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
@Override
public void endVisit(QualifiedAllocationExpression x, BlockScope scope) {
  try {
    SourceInfo info = makeSourceInfo(x);
    List<JExpression> arguments = popCallArgs(info, x.arguments, x.binding);
    pushNewExpression(info, x, x.enclosingInstance(), arguments, scope);
  } catch (Throwable e) {
    throw translateException(x, e);
  }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:11,代码来源:GwtAstBuilder.java

示例10: visit

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
@Override public boolean visit(QualifiedAllocationExpression node, BlockScope scope) {
	fixPositions(setGeneratedBy(node, source));
	return super.visit(node, scope);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:SetGeneratedByVisitor.java

示例11: classInstanceCreation

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void classInstanceCreation(boolean hasClassBody) {

	// ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt

	// ClassBodyopt produces a null item on the astStak if it produces NO class body
	// An empty class body produces a 0 on the length stack.....


	if ((this.astLengthStack[this.astLengthPtr] == 1)
		&& (this.astStack[this.astPtr] == null)) {


		int index;
		if ((index = this.indexOfAssistIdentifier()) < 0) {
			super.classInstanceCreation(hasClassBody);
			return;
		} else if(this.identifierLengthPtr > -1 &&
					(this.identifierLengthStack[this.identifierLengthPtr] - 1) != index) {
			super.classInstanceCreation(hasClassBody);
			return;
		}
		QualifiedAllocationExpression alloc;
		this.astPtr--;
		this.astLengthPtr--;
		alloc = new SelectionOnQualifiedAllocationExpression();
		alloc.sourceEnd = this.endPosition; //the position has been stored explicitly

		int length;
		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
			this.expressionPtr -= length;
			System.arraycopy(
				this.expressionStack,
				this.expressionPtr + 1,
				alloc.arguments = new Expression[length],
				0,
				length);
		}
		// trick to avoid creating a selection on type reference
		char [] oldIdent = assistIdentifier();
		setAssistIdentifier(null);
		alloc.type = getTypeReference(0);
		checkForDiamond(alloc.type);

		setAssistIdentifier(oldIdent);

		//the default constructor with the correct number of argument
		//will be created and added by the TC (see createsInternalConstructorWithBinding)
		alloc.sourceStart = this.intStack[this.intPtr--];
		pushOnExpressionStack(alloc);

		this.assistNode = alloc;
		this.lastCheckPoint = alloc.sourceEnd + 1;
		if (!this.diet){
			this.restartRecovery	= true;	// force to restart in recovery mode
			this.lastIgnoredToken = -1;
		}
		this.isOrphanCompletionNode = true;
	} else {
		super.classInstanceCreation(hasClassBody);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:SelectionParser.java

示例12: consumeClassInstanceCreationExpressionQualifiedWithTypeArguments

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() {
	// ClassInstanceCreationExpression ::= Primary '.' 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt
	// ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' TypeArguments SimpleName '(' ArgumentListopt ')' ClassBodyopt

	QualifiedAllocationExpression alloc;
	int length;
	if (((length = this.astLengthStack[this.astLengthPtr]) == 1) && (this.astStack[this.astPtr] == null)) {

		if (this.indexOfAssistIdentifier() < 0) {
			super.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments();
			return;
		}

		//NO ClassBody
		this.astPtr--;
		this.astLengthPtr--;
		alloc = new SelectionOnQualifiedAllocationExpression();
		alloc.sourceEnd = this.endPosition; //the position has been stored explicitly

		if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
			this.expressionPtr -= length;
			System.arraycopy(
				this.expressionStack,
				this.expressionPtr + 1,
				alloc.arguments = new Expression[length],
				0,
				length);
		}

		// trick to avoid creating a selection on type reference
		char [] oldIdent = assistIdentifier();
		setAssistIdentifier(null);
		alloc.type = getTypeReference(0);
		checkForDiamond(alloc.type);

		setAssistIdentifier(oldIdent);

		length = this.genericsLengthStack[this.genericsLengthPtr--];
		this.genericsPtr -= length;
		System.arraycopy(this.genericsStack, this.genericsPtr + 1, alloc.typeArguments = new TypeReference[length], 0, length);
		this.intPtr--; // remove the position of the '<'

		//the default constructor with the correct number of argument
		//will be created and added by the TC (see createsInternalConstructorWithBinding)
		alloc.sourceStart = this.intStack[this.intPtr--];
		pushOnExpressionStack(alloc);

		this.assistNode = alloc;
		this.lastCheckPoint = alloc.sourceEnd + 1;
		if (!this.diet){
			this.restartRecovery	= true;	// force to restart in recovery mode
			this.lastIgnoredToken = -1;
		}
		this.isOrphanCompletionNode = true;
	} else {
		super.consumeClassInstanceCreationExpressionQualifiedWithTypeArguments();
	}

	this.expressionLengthPtr--;
	QualifiedAllocationExpression qae =
		(QualifiedAllocationExpression) this.expressionStack[this.expressionPtr--];
	qae.enclosingInstance = this.expressionStack[this.expressionPtr];
	this.expressionStack[this.expressionPtr] = qae;
	qae.sourceStart = qae.enclosingInstance.sourceStart;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:66,代码来源:SelectionParser.java

示例13: consumeEnterAnonymousClassBody

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
protected void consumeEnterAnonymousClassBody(boolean qualified) {
	// EnterAnonymousClassBody ::= $empty

	if (this.indexOfAssistIdentifier() < 0) {
		super.consumeEnterAnonymousClassBody(qualified);
		return;
	}

	// trick to avoid creating a selection on type reference
	char [] oldIdent = assistIdentifier();
	setAssistIdentifier(null);
	TypeReference typeReference = getTypeReference(0);
	setAssistIdentifier(oldIdent);

	TypeDeclaration anonymousType = new TypeDeclaration(this.compilationUnit.compilationResult);
	anonymousType.name = CharOperation.NO_CHAR;
	anonymousType.bits |= (ASTNode.IsAnonymousType|ASTNode.IsLocalType);
	QualifiedAllocationExpression alloc = new SelectionOnQualifiedAllocationExpression(anonymousType);
	markEnclosingMemberWithLocalType();
	pushOnAstStack(anonymousType);

	alloc.sourceEnd = this.rParenPos; //the position has been stored explicitly
	int argumentLength;
	if ((argumentLength = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) {
		this.expressionPtr -= argumentLength;
		System.arraycopy(
			this.expressionStack,
			this.expressionPtr + 1,
			alloc.arguments = new Expression[argumentLength],
			0,
			argumentLength);
	}
	
	if (qualified) {
		this.expressionLengthPtr--;
		alloc.enclosingInstance = this.expressionStack[this.expressionPtr--];
	}

	alloc.type = typeReference;

	anonymousType.sourceEnd = alloc.sourceEnd;
	//position at the type while it impacts the anonymous declaration
	anonymousType.sourceStart = anonymousType.declarationSourceStart = alloc.type.sourceStart;
	alloc.sourceStart = this.intStack[this.intPtr--];
	pushOnExpressionStack(alloc);

	this.assistNode = alloc;
	this.lastCheckPoint = alloc.sourceEnd + 1;
	if (!this.diet){
		this.restartRecovery	= true;	// force to restart in recovery mode
		this.lastIgnoredToken = -1;
		if (!isIndirectlyInsideLambdaExpression())
			this.currentToken = 0; // opening brace already taken into account
		this.hasReportedError = true;
	}

	anonymousType.bodyStart = this.scanner.currentPosition;
	this.listLength = 0; // will be updated when reading super-interfaces
	// recovery
	if (this.currentElement != null){
		this.lastCheckPoint = anonymousType.bodyStart;
		this.currentElement = this.currentElement.add(anonymousType, 0);
		if (!isIndirectlyInsideLambdaExpression())
			this.currentToken = 0; // opening brace already taken into account
		this.lastIgnoredToken = -1;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:68,代码来源:SelectionParser.java

示例14: visit

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public boolean visit(
	QualifiedAllocationExpression qualifiedAllocationExpression,
	BlockScope scope) {
		addRealFragment(qualifiedAllocationExpression);
		return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:BinaryExpressionFragmentBuilder.java

示例15: visit

import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression; //导入依赖的package包/类
public boolean visit(FieldDeclaration enumConstant, MethodScope scope) {
       /*
        * Print comments to get proper line number
        */
       this.scribe.printComment();
       final int line = this.scribe.line;
       this.scribe.printModifiers(enumConstant.annotations, this, ICodeFormatterConstants.ANNOTATION_ON_FIELD);
	this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier, false);
	formatEnumConstantArguments(
		enumConstant,
		this.preferences.insert_space_before_opening_paren_in_enum_constant,
		this.preferences.insert_space_between_empty_parens_in_enum_constant,
		this.preferences.insert_space_before_closing_paren_in_enum_constant,
		this.preferences.insert_space_after_opening_paren_in_enum_constant,
		this.preferences.insert_space_before_comma_in_enum_constant_arguments,
		this.preferences.insert_space_after_comma_in_enum_constant_arguments,
		this.preferences.alignment_for_arguments_in_enum_constant);

	Expression initialization = enumConstant.initialization;
	if (initialization instanceof QualifiedAllocationExpression) {
		TypeDeclaration typeDeclaration = ((QualifiedAllocationExpression) initialization).anonymousType;
		int fieldsCount = typeDeclaration.fields == null ? 0 : typeDeclaration.fields.length;
		int methodsCount = typeDeclaration.methods == null ? 0 : typeDeclaration.methods.length;
		int membersCount = typeDeclaration.memberTypes == null ? 0 : typeDeclaration.memberTypes.length;

		/*
		 * Type body
		 */
		String enum_constant_brace = this.preferences.brace_position_for_enum_constant;

		formatLeftCurlyBrace(line, enum_constant_brace);
		formatTypeOpeningBraceForEnumConstant(enum_constant_brace, this.preferences.insert_space_before_opening_brace_in_enum_constant, typeDeclaration);

		if (this.preferences.indent_body_declarations_compare_to_enum_constant_header) {
			this.scribe.indent();
		}

		if (fieldsCount != 0 || methodsCount != 0 || membersCount != 0) {
			formatTypeMembers(typeDeclaration);
		}

		if (this.preferences.indent_body_declarations_compare_to_enum_constant_header) {
			this.scribe.unIndent();
		}

		if (this.preferences.insert_new_line_in_empty_enum_constant) {
			this.scribe.printNewLine();
		}
		this.scribe.printNextToken(TerminalTokens.TokenNameRBRACE);
		this.scribe.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
		if (enum_constant_brace.equals(DefaultCodeFormatterConstants.NEXT_LINE_SHIFTED)) {
			this.scribe.unIndent();
		}
		if (hasComments()) {
			this.scribe.printNewLine();
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:60,代码来源:CodeFormatterVisitor.java


注:本文中的org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。