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


Java ClassFileConstants.AccStatic方法代码示例

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


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

示例1: 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

示例2: createListOfNonExistentFields

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Given a list of field names and a node referring to a type, finds each name in the list that does not match a field within the type.
 */
public static List<Integer> createListOfNonExistentFields(List<String> list, EclipseNode type, boolean excludeStandard, boolean excludeTransient) {
	boolean[] matched = new boolean[list.size()];
	
	for (EclipseNode child : type.down()) {
		if (list.isEmpty()) break;
		if (child.getKind() != Kind.FIELD) continue;
		if (excludeStandard) {
			if ((((FieldDeclaration)child.get()).modifiers & ClassFileConstants.AccStatic) != 0) continue;
			if (child.getName().startsWith("$")) continue;
		}
		if (excludeTransient && (((FieldDeclaration)child.get()).modifiers & ClassFileConstants.AccTransient) != 0) continue;
		int idx = list.indexOf(child.getName());
		if (idx > -1) matched[idx] = true;
	}
	
	List<Integer> problematic = new ArrayList<Integer>();
	for (int i = 0 ; i < list.size() ; i++) {
		if (!matched[i]) problematic.add(i);
	}
	
	return problematic;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:26,代码来源:EclipseHandlerUtil.java

示例3: generateBuilderMethod

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public MethodDeclaration generateBuilderMethod(boolean isStatic, String builderMethodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long) pS << 32 | pE;
	
	MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) type.top().get()).compilationResult);
	out.selector = builderMethodName.toCharArray();
	out.modifiers = ClassFileConstants.AccPublic;
	if (isStatic) out.modifiers |= ClassFileConstants.AccStatic;
	out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	out.returnType = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.typeParameters = copyTypeParams(typeParams, source);
	AllocationExpression invoke = new AllocationExpression();
	invoke.type = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.statements = new Statement[] {new ReturnStatement(invoke, pS, pE)};
	
	out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope);
	return out;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:19,代码来源:HandleBuilder.java

示例4: generateBuilderMethod

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public MethodDeclaration generateBuilderMethod(String builderMethodName, String builderClassName, EclipseNode type, TypeParameter[] typeParams, ASTNode source) {
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long) pS << 32 | pE;
	
	MethodDeclaration out = new MethodDeclaration(
			((CompilationUnitDeclaration) type.top().get()).compilationResult);
	out.selector = builderMethodName.toCharArray();
	out.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
	out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	out.returnType = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.typeParameters = copyTypeParams(typeParams, source);
	AllocationExpression invoke = new AllocationExpression();
	invoke.type = namePlusTypeParamsToTypeReference(builderClassName.toCharArray(), typeParams, p);
	out.statements = new Statement[] {new ReturnStatement(invoke, pS, pE)};
	
	out.traverse(new SetGeneratedByVisitor(source), ((TypeDeclaration) type.get()).scope);
	return out;
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:19,代码来源:HandleBuilder.java

示例5: SyntheticMethodBinding

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Construct enum special methods: values or valueOf methods
 */
public SyntheticMethodBinding(SourceTypeBinding declaringEnum, char[] selector) {
    this.declaringClass = declaringEnum;
    this.selector = selector;
    this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
	this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
	LookupEnvironment environment = declaringEnum.scope.environment();
    this.thrownExceptions = Binding.NO_EXCEPTIONS;
	if (selector == TypeConstants.VALUES) {
	    this.returnType = environment.createArrayType(environment.convertToParameterizedType(declaringEnum), 1);
	    this.parameters = Binding.NO_PARAMETERS;
	    this.purpose = SyntheticMethodBinding.EnumValues;
	} else if (selector == TypeConstants.VALUEOF) {
	    this.returnType = environment.convertToParameterizedType(declaringEnum);
	    this.parameters = new TypeBinding[]{ declaringEnum.scope.getJavaLangString() };
	    this.purpose = SyntheticMethodBinding.EnumValueOf;
	}
	SyntheticMethodBinding[] knownAccessMethods = ((SourceTypeBinding)this.declaringClass).syntheticMethods();
	int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
	this.index = methodId;
	if (declaringEnum.isStrictfp()) {
		this.modifiers |= ClassFileConstants.AccStrictfp;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:SyntheticMethodBinding.java

示例6: getExtraFlags

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public static int getExtraFlags(TypeDeclaration typeDeclaration) {
	int extraFlags = 0;
	
	if (typeDeclaration.enclosingType != null) {
		extraFlags |= ExtraFlags.IsMemberType;
	}
	TypeDeclaration[] memberTypes = typeDeclaration.memberTypes;
	int memberTypeCounter = memberTypes == null ? 0 : memberTypes.length;
	if (memberTypeCounter > 0) {
		done : for (int i = 0; i < memberTypeCounter; i++) {
			int modifiers = memberTypes[i].modifiers;
			// if the member type is static and not private
			if ((modifiers & ClassFileConstants.AccStatic) != 0 && (modifiers & ClassFileConstants.AccPrivate) == 0) {
				extraFlags |= ExtraFlags.HasNonPrivateStaticMemberTypes;
				break done;
			}
		}
	}
	
	return extraFlags;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:ExtraFlags.java

示例7: generateMethodInfoHeaderForClinit

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * INTERNAL USE-ONLY
 * That method generates the method info header of a clinit:
 * The header consists in:
 * - the access flags (always default access + static)
 * - the name index of the method name (always <clinit>) inside the constant pool
 * - the descriptor index of the signature (always ()V) of the method inside the constant pool.
 */
public void generateMethodInfoHeaderForClinit() {
	// check that there is enough space to write all the bytes for the method info corresponding
	// to the @methodBinding
	this.methodCount++; // add one more method
	if (this.contentsOffset + 10 >= this.contents.length) {
		resizeContents(10);
	}
	this.contents[this.contentsOffset++] = (byte) ((ClassFileConstants.AccDefault | ClassFileConstants.AccStatic) >> 8);
	this.contents[this.contentsOffset++] = (byte) (ClassFileConstants.AccDefault | ClassFileConstants.AccStatic);
	int nameIndex = this.constantPool.literalIndex(ConstantPool.Clinit);
	this.contents[this.contentsOffset++] = (byte) (nameIndex >> 8);
	this.contents[this.contentsOffset++] = (byte) nameIndex;
	int descriptorIndex =
		this.constantPool.literalIndex(ConstantPool.ClinitSignature);
	this.contents[this.contentsOffset++] = (byte) (descriptorIndex >> 8);
	this.contents[this.contentsOffset++] = (byte) descriptorIndex;
	// We know that we won't get more than 1 attribute: the code attribute
	this.contents[this.contentsOffset++] = 0;
	this.contents[this.contentsOffset++] = 1;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:ClassFile.java

示例8: needClassInitMethod

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * A <clinit> will be requested as soon as static fields or assertions are present. It will be eliminated during
 * classfile creation if no bytecode was actually produced based on some optimizations/compiler settings.
 */
public final boolean needClassInitMethod() {
	// always need a <clinit> when assertions are present
	if ((this.bits & ASTNode.ContainsAssertion) != 0)
		return true;

	switch (kind(this.modifiers)) {
		case TypeDeclaration.INTERFACE_DECL:
		case TypeDeclaration.ANNOTATION_TYPE_DECL:
			return this.fields != null; // fields are implicitly statics
		case TypeDeclaration.ENUM_DECL:
			return true; // even if no enum constants, need to set $VALUES array
	}
	if (this.fields != null) {
		for (int i = this.fields.length; --i >= 0;) {
			FieldDeclaration field = this.fields[i];
			//need to test the modifier directly while there is no binding yet
			if ((field.modifiers & ClassFileConstants.AccStatic) != 0)
				return true; // TODO (philippe) shouldn't it check whether field is initializer or has some initial value ?
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:TypeDeclaration.java

示例9: createFieldAccessor

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的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

示例10: filterField

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public static boolean filterField(FieldDeclaration declaration, boolean skipStatic) {
	// Skip the fake fields that represent enum constants.
	if (declaration.initialization instanceof AllocationExpression &&
			((AllocationExpression)declaration.initialization).enumConstant != null) return false;
	
	if (declaration.type == null) return false;
	
	// Skip fields that start with $
	if (declaration.name.length > 0 && declaration.name[0] == '$') return false;
	
	// Skip static fields.
	if (skipStatic && (declaration.modifiers & ClassFileConstants.AccStatic) != 0) return false;
	
	return true;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:16,代码来源:EclipseHandlerUtil.java

示例11: makeBuilderClass

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public EclipseNode makeBuilderClass(boolean isStatic, EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) {
	TypeDeclaration parent = (TypeDeclaration) tdParent.get();
	TypeDeclaration builder = new TypeDeclaration(parent.compilationResult);
	builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	builder.modifiers |= ClassFileConstants.AccPublic;
	if (isStatic) builder.modifiers |= ClassFileConstants.AccStatic;
	builder.typeParameters = copyTypeParams(typeParams, source);
	builder.name = builderClassName.toCharArray();
	builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return injectType(tdParent, builder);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:12,代码来源:HandleBuilder.java

示例12: makeBuilderClass

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public EclipseNode makeBuilderClass(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) {
	TypeDeclaration parent = (TypeDeclaration) tdParent.get();
	TypeDeclaration builder = new TypeDeclaration(parent.compilationResult);
	builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	builder.modifiers |= ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
	builder.typeParameters = copyTypeParams(typeParams, source);
	builder.name = builderClassName.toCharArray();
	builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return injectType(tdParent, builder);
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:11,代码来源:HandleBuilder.java

示例13: addSyntheticFieldForClassLiteral

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public FieldBinding addSyntheticFieldForClassLiteral(TypeBinding targetType, BlockScope blockScope) {
	if (this.synthetics == null)
		this.synthetics = new HashMap[MAX_SYNTHETICS];
	if (this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] == null)
		this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL] = new HashMap(5);

	// use a different table than FIELDS, given there might be a collision between emulation of X.this$0 and X.class.
	FieldBinding synthField = (FieldBinding) this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].get(targetType);
	if (synthField == null) {
		synthField = new SyntheticFieldBinding(
			CharOperation.concat(
				TypeConstants.SYNTHETIC_CLASS,
				String.valueOf(this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()).toCharArray()),
			blockScope.getJavaLangClass(),
			ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic,
			this,
			Constant.NotAConstant,
			this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size());
		this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].put(targetType, synthField);
	}
	// ensure there is not already such a field defined by the user
	FieldBinding existingField;
	if ((existingField = getField(synthField.name, true /*resolve*/)) != null) {
		TypeDeclaration typeDecl = blockScope.referenceType();
		FieldDeclaration[] typeDeclarationFields = typeDecl.fields;
		int max = typeDeclarationFields == null ? 0 : typeDeclarationFields.length;
		for (int i = 0; i < max; i++) {
			FieldDeclaration fieldDecl = typeDeclarationFields[i];
			if (fieldDecl.binding == existingField) {
				blockScope.problemReporter().duplicateFieldInType(this, fieldDecl);
				break;
			}
		}
	}
	return synthField;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:37,代码来源:SourceTypeBinding.java

示例14: isMain

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public final boolean isMain() {
	if (this.selector.length == 4 && CharOperation.equals(this.selector, TypeConstants.MAIN)
			&& ((this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccStatic)) != 0)
			&& TypeBinding.VOID == this.returnType
			&& this.parameters.length == 1) {
		TypeBinding paramType = this.parameters[0];
		if (paramType.dimensions() == 1 && paramType.leafComponentType().id == TypeIds.T_JavaLangString) {
			return true;
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:MethodBinding.java

示例15: getExtraFlags

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public static int getExtraFlags(ClassFileReader reader) {
	int extraFlags = 0;
	
	if (reader.isNestedType()) {
		extraFlags |= ExtraFlags.IsMemberType;
	}
	
	if (reader.isLocal()) {
		extraFlags |= ExtraFlags.IsLocalType;
	}
	
	IBinaryNestedType[] memberTypes = reader.getMemberTypes();
	int memberTypeCounter = memberTypes == null ? 0 : memberTypes.length;
	if (memberTypeCounter > 0) {
		done : for (int i = 0; i < memberTypeCounter; i++) {
			int modifiers = memberTypes[i].getModifiers();
			// if the member type is static and not private
			if ((modifiers & ClassFileConstants.AccStatic) != 0 && (modifiers & ClassFileConstants.AccPrivate) == 0) {
				extraFlags |= ExtraFlags.HasNonPrivateStaticMemberTypes;
				break done;
			}
		}
		
	}
	
	return extraFlags;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:28,代码来源:ExtraFlags.java


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