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


Java ClassFileConstants.AccFinal方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants.AccFinal方法的典型用法代码示例。如果您正苦于以下问题:Java ClassFileConstants.AccFinal方法的具体用法?Java ClassFileConstants.AccFinal怎么用?Java ClassFileConstants.AccFinal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants的用法示例。


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

示例1: handleValForForEach

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public static boolean handleValForForEach(ForeachStatement forEach, BlockScope scope) {
	if (forEach.elementVariable == null) return false;
	
	if (!isVal(forEach.elementVariable.type, scope)) return false;
	
	TypeBinding component = getForEachComponentType(forEach.collection, scope);
	if (component == null) return false;
	TypeReference replacement = makeType(component, forEach.elementVariable.type, false);
	
	forEach.elementVariable.modifiers |= ClassFileConstants.AccFinal;
	forEach.elementVariable.annotations = addValAnnotation(forEach.elementVariable.annotations, forEach.elementVariable.type, scope);
	forEach.elementVariable.type = replacement != null ? replacement :
			new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, poss(forEach.elementVariable.type, 3));
	
	return false;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:PatchVal.java

示例2: setFieldDefaultsForField

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public void setFieldDefaultsForField(EclipseNode fieldNode, ASTNode pos, AccessLevel level, boolean makeFinal) {
	FieldDeclaration field = (FieldDeclaration) fieldNode.get();
	if (level != null && level != AccessLevel.NONE) {
		if ((field.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected)) == 0) {
			if (!hasAnnotation(PackagePrivate.class, fieldNode)) {
				field.modifiers |= EclipseHandlerUtil.toEclipseModifier(level);
			}
		}
	}
	
	if (makeFinal && (field.modifiers & ClassFileConstants.AccFinal) == 0) {
		if (!hasAnnotation(NonFinal.class, fieldNode)) {
			if ((field.modifiers & ClassFileConstants.AccStatic) == 0 || field.initialization != null) {
				field.modifiers |= ClassFileConstants.AccFinal;
			}
		}
	}
	
	fieldNode.rebuild();
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:HandleFieldDefaults.java

示例3: setFieldDefaultsForField

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public void setFieldDefaultsForField(EclipseNode fieldNode, ASTNode pos, AccessLevel level, boolean makeFinal) {
	FieldDeclaration field = (FieldDeclaration) fieldNode.get();
	if (level != null && level != AccessLevel.NONE) {
		if ((field.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected)) == 0) {
			if (!hasAnnotation(PackagePrivate.class, fieldNode)) {
				field.modifiers |= EclipseHandlerUtil.toEclipseModifier(level);
			}
		}
	}
	
	if (makeFinal && (field.modifiers & ClassFileConstants.AccFinal) == 0) {
		if (!hasAnnotation(NonFinal.class, fieldNode)) {
			field.modifiers |= ClassFileConstants.AccFinal;
		}
	}
	
	fieldNode.rebuild();
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:19,代码来源:HandleFieldDefaults.java

示例4: completionOnMethodName

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
private void completionOnMethodName(ASTNode astNode, Scope scope) {
	if (!this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) {
		CompletionOnMethodName method = (CompletionOnMethodName) astNode;

		setSourceAndTokenRange(method.sourceStart, method.selectorEnd);

		FieldBinding[] fields = scope.enclosingSourceType().fields();
		char[][] excludeNames = new char[fields.length][];
		for(int i = 0 ; i < fields.length ; i++){
			excludeNames[i] = fields[i].name;
		}

		this.completionToken = method.selector;

		
		int kind =
			 (method.modifiers & ClassFileConstants.AccStatic) == 0 ? 
					InternalNamingConventions.VK_INSTANCE_FIELD :
						(method.modifiers & ClassFileConstants.AccFinal) == 0 ? 
								InternalNamingConventions.VK_STATIC_FIELD :
									InternalNamingConventions.VK_STATIC_FINAL_FIELD;
					
		findVariableNames(this.completionToken, method.returnType, excludeNames, null, kind);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:CompletionEngine.java

示例5: SyntheticMethodBinding

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Construct a bridge method
 */
public SyntheticMethodBinding(MethodBinding overridenMethodToBridge, MethodBinding targetMethod, SourceTypeBinding declaringClass) {

    this.declaringClass = declaringClass;
    this.selector = overridenMethodToBridge.selector;
    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
    // also use the modifiers from the target method, as opposed to inherited one (147690)
    this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccSynchronized | ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
	this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
    this.returnType = overridenMethodToBridge.returnType;
    this.parameters = overridenMethodToBridge.parameters;
    this.thrownExceptions = overridenMethodToBridge.thrownExceptions;
    this.targetMethod = targetMethod;
    this.purpose = SyntheticMethodBinding.BridgeMethod;
	SyntheticMethodBinding[] knownAccessMethods = declaringClass.syntheticMethods();
	int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
	this.index = methodId;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:SyntheticMethodBinding.java

示例6: printModifiers

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public static StringBuffer printModifiers(int modifiers, StringBuffer output) {

		if ((modifiers & ClassFileConstants.AccPublic) != 0)
			output.append("public "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccPrivate) != 0)
			output.append("private "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccProtected) != 0)
			output.append("protected "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccStatic) != 0)
			output.append("static "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccFinal) != 0)
			output.append("final "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccSynchronized) != 0)
			output.append("synchronized "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccVolatile) != 0)
			output.append("volatile "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccTransient) != 0)
			output.append("transient "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccNative) != 0)
			output.append("native "); //$NON-NLS-1$
		if ((modifiers & ClassFileConstants.AccAbstract) != 0)
			output.append("abstract "); //$NON-NLS-1$
		if ((modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0)
			output.append("default "); //$NON-NLS-1$
		return output;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:ASTNode.java

示例7: add

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanceValue) {
	resetPendingModifiers();

	/* local variables inside method can only be final and non void */
	char[][] fieldTypeName;
	if ((fieldDeclaration.modifiers & ~ClassFileConstants.AccFinal) != 0 // local var can only be final
		|| (fieldDeclaration.type == null) // initializer
		|| ((fieldTypeName = fieldDeclaration.type.getTypeName()).length == 1 // non void
			&& CharOperation.equals(fieldTypeName[0], TypeBinding.VOID.sourceName()))){
		this.updateSourceEndIfNecessary(previousAvailableLineEnd(fieldDeclaration.declarationSourceStart - 1));
		return this.parent.add(fieldDeclaration, bracketBalanceValue);
	}

	/* do not consider a local variable starting passed the block end (if set)
		it must be belonging to an enclosing block */
	if (this.blockDeclaration.sourceEnd != 0
		&& fieldDeclaration.declarationSourceStart > this.blockDeclaration.sourceEnd){
		return this.parent.add(fieldDeclaration, bracketBalanceValue);
	}

	// ignore the added field, since indicates a local variable behind recovery point
	// which thus got parsed as a field reference. This can happen if restarting after
	// having reduced an assistNode to get the following context (see 1GEK7SG)
	return this;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:RecoveredBlock.java

示例8: findFields

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
private static List<EclipseNode> findFields(EclipseNode typeNode, boolean nullMarked) {
	List<EclipseNode> fields = new ArrayList<EclipseNode>();
	for (EclipseNode child : typeNode.down()) {
		if (child.getKind() != Kind.FIELD) continue;
		FieldDeclaration fieldDecl = (FieldDeclaration) child.get();
		if (!filterField(fieldDecl)) continue;
		boolean isFinal = (fieldDecl.modifiers & ClassFileConstants.AccFinal) != 0;
		boolean isNonNull = nullMarked && findAnnotations(fieldDecl, NON_NULL_PATTERN).length != 0;
		if ((isFinal || isNonNull) && fieldDecl.initialization == null) fields.add(child);
	}
	return fields;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:13,代码来源:HandleConstructor.java

示例9: findAllFields

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
static List<EclipseNode> findAllFields(EclipseNode typeNode) {
	List<EclipseNode> fields = new ArrayList<EclipseNode>();
	for (EclipseNode child : typeNode.down()) {
		if (child.getKind() != Kind.FIELD) continue;
		FieldDeclaration fieldDecl = (FieldDeclaration) child.get();
		if (!filterField(fieldDecl)) continue;
		
		// Skip initialized final fields.
		if (((fieldDecl.modifiers & ClassFileConstants.AccFinal) != 0) && fieldDecl.initialization != null) continue;
		
		fields.add(child);
	}
	return fields;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:15,代码来源:HandleConstructor.java

示例10: findRequiredFields

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
private static List<EclipseNode> findRequiredFields(EclipseNode typeNode) {
	List<EclipseNode> fields = new ArrayList<EclipseNode>();
	for (EclipseNode child : typeNode.down()) {
		if (child.getKind() != Kind.FIELD) continue;
		FieldDeclaration fieldDecl = (FieldDeclaration) child.get();
		if (!filterField(fieldDecl)) continue;
		boolean isFinal = (fieldDecl.modifiers & ClassFileConstants.AccFinal) != 0;
		boolean isNonNull = findAnnotations(fieldDecl, NON_NULL_PATTERN).length != 0;
		if ((isFinal || isNonNull) && fieldDecl.initialization == null) fields.add(child);
	}
	return fields;
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:13,代码来源:HandleConstructor.java

示例11: add

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanceValue) {
	resetPendingModifiers();

	/* local variables inside method can only be final and non void */
	char[][] fieldTypeName;
	if ((fieldDeclaration.modifiers & ~ClassFileConstants.AccFinal) != 0 // local var can only be final
		|| (fieldDeclaration.type == null) // initializer
		|| ((fieldTypeName = fieldDeclaration.type.getTypeName()).length == 1 // non void
			&& CharOperation.equals(fieldTypeName[0], TypeBinding.VOID.sourceName()))){
		if (this.parent == null){
			return this; // ignore
		} else {
			this.updateSourceEndIfNecessary(previousAvailableLineEnd(fieldDeclaration.declarationSourceStart - 1));
			return this.parent.add(fieldDeclaration, bracketBalanceValue);
		}
	}
	/* default behavior is to delegate recording to parent if any,
	do not consider elements passed the known end (if set)
	it must be belonging to an enclosing element
	*/
	if (this.methodDeclaration.declarationSourceEnd > 0
		&& fieldDeclaration.declarationSourceStart
			> this.methodDeclaration.declarationSourceEnd){
		if (this.parent == null){
			return this; // ignore
		} else {
			return this.parent.add(fieldDeclaration, bracketBalanceValue);
		}
	}
	/* consider that if the opening brace was not found, it is there */
	if (!this.foundOpeningBrace){
		this.foundOpeningBrace = true;
		this.bracketBalance++;
	}
	// still inside method, treat as local variable
	return this; // ignore
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:38,代码来源:RecoveredMethod.java

示例12: checkModifiers

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public void checkModifiers() {

		//only potential valid modifier is <<final>>
		if (((this.modifiers & ExtraCompilerModifiers.AccJustFlag) & ~ClassFileConstants.AccFinal) != 0)
			//AccModifierProblem -> other (non-visibility problem)
			//AccAlternateModifierProblem -> duplicate modifier
			//AccModifierProblem | AccAlternateModifierProblem -> visibility problem"

			this.modifiers = (this.modifiers & ~ExtraCompilerModifiers.AccAlternateModifierProblem) | ExtraCompilerModifiers.AccModifierProblem;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:LocalDeclaration.java

示例13: SyntheticArgumentBinding

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public SyntheticArgumentBinding(LocalVariableBinding actualOuterLocalVariable) {

		super(
			CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name),
			actualOuterLocalVariable.type,
			ClassFileConstants.AccFinal,
			true);
		this.actualOuterLocalVariable = actualOuterLocalVariable;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:SyntheticArgumentBinding.java

示例14: SyntheticArgumentBinding

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public SyntheticArgumentBinding(ReferenceBinding enclosingType) {

		super(
			CharOperation.concat(
				TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,
				String.valueOf(enclosingType.depth()).toCharArray()),
			enclosingType,
			ClassFileConstants.AccFinal,
			true);
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:11,代码来源:SyntheticArgumentBinding.java

示例15: createGetterForField

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public void createGetterForField(AccessLevel level,
		EclipseNode fieldNode, EclipseNode errorNode, ASTNode source, boolean whineIfExists, boolean lazy, List<Annotation> onMethod) {
	if (fieldNode.getKind() != Kind.FIELD) {
		errorNode.addError("@Getter is only supported on a class or a field.");
		return;
	}
	
	FieldDeclaration field = (FieldDeclaration) fieldNode.get();
	if (lazy) {
		if ((field.modifiers & ClassFileConstants.AccPrivate) == 0 || (field.modifiers & ClassFileConstants.AccFinal) == 0) {
			errorNode.addError("'lazy' requires the field to be private and final.");
			return;
		}
		if (field.initialization == null) {
			errorNode.addError("'lazy' requires field initialization.");
			return;
		}
	}
	
	TypeReference fieldType = copyType(field.type, source);
	boolean isBoolean = isBoolean(fieldType);
	String getterName = toGetterName(fieldNode, isBoolean);
	
	if (getterName == null) {
		errorNode.addWarning("Not generating getter for this field: It does not fit your @Accessors prefix list.");
		return;
	}
	
	int modifier = toEclipseModifier(level) | (field.modifiers & ClassFileConstants.AccStatic);
	
	for (String altName : toAllGetterNames(fieldNode, isBoolean)) {
		switch (methodExists(altName, fieldNode, false, 0)) {
		case EXISTS_BY_LOMBOK:
			return;
		case EXISTS_BY_USER:
			if (whineIfExists) {
				String altNameExpl = "";
				if (!altName.equals(getterName)) altNameExpl = String.format(" (%s)", altName);
				errorNode.addWarning(
					String.format("Not generating %s(): A method with that name already exists%s", getterName, altNameExpl));
			}
			return;
		default:
		case NOT_EXISTS:
			//continue scanning the other alt names.
		}
	}
	
	MethodDeclaration method = createGetter((TypeDeclaration) fieldNode.up().get(), fieldNode, getterName, modifier, source, lazy, onMethod);
	
	injectMethod(fieldNode.up(), method);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:53,代码来源:HandleGetter.java


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