• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Initializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildTree

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected EclipseNode buildTree(ASTNode node, Kind kind) {
	switch (kind) {
	case COMPILATION_UNIT:
		return buildCompilationUnit((CompilationUnitDeclaration) node);
	case TYPE:
		return buildType((TypeDeclaration) node);
	case FIELD:
		return buildField((FieldDeclaration) node);
	case INITIALIZER:
		return buildInitializer((Initializer) node);
	case METHOD:
		return buildMethod((AbstractMethodDeclaration) node);
	case ARGUMENT:
		return buildLocal((Argument) node, kind);
	case LOCAL:
		return buildLocal((LocalDeclaration) node, kind);
	case STATEMENT:
		return buildStatement((Statement) node);
	case ANNOTATION:
		return buildAnnotation((Annotation) node, false);
	default:
		throw new AssertionError("Did not expect to arrive here: " + kind);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:26,代码来源:EclipseAST.java


示例2: getEnclosingDeclaration

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private ASTNode getEnclosingDeclaration() {
	int i = this.parentsPtr;
	while (i > -1) {
		ASTNode parent = this.parents[i];
		if (parent instanceof AbstractMethodDeclaration) {
			return parent;
		} else if (parent instanceof Initializer) {
			return parent;
		} else if (parent instanceof FieldDeclaration) {
			return parent;
		} else if (parent instanceof TypeDeclaration) {
			return parent;
		}
		i--;
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:UnresolvedReferenceNameFinder.java


示例3: add

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public RecoveredElement add(LocalDeclaration localDeclaration, int bracketBalanceValue) {

	/* do not consider a type starting passed the type end (if set)
		it must be belonging to an enclosing type */
	if (this.fieldDeclaration.declarationSourceEnd != 0
			&& localDeclaration.declarationSourceStart > this.fieldDeclaration.declarationSourceEnd){
		resetPendingModifiers();
		if (this.parent == null) return this; // ignore
		return this.parent.add(localDeclaration, bracketBalanceValue);
	}
	/* method body should have been created */
	Block block = new Block(0);
	block.sourceStart = ((Initializer)this.fieldDeclaration).sourceStart;
	RecoveredElement element = this.add(block, 1);
	if (this.initializerBody != null) {
		this.initializerBody.attachPendingModifiers(
				this.pendingAnnotations,
				this.pendingAnnotationCount,
				this.pendingModifiers,
				this.pendingModifersSourceStart);
	}
	resetPendingModifiers();
	return element.add(localDeclaration, bracketBalanceValue);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:RecoveredInitializer.java


示例4: updatedFieldDeclaration

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

	if (this.initializerBody != null){
		Block block = this.initializerBody.updatedBlock(depth, knownTypes);
		if (block != null){
			Initializer initializer = (Initializer) this.fieldDeclaration;
			initializer.block = block;

			if (initializer.declarationSourceEnd == 0) {
				initializer.declarationSourceEnd = block.sourceEnd;
				initializer.bodyEnd = block.sourceEnd;
			}
		}
		if (this.localTypeCount > 0) this.fieldDeclaration.bits |= ASTNode.HasLocalType;

	}
	if (this.fieldDeclaration.sourceEnd == 0){
		this.fieldDeclaration.sourceEnd = this.fieldDeclaration.declarationSourceEnd;
	}
	return this.fieldDeclaration;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:RecoveredInitializer.java


示例5: updateSourceEndIfNecessary

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public void updateSourceEndIfNecessary(int braceStart, int braceEnd){
	if (this.fieldDeclaration.declarationSourceEnd == 0) {
		Initializer initializer = (Initializer)this.fieldDeclaration;
		if(parser().rBraceSuccessorStart >= braceEnd) {
			if (initializer.bodyStart < parser().rBraceEnd) {
				initializer.declarationSourceEnd = parser().rBraceEnd;
			} else {
				initializer.declarationSourceEnd = initializer.bodyStart;
			}
			if (initializer.bodyStart < parser().rBraceStart) {
				initializer.bodyEnd = parser().rBraceStart;
			} else {
				initializer.bodyEnd = initializer.bodyStart;
			}
		} else {
			initializer.declarationSourceEnd = braceEnd;
			initializer.bodyEnd  = braceStart - 1;
		}
		if(initializer.block != null) {
			initializer.block.sourceEnd = initializer.declarationSourceEnd;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:RecoveredInitializer.java


示例6: consumeClassBodyDeclaration

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
protected void consumeClassBodyDeclaration() {
	// ClassBodyDeclaration ::= Diet NestedMethod CreateInitializer Block
	//push an Initializer
	//optimize the push/pop
	this.nestedMethod[this.nestedType]--;
	Block block = (Block) this.astStack[this.astPtr--];
	this.astLengthPtr--;
	if (this.diet) block.bits &= ~ASTNode.UndocumentedEmptyBlock; // clear bit since was diet
	Initializer initializer = (Initializer) this.astStack[this.astPtr];
	initializer.declarationSourceStart = initializer.sourceStart = block.sourceStart;
	initializer.block = block;
	this.intPtr--; // pop sourcestart left on the stack by consumeNestedMethod.
	initializer.bodyStart = this.intStack[this.intPtr--];
	this.realBlockPtr--; // pop the block variable counter left on the stack by consumeNestedMethod
	int javadocCommentStart = this.intStack[this.intPtr--];
	if (javadocCommentStart != -1) {
		initializer.declarationSourceStart = javadocCommentStart;
		initializer.javadoc = this.javadoc;
		this.javadoc = null;
	}
	initializer.bodyEnd = this.endPosition;
	initializer.sourceEnd = this.endStatementPosition;
	initializer.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:Parser.java


示例7: consumeStaticInitializer

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
protected void consumeStaticInitializer() {
	// StaticInitializer ::=  StaticOnly Block
	//push an Initializer
	//optimize the push/pop
	Block block = (Block) this.astStack[this.astPtr];
	if (this.diet) block.bits &= ~ASTNode.UndocumentedEmptyBlock; // clear bit set since was diet
	Initializer initializer = new Initializer(block, ClassFileConstants.AccStatic);
	this.astStack[this.astPtr] = initializer;
	initializer.sourceEnd = this.endStatementPosition;
	initializer.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition);
	this.nestedMethod[this.nestedType] --;
	initializer.declarationSourceStart = this.intStack[this.intPtr--];
	initializer.bodyStart = this.intStack[this.intPtr--];
	initializer.bodyEnd = this.endPosition;
	// doc comment
	initializer.javadoc = this.javadoc;
	this.javadoc = null;

	// recovery
	if (this.currentElement != null){
		this.lastCheckPoint = initializer.declarationSourceEnd;
		this.currentElement = this.currentElement.add(initializer, 0);
		this.lastIgnoredToken = -1;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:Parser.java


示例8: createField

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private void createField(FieldDeclaration x) {
  if (x instanceof Initializer) {
    return;
  }
  SourceInfo info = makeSourceInfo(x);
  FieldBinding binding = x.binding;
  JType type = typeMap.get(binding.type);
  JDeclaredType enclosingType = (JDeclaredType) typeMap.get(binding.declaringClass);

  JField field;
  if (x.initialization != null && x.initialization instanceof AllocationExpression
      && ((AllocationExpression) x.initialization).enumConstant != null) {
    field =
        new JEnumField(info, intern(binding.name), binding.original().id,
            (JEnumType) enclosingType, (JClassType) type);
  } else {
    field =
        new JField(info, intern(binding.name), enclosingType, type, binding.isStatic(),
            getFieldDisposition(binding));
  }
  enclosingType.addField(field);
  typeMap.setField(binding, field);
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:24,代码来源:GwtAstBuilder.java


示例9: visitInitializer

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public void visitInitializer(EclipseNode node, Initializer initializer) {
	Block block = initializer.block;
	boolean s = (block != null && block.statements != null);
	print("<%s INITIALIZER: %s%s%s>",
			(initializer.modifiers & Modifier.STATIC) != 0 ? "static" : "instance",
					s ? "filled" : "blank",
					isGenerated(initializer) ? " (GENERATED)" : "", position(node));
	indent++;
	if (printContent) {
		if (initializer.block != null) print("%s", initializer.block);
		disablePrinting++;
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:EclipseASTVisitor.java


示例10: buildField

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private EclipseNode buildField(FieldDeclaration field) {
	if (field instanceof Initializer) return buildInitializer((Initializer)field);
	if (setAndGetAsHandled(field)) return null;
	List<EclipseNode> childNodes = new ArrayList<EclipseNode>();
	addIfNotNull(childNodes, buildStatement(field.initialization));
	childNodes.addAll(buildAnnotations(field.annotations, true));
	return putInMap(new EclipseNode(this, field, childNodes, Kind.FIELD));
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:9,代码来源:EclipseAST.java


示例11: fixPositions

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private void fixPositions(Initializer node) {
	node.sourceEnd = sourceEnd;
	node.sourceStart = sourceStart;
	node.declarationEnd = sourceEnd;
	node.declarationSourceEnd = sourceEnd;
	node.declarationSourceStart = sourceStart;
	node.modifiersSourceStart = sourceStart;
	node.endPart1Position = sourceEnd;
	node.endPart2Position = sourceEnd;
	node.bodyStart = sourceStart;
	node.bodyEnd = sourceEnd;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:13,代码来源:SetGeneratedByVisitor.java


示例12: convert

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private Initializer convert(
    InitializerElementInfo initializerInfo, CompilationResult compilationResult)
    throws JavaModelException {

  Block block = new Block(0);
  Initializer initializer = new Initializer(block, ClassFileConstants.AccDefault);

  int start = initializerInfo.getDeclarationSourceStart();
  int end = initializerInfo.getDeclarationSourceEnd();

  initializer.sourceStart = initializer.declarationSourceStart = start;
  initializer.sourceEnd = initializer.declarationSourceEnd = end;
  initializer.modifiers = initializerInfo.getModifiers();

  /* convert local and anonymous types */
  IJavaElement[] children = initializerInfo.getChildren();
  int typesLength = children.length;
  if (typesLength > 0) {
    Statement[] statements = new Statement[typesLength];
    for (int i = 0; i < typesLength; i++) {
      SourceType type = (SourceType) children[i];
      TypeDeclaration localType = convert(type, compilationResult);
      if ((localType.bits & ASTNode.IsAnonymousType) != 0) {
        QualifiedAllocationExpression expression = new QualifiedAllocationExpression(localType);
        expression.type = localType.superclass;
        localType.superclass = null;
        localType.superInterfaces = null;
        localType.allocation = expression;
        statements[i] = expression;
      } else {
        statements[i] = localType;
      }
    }
    block.statements = statements;
  }

  return initializer;
}
 
开发者ID:eclipse,项目名称:che,代码行数:39,代码来源:SourceTypeConverter.java


示例13: find

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public void find(
		char[] startWith,
		Initializer initializer,
		ClassScope scope,
		int from,
		char[][] discouragedNames,
		UnresolvedReferenceNameRequestor nameRequestor) {
	MethodDeclaration fakeMethod =
		this.findAfter(startWith, scope, from, initializer.bodyEnd, MAX_LINE_COUNT, false, discouragedNames, nameRequestor);
	if (fakeMethod != null) fakeMethod.traverse(this, scope);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:UnresolvedReferenceNameFinder.java


示例14: visit

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.Initializer, org.eclipse.jdt.internal.compiler.lookup.MethodScope)
 */
public boolean visit(Initializer initializer, MethodScope scope) {

	if (initializer.isStatic()) {
		this.scribe.printNextToken(TerminalTokens.TokenNamestatic);
	}
	initializer.block.traverse(this, scope);
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:CodeFormatterVisitor.java


示例15: convert

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private Initializer convert(InitializerElementInfo initializerInfo, CompilationResult compilationResult) throws JavaModelException {

		Block block = new Block(0);
		Initializer initializer = new Initializer(block, ClassFileConstants.AccDefault);

		int start = initializerInfo.getDeclarationSourceStart();
		int end = initializerInfo.getDeclarationSourceEnd();

		initializer.sourceStart = initializer.declarationSourceStart = start;
		initializer.sourceEnd = initializer.declarationSourceEnd = end;
		initializer.modifiers = initializerInfo.getModifiers();

		/* convert local and anonymous types */
		IJavaElement[] children = initializerInfo.getChildren();
		int typesLength = children.length;
		if (typesLength > 0) {
			Statement[] statements = new Statement[typesLength];
			for (int i = 0; i < typesLength; i++) {
				SourceType type = (SourceType) children[i];
				TypeDeclaration localType = convert(type, compilationResult);
				if ((localType.bits & ASTNode.IsAnonymousType) != 0) {
					QualifiedAllocationExpression expression = new QualifiedAllocationExpression(localType);
					expression.type = localType.superclass;
					localType.superclass = null;
					localType.superInterfaces = null;
					localType.allocation = expression;
					statements[i] = expression;
				} else {
					statements[i] = localType;
				}
			}
			block.statements = statements;
		}

		return initializer;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:SourceTypeConverter.java


示例16: visitIfNeeded

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
private void visitIfNeeded(Initializer initializer) {
	if (this.localDeclarationVisitor != null
		&& (initializer.bits & ASTNode.HasLocalType) != 0) {
			if (initializer.block != null) {
				initializer.block.traverse(this.localDeclarationVisitor, null);
			}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:SourceElementNotifier.java


示例17: visit

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public boolean visit(Initializer initializer, MethodScope scope) {
	if (initializer.declarationSourceStart <= this.position
		&& this.position <= initializer.declarationSourceEnd) {
			this.found = initializer;
			return false;
	}
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:NodeSearcher.java


示例18: getDeclaringMethod

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public IMethodBinding getDeclaringMethod() {
	if (!isField()) {
		ASTNode node = this.resolver.findDeclaringNode(this);
		while (true) {
			if (node == null) {
				if (this.binding instanceof LocalVariableBinding) {
					LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding;
					BlockScope blockScope = localVariableBinding.declaringScope;
					if (blockScope != null) {
						ReferenceContext referenceContext = blockScope.referenceContext();
						if (referenceContext instanceof Initializer) {
							return null;
						}
						if (referenceContext instanceof AbstractMethodDeclaration) {
							return this.resolver.getMethodBinding(((AbstractMethodDeclaration) referenceContext).binding);
						}
					}
				}
				return null;
			}
			switch(node.getNodeType()) {
				case ASTNode.INITIALIZER :
					return null;
				case ASTNode.METHOD_DECLARATION :
					MethodDeclaration methodDeclaration = (MethodDeclaration) node;
					return methodDeclaration.resolveBinding();
				default:
					node = node.getParent();
			}
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:VariableBinding.java


示例19: add

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public RecoveredElement add(AbstractMethodDeclaration methodDeclaration, int bracketBalanceValue) {

	/* attach it to last type - if any */
	if (this.typeCount > 0){
		RecoveredType type = this.types[this.typeCount -1];
		int start = type.bodyEnd;
		int end = type.typeDeclaration.bodyEnd;
		type.bodyEnd = 0; // reset position
		type.typeDeclaration.declarationSourceEnd = 0; // reset position
		type.typeDeclaration.bodyEnd = 0;

		int kind = TypeDeclaration.kind(type.typeDeclaration.modifiers);
		if(start > 0 &&
				start < end &&
				kind != TypeDeclaration.INTERFACE_DECL &&
				kind != TypeDeclaration.ANNOTATION_TYPE_DECL) {
			// the } of the last type can be considered as the end of an initializer
			Initializer initializer = new Initializer(new Block(0), 0);
			initializer.bodyStart = end;
			initializer.bodyEnd = end;
			initializer.declarationSourceStart = end;
			initializer.declarationSourceEnd = end;
			initializer.sourceStart = end;
			initializer.sourceEnd = end;
			type.add(initializer, bracketBalanceValue);
		}

		resetPendingModifiers();

		return type.add(methodDeclaration, bracketBalanceValue);
	}
	return this; // ignore
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:RecoveredUnit.java


示例20: add

import org.eclipse.jdt.internal.compiler.ast.Initializer; //导入依赖的package包/类
public RecoveredElement add(Block nestedBlockDeclaration,int bracketBalanceValue) {
	this.pendingTypeParameters = null;
	resetPendingModifiers();

	int mods = ClassFileConstants.AccDefault;
	if(parser().recoveredStaticInitializerStart != 0) {
		mods = ClassFileConstants.AccStatic;
	}
	return this.add(new Initializer(nestedBlockDeclaration, mods), bracketBalanceValue);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:RecoveredType.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProcessManifest类代码示例发布时间:2022-05-23
下一篇:
Java JVMDebugger类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap