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

Java FieldReference类代码示例

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

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



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

示例1: getFirstParameterType

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
static TypeBinding getFirstParameterType(TypeDeclaration decl, CompletionProposalCollector completionProposalCollector) {
		TypeBinding firstParameterType = null;
		ASTNode node = getAssistNode(completionProposalCollector);
		if (node == null) return null;
		if (!(node instanceof CompletionOnQualifiedNameReference) && !(node instanceof CompletionOnSingleNameReference) && !(node instanceof CompletionOnMemberAccess)) return null;
		
		// Never offer on 'super.<autocomplete>'.
		if (node instanceof FieldReference && ((FieldReference)node).receiver instanceof SuperReference) return null;
		
		if (node instanceof NameReference) {
			Binding binding = ((NameReference) node).binding;
			// Unremark next block to allow a 'blank' autocomplete to list any extensions that apply to the current scope, but make sure we're not in a static context first, which this doesn't do.
			// Lacking good use cases, and having this particular concept be a little tricky on javac, means for now we don't support extension methods like this. this.X() will be fine, though.
			
/*			if ((node instanceof SingleNameReference) && (((SingleNameReference) node).token.length == 0)) {
				firstParameterType = decl.binding;
			} else */if (binding instanceof VariableBinding) {
				firstParameterType = ((VariableBinding) binding).type;
			}
		} else if (node instanceof FieldReference) {
			firstParameterType = ((FieldReference) node).actualReceiverType;
		}
		return firstParameterType;
	}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:25,代码来源:PatchExtensionMethodCompletionProposal.java


示例2: generateCleanMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
private MethodDeclaration generateCleanMethod(List<BuilderFieldData> builderFields, EclipseNode builderType, ASTNode source) {
	List<Statement> statements = new ArrayList<Statement>();
	
	for (BuilderFieldData bfd : builderFields) {
		if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) {
			bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, builderType, statements);
		}
	}
	
	FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0);
	thisUnclean.receiver = new ThisReference(0, 0);
	statements.add(new Assignment(thisUnclean, new FalseLiteral(0, 0), 0));
	MethodDeclaration decl = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	decl.selector = CLEAN_METHOD_NAME;
	decl.modifiers = ClassFileConstants.AccPrivate;
	decl.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	decl.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
	decl.statements = statements.toArray(new Statement[0]);
	decl.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return decl;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:22,代码来源:HandleBuilder.java


示例3: getSize

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
/** Generates 'this.<em>name</em>.size()' as an expression; if nullGuard is true, it's this.name == null ? 0 : this.name.size(). */
protected Expression getSize(EclipseNode builderType, char[] name, boolean nullGuard) {
	MessageSend invoke = new MessageSend();
	ThisReference thisRef = new ThisReference(0, 0);
	FieldReference thisDotName = new FieldReference(name, 0L);
	thisDotName.receiver = thisRef;
	invoke.receiver = thisDotName;
	invoke.selector = SIZE_TEXT;
	if (!nullGuard) return invoke;
	
	ThisReference cdnThisRef = new ThisReference(0, 0);
	FieldReference cdnThisDotName = new FieldReference(name, 0L);
	cdnThisDotName.receiver = cdnThisRef;
	NullLiteral nullLiteral = new NullLiteral(0, 0);
	EqualExpression isNull = new EqualExpression(cdnThisDotName, nullLiteral, OperatorIds.EQUAL_EQUAL);
	IntLiteral zeroLiteral = makeIntLiteral(new char[] {'0'}, null);
	ConditionalExpression conditional = new ConditionalExpression(isNull, zeroLiteral, invoke);
	return conditional;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:20,代码来源:EclipseSingularsRecipes.java


示例4: generateClearMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
private void generateClearMethod(TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType) {
	MethodDeclaration md = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	md.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	md.modifiers = ClassFileConstants.AccPublic;
	
	FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	FieldReference thisDotField2 = new FieldReference(data.getPluralName(), 0L);
	thisDotField2.receiver = new ThisReference(0, 0);
	md.selector = HandlerUtil.buildAccessorName("clear", new String(data.getPluralName())).toCharArray();
	MessageSend clearMsg = new MessageSend();
	clearMsg.receiver = thisDotField2;
	clearMsg.selector = "clear".toCharArray();
	Statement clearStatement = new IfStatement(new EqualExpression(thisDotField, new NullLiteral(0, 0), OperatorIds.NOT_EQUAL), clearMsg, 0, 0);
	md.statements = returnStatement != null ? new Statement[] {clearStatement, returnStatement} : new Statement[] {clearStatement};
	md.returnType = returnType;
	injectMethod(builderType, md);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:19,代码来源:EclipseJavaUtilListSetSingularizer.java


示例5: visit

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

	final int numberOfParens = (fieldReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
	if (numberOfParens > 0) {
		manageOpeningParenthesizedExpression(fieldReference, numberOfParens);
	}
	fieldReference.receiver.traverse(this, scope);
	this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
	this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier);

	if (numberOfParens > 0) {
		manageClosingParenthesizedExpression(fieldReference, numberOfParens);
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CodeFormatterVisitor.java


示例6: consumeFieldAccess

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
protected void consumeFieldAccess(boolean isSuperAccess) {
	// FieldAccess ::= Primary '.' 'Identifier'
	// FieldAccess ::= 'super' '.' 'Identifier'

	FieldReference fr =
		new FieldReference(
			this.identifierStack[this.identifierPtr],
			this.identifierPositionStack[this.identifierPtr--]);
	this.identifierLengthPtr--;
	if (isSuperAccess) {
		//considers the fieldReference beginning at the 'super' ....
		fr.sourceStart = this.intStack[this.intPtr--];
		fr.receiver = new SuperReference(fr.sourceStart, this.endPosition);
		pushOnExpressionStack(fr);
	} else {
		//optimize push/pop
		fr.receiver = this.expressionStack[this.expressionPtr];
		//field reference begins at the receiver
		fr.sourceStart = fr.receiver.sourceStart;
		this.expressionStack[this.expressionPtr] = fr;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:Parser.java


示例7: get

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
public Expression get(final ASTNode source, char[] name) {
	FieldReference fieldRef = new FieldReference(name, pos(source));
	setGeneratedBy(fieldRef, source);
	fieldRef.receiver = new ThisReference(source.sourceStart, source.sourceEnd);
	setGeneratedBy(fieldRef.receiver, source);
	return fieldRef;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:8,代码来源:PatchDelegate.java


示例8: createFieldAccessor

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
static Expression createFieldAccessor(EclipseNode field, FieldAccess fieldAccess, ASTNode source) {
	int pS = source == null ? 0 : source.sourceStart, pE = source == null ? 0 : source.sourceEnd;
	long p = (long)pS << 32 | pE;
	
	boolean lookForGetter = lookForGetter(field, fieldAccess);
	
	GetterMethod getter = lookForGetter ? findGetter(field) : null;
	
	if (getter == null) {
		FieldDeclaration fieldDecl = (FieldDeclaration)field.get();
		FieldReference ref = new FieldReference(fieldDecl.name, p);
		if ((fieldDecl.modifiers & ClassFileConstants.AccStatic) != 0) {
			EclipseNode containerNode = field.up();
			if (containerNode != null && containerNode.get() instanceof TypeDeclaration) {
				ref.receiver = new SingleNameReference(((TypeDeclaration)containerNode.get()).name, p);
			} else {
				Expression smallRef = new FieldReference(field.getName().toCharArray(), p);
				if (source != null) setGeneratedBy(smallRef, source);
				return smallRef;
			}
		} else {
			ref.receiver = new ThisReference(pS, pE);
		}
		
		if (source != null) {
			setGeneratedBy(ref, source);
			setGeneratedBy(ref.receiver, source);
		}
		return ref;
	}
	
	MessageSend call = new MessageSend();
	setGeneratedBy(call, source);
	call.sourceStart = pS; call.statementEnd = call.sourceEnd = pE;
	call.receiver = new ThisReference(pS, pE);
	setGeneratedBy(call.receiver, source);
	call.selector = getter.name;
	return call;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:40,代码来源:EclipseHandlerUtil.java


示例9: generateClearMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
void generateClearMethod(TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType) {
	MethodDeclaration md = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	md.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	md.modifiers = ClassFileConstants.AccPublic;
	
	FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	Assignment a = new Assignment(thisDotField, new NullLiteral(0, 0), 0);
	md.selector = HandlerUtil.buildAccessorName("clear", new String(data.getPluralName())).toCharArray();
	md.statements = returnStatement != null ? new Statement[] {a, returnStatement} : new Statement[] {a};
	md.returnType = returnType;
	injectMethod(builderType, md);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:EclipseGuavaSingularizer.java


示例10: generateSingularMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
void generateSingularMethod(TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType, boolean fluent) {
	LombokImmutableList<String> suffixes = getArgumentSuffixes();
	char[][] names = new char[suffixes.size()][];
	for (int i = 0; i < suffixes.size(); i++) {
		String s = suffixes.get(i);
		char[] n = data.getSingularName();
		names[i] = s.isEmpty() ? n : s.toCharArray();
	}
	
	MethodDeclaration md = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	md.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	md.modifiers = ClassFileConstants.AccPublic;
	
	List<Statement> statements = new ArrayList<Statement>();
	statements.add(createConstructBuilderVarIfNeeded(data, builderType));
	
	FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	MessageSend thisDotFieldDotAdd = new MessageSend();
	thisDotFieldDotAdd.arguments = new Expression[suffixes.size()];
	for (int i = 0; i < suffixes.size(); i++) {
		thisDotFieldDotAdd.arguments[i] = new SingleNameReference(names[i], 0L);
	}
	thisDotFieldDotAdd.receiver = thisDotField;
	thisDotFieldDotAdd.selector = getAddMethodName().toCharArray();
	statements.add(thisDotFieldDotAdd);
	if (returnStatement != null) statements.add(returnStatement);
	md.statements = statements.toArray(new Statement[statements.size()]);
	md.arguments = new Argument[suffixes.size()];
	for (int i = 0; i < suffixes.size(); i++) {
		TypeReference tr = cloneParamType(i, data.getTypeArgs(), builderType);
		md.arguments[i] = new Argument(names[i], 0, tr, 0);
	}
	md.returnType = returnType;
	md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName(getAddMethodName(), new String(data.getSingularName())).toCharArray();
	
	data.setGeneratedByRecursive(md);
	injectMethod(builderType, md);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:40,代码来源:EclipseGuavaSingularizer.java


示例11: createConstructBuilderVarIfNeeded

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
protected Statement createConstructBuilderVarIfNeeded(SingularData data, EclipseNode builderType) {
	FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	FieldReference thisDotField2 = new FieldReference(data.getPluralName(), 0L);
	thisDotField2.receiver = new ThisReference(0, 0);
	Expression cond = new EqualExpression(thisDotField, new NullLiteral(0, 0), OperatorIds.EQUAL_EQUAL);
	
	MessageSend createBuilderInvoke = new MessageSend();
	char[][] tokenizedName = makeGuavaTypeName(getSimpleTargetTypeName(data), false);
	createBuilderInvoke.receiver = new QualifiedNameReference(tokenizedName, NULL_POSS, 0, 0);
	createBuilderInvoke.selector = getBuilderMethodName(data);
	return new IfStatement(cond, new Assignment(thisDotField2, createBuilderInvoke, 0), 0, 0);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:EclipseGuavaSingularizer.java


示例12: generateSingularMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
void generateSingularMethod(TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType, boolean fluent) {
	MethodDeclaration md = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	md.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	md.modifiers = ClassFileConstants.AccPublic;
	
	List<Statement> statements = new ArrayList<Statement>();
	statements.add(createConstructBuilderVarIfNeeded(data, builderType, false));
	
	FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	MessageSend thisDotFieldDotAdd = new MessageSend();
	thisDotFieldDotAdd.arguments = new Expression[] {new SingleNameReference(data.getSingularName(), 0L)};
	thisDotFieldDotAdd.receiver = thisDotField;
	thisDotFieldDotAdd.selector = "add".toCharArray();
	statements.add(thisDotFieldDotAdd);
	if (returnStatement != null) statements.add(returnStatement);
	
	md.statements = statements.toArray(new Statement[statements.size()]);
	TypeReference paramType = cloneParamType(0, data.getTypeArgs(), builderType);
	Argument param = new Argument(data.getSingularName(), 0, paramType, 0);
	md.arguments = new Argument[] {param};
	md.returnType = returnType;
	md.selector = fluent ? data.getSingularName() : HandlerUtil.buildAccessorName("add", new String(data.getSingularName())).toCharArray();
	
	data.setGeneratedByRecursive(md);
	injectMethod(builderType, md);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:28,代码来源:EclipseJavaUtilListSetSingularizer.java


示例13: generatePluralMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
void generatePluralMethod(TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType, boolean fluent) {
	MethodDeclaration md = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	md.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	md.modifiers = ClassFileConstants.AccPublic;
	
	List<Statement> statements = new ArrayList<Statement>();
	statements.add(createConstructBuilderVarIfNeeded(data, builderType, false));
	
	FieldReference thisDotField = new FieldReference(data.getPluralName(), 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	MessageSend thisDotFieldDotAddAll = new MessageSend();
	thisDotFieldDotAddAll.arguments = new Expression[] {new SingleNameReference(data.getPluralName(), 0L)};
	thisDotFieldDotAddAll.receiver = thisDotField;
	thisDotFieldDotAddAll.selector = "addAll".toCharArray();
	statements.add(thisDotFieldDotAddAll);
	if (returnStatement != null) statements.add(returnStatement);
	
	md.statements = statements.toArray(new Statement[statements.size()]);
	
	TypeReference paramType = new QualifiedTypeReference(TypeConstants.JAVA_UTIL_COLLECTION, NULL_POSS);
	paramType = addTypeArgs(1, true, builderType, paramType, data.getTypeArgs());
	Argument param = new Argument(data.getPluralName(), 0, paramType, 0);
	md.arguments = new Argument[] {param};
	md.returnType = returnType;
	md.selector = fluent ? data.getPluralName() : HandlerUtil.buildAccessorName("addAll", new String(data.getPluralName())).toCharArray();
	
	data.setGeneratedByRecursive(md);
	injectMethod(builderType, md);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:30,代码来源:EclipseJavaUtilListSetSingularizer.java


示例14: generateClearMethod

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
private void generateClearMethod(TypeReference returnType, Statement returnStatement, SingularData data, EclipseNode builderType) {
	MethodDeclaration md = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	md.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	md.modifiers = ClassFileConstants.AccPublic;
	
	String pN = new String(data.getPluralName());
	char[] keyFieldName = (pN + "$key").toCharArray();
	char[] valueFieldName = (pN + "$value").toCharArray();
	
	FieldReference thisDotField = new FieldReference(keyFieldName, 0L);
	thisDotField.receiver = new ThisReference(0, 0);
	FieldReference thisDotField2 = new FieldReference(keyFieldName, 0L);
	thisDotField2.receiver = new ThisReference(0, 0);
	FieldReference thisDotField3 = new FieldReference(valueFieldName, 0L);
	thisDotField3.receiver = new ThisReference(0, 0);
	md.selector = HandlerUtil.buildAccessorName("clear", new String(data.getPluralName())).toCharArray();
	MessageSend clearMsg1 = new MessageSend();
	clearMsg1.receiver = thisDotField2;
	clearMsg1.selector = "clear".toCharArray();
	MessageSend clearMsg2 = new MessageSend();
	clearMsg2.receiver = thisDotField3;
	clearMsg2.selector = "clear".toCharArray();
	Block clearMsgs = new Block(2);
	clearMsgs.statements = new Statement[] {clearMsg1, clearMsg2};
	Statement clearStatement = new IfStatement(new EqualExpression(thisDotField, new NullLiteral(0, 0), OperatorIds.NOT_EQUAL), clearMsgs, 0, 0);
	md.statements = returnStatement != null ? new Statement[] {clearStatement, returnStatement} : new Statement[] {clearStatement};
	md.returnType = returnType;
	injectMethod(builderType, md);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:30,代码来源:EclipseJavaUtilMapSingularizer.java


示例15: consumeFieldAccess

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
protected void consumeFieldAccess(boolean isSuperAccess) {
	// FieldAccess ::= Primary '.' 'Identifier'
	// FieldAccess ::= 'super' '.' 'Identifier'

	if (this.indexOfAssistIdentifier() < 0) {
		super.consumeFieldAccess(isSuperAccess);
		return;
	}
	FieldReference fieldReference =
		new SelectionOnFieldReference(
			this.identifierStack[this.identifierPtr],
			this.identifierPositionStack[this.identifierPtr--]);
	this.identifierLengthPtr--;
	if (isSuperAccess) { //considerates the fieldReferenceerence beginning at the 'super' ....
		fieldReference.sourceStart = this.intStack[this.intPtr--];
		fieldReference.receiver = new SuperReference(fieldReference.sourceStart, this.endPosition);
		pushOnExpressionStack(fieldReference);
	} else { //optimize push/pop
		if ((fieldReference.receiver = this.expressionStack[this.expressionPtr]).isThis()) { //fieldReferenceerence begins at the this
			fieldReference.sourceStart = fieldReference.receiver.sourceStart;
		}
		this.expressionStack[this.expressionPtr] = fieldReference;
	}
	this.assistNode = fieldReference;
	this.lastCheckPoint = fieldReference.sourceEnd + 1;
	if (!this.diet){
		this.restartRecovery	= true;	// force to restart in recovery mode
		this.lastIgnoredToken = -1;
	}
	this.isOrphanCompletionNode = true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:SelectionParser.java


示例16: resolveField

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
synchronized IVariableBinding resolveField(FieldAccess fieldAccess) {
	Object oldNode = this.newAstToOldAst.get(fieldAccess);
	if (oldNode instanceof FieldReference) {
		FieldReference fieldReference = (FieldReference) oldNode;
		return this.getVariableBinding(fieldReference.binding);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:DefaultBindingResolver.java


示例17: javadocInvalidField

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
public void javadocInvalidField(FieldReference fieldRef, Binding fieldBinding, TypeBinding searchedType, int modifiers) {
	int id = IProblem.JavadocUndefinedField;
	switch (fieldBinding.problemId()) {
		case ProblemReasons.NotFound :
			id = IProblem.JavadocUndefinedField;
			break;
		case ProblemReasons.NotVisible :
			id = IProblem.JavadocNotVisibleField;
			break;
		case ProblemReasons.Ambiguous :
			id = IProblem.JavadocAmbiguousField;
			break;
		case ProblemReasons.NoError : // 0
		default :
			needImplementation(fieldRef); // want to fail to see why we were here...
			break;
	}
	int severity = computeSeverity(id);
	if (severity == ProblemSeverities.Ignore) return;
	// report issue
	if (javadocVisibility(this.options.reportInvalidJavadocTagsVisibility, modifiers)) {
		String[] arguments = new String[] {new String(fieldBinding.readableName())};
		handle(
			id,
			arguments,
			arguments,
			severity,
			fieldRef.sourceStart,
			fieldRef.sourceEnd);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:ProblemReporter.java


示例18: nodeSourceStart

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
private int nodeSourceStart(Binding field, ASTNode node, int index) {
	if (node instanceof FieldReference) {
		FieldReference fieldReference = (FieldReference) node;
		return (int) (fieldReference.nameSourcePosition >> 32);
	} else 	if (node instanceof QualifiedNameReference) {
		QualifiedNameReference ref = (QualifiedNameReference) node;
		if (ref.binding == field) {
			if (index == 0) {
				return (int) (ref.sourcePositions[ref.indexOfFirstFieldBinding-1] >> 32);
			} else {
				return (int) (ref.sourcePositions[index] >> 32);
			}
		}
		FieldBinding[] otherFields = ref.otherBindings;
		if (otherFields != null) {
			int offset = ref.indexOfFirstFieldBinding;
			if (index != 0) {
				for (int i = 0, length = otherFields.length; i < length; i++) {
					if ((otherFields[i] == field) && (i + offset == index)) {
						return (int) (ref.sourcePositions[i + offset] >> 32);
					}
				}
			} else {
				for (int i = 0, length = otherFields.length; i < length; i++) {
					if (otherFields[i] == field) {
						return (int) (ref.sourcePositions[i + offset] >> 32);
					}
				}
			}
		}
	} else if (node instanceof ParameterizedQualifiedTypeReference) {
		ParameterizedQualifiedTypeReference reference = (ParameterizedQualifiedTypeReference) node;
		return (int) (reference.sourcePositions[0]>>>32);
	}
	return node.sourceStart;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:ProblemReporter.java


示例19: getNodeBegin

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
/**
 * Calculates the beginning position of a given {@link ASTNode}
 * @param node
 * @return
 */
protected int getNodeBegin(ASTNode node) {
	if (node instanceof NameReference) {
		return ((NameReference) node).sourceStart;
	} else if (node instanceof FieldReference) {
		return ((FieldReference) node).receiver.sourceStart;
	} else if (node instanceof MessageSend) {
		return ((MessageSend) node).receiver.sourceStart;
	}
	return node.sourceStart;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:JavaStatementPostfixContext.java


示例20: resolveNodeToBinding

import org.eclipse.jdt.internal.compiler.ast.FieldReference; //导入依赖的package包/类
protected Binding resolveNodeToBinding(ASTNode node) {
	if (node instanceof NameReference) {
   		NameReference nr = (NameReference) node;
		if (nr.binding instanceof VariableBinding) {
			VariableBinding vb = (VariableBinding) nr.binding;
			return vb.type;
		}
	} else if (node instanceof FieldReference) {
   		FieldReference fr = (FieldReference) node;
		return fr.receiver.resolvedType;
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:JavaStatementPostfixContext.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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