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


Java ClassFileConstants.AccAbstract方法代码示例

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


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

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

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

示例3: 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$
		return output;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:25,代码来源:ASTNode.java

示例4: getFlags

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public int getFlags() throws JavaModelException {
	IBinaryMethod info = (IBinaryMethod) getElementInfo();
	int modifiers = info.getModifiers();
	if (((IType) this.parent).isInterface() && (modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccStatic)) == 0)
		modifiers |= ExtraCompilerModifiers.AccDefaultMethod;
	return modifiers;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:BinaryMethod.java

示例5: decodeModifiers

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
private static void decodeModifiers(Set<Modifier> result, int modifiers, int[] checkBits) {
	if (checkBits == null) return;
	for (int i = 0, max = checkBits.length; i < max; i++) {
		switch(checkBits[i]) {
			case ClassFileConstants.AccPublic :
				appendModifier(result, modifiers, checkBits[i], Modifier.PUBLIC);
				break;
			case ClassFileConstants.AccProtected:
				appendModifier(result, modifiers, checkBits[i], Modifier.PROTECTED);
				break;
			case ClassFileConstants.AccPrivate :
				appendModifier(result, modifiers, checkBits[i], Modifier.PRIVATE);
				break;
			case ClassFileConstants.AccAbstract :
				appendModifier(result, modifiers, checkBits[i], Modifier.ABSTRACT);
				break;
			case ClassFileConstants.AccStatic :
				appendModifier(result, modifiers, checkBits[i], Modifier.STATIC);
				break;
			case ClassFileConstants.AccFinal :
				appendModifier(result, modifiers, checkBits[i], Modifier.FINAL);
				break;
			case ClassFileConstants.AccSynchronized :
				appendModifier(result, modifiers, checkBits[i], Modifier.SYNCHRONIZED);
				break;
			case ClassFileConstants.AccNative :
				appendModifier(result, modifiers, checkBits[i], Modifier.NATIVE);
				break;
			case ClassFileConstants.AccStrictfp :
				appendModifier(result, modifiers, checkBits[i], Modifier.STRICTFP);
				break;
			case ClassFileConstants.AccTransient :
				appendModifier(result, modifiers, checkBits[i], Modifier.TRANSIENT);
				break;
			case ClassFileConstants.AccVolatile :
				appendModifier(result, modifiers, checkBits[i], Modifier.VOLATILE);
				break;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:41,代码来源:Factory.java

示例6: createWitherForField

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public void createWitherForField(
		AccessLevel level, EclipseNode fieldNode, EclipseNode sourceNode,
		boolean whineIfExists, List<Annotation> onMethod,
		List<Annotation> onParam) {
	
	ASTNode source = sourceNode.get();
	if (fieldNode.getKind() != Kind.FIELD) {
		sourceNode.addError("@Wither is only supported on a class or a field.");
		return;
	}
	
	EclipseNode typeNode = fieldNode.up();
	boolean makeAbstract = typeNode != null && typeNode.getKind() == Kind.TYPE && (((TypeDeclaration) typeNode.get()).modifiers & ClassFileConstants.AccAbstract) != 0;
	
	FieldDeclaration field = (FieldDeclaration) fieldNode.get();
	TypeReference fieldType = copyType(field.type, source);
	boolean isBoolean = isBoolean(fieldType);
	String witherName = toWitherName(fieldNode, isBoolean);
	
	if (witherName == null) {
		fieldNode.addWarning("Not generating wither for this field: It does not fit your @Accessors prefix list.");
		return;
	}
	
	if ((field.modifiers & ClassFileConstants.AccStatic) != 0) {
		fieldNode.addWarning("Not generating wither for this field: Withers cannot be generated for static fields.");
		return;
	}
	
	if ((field.modifiers & ClassFileConstants.AccFinal) != 0 && field.initialization != null) {
		fieldNode.addWarning("Not generating wither for this field: Withers cannot be generated for final, initialized fields.");
		return;
	}
	
	if (field.name != null && field.name.length > 0 && field.name[0] == '$') {
		fieldNode.addWarning("Not generating wither for this field: Withers cannot be generated for fields starting with $.");
		return;
	}
	
	for (String altName : toAllWitherNames(fieldNode, isBoolean)) {
		switch (methodExists(altName, fieldNode, false, 1)) {
		case EXISTS_BY_LOMBOK:
			return;
		case EXISTS_BY_USER:
			if (whineIfExists) {
				String altNameExpl = "";
				if (!altName.equals(witherName)) altNameExpl = String.format(" (%s)", altName);
				fieldNode.addWarning(
					String.format("Not generating %s(): A method with that name already exists%s", witherName, altNameExpl));
			}
			return;
		default:
		case NOT_EXISTS:
			//continue scanning the other alt names.
		}
	}
	
	int modifier = toEclipseModifier(level);
	
	MethodDeclaration method = createWither((TypeDeclaration) fieldNode.up().get(), fieldNode, witherName, modifier, sourceNode, onMethod, onParam, makeAbstract);
	injectMethod(fieldNode.up(), method);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:63,代码来源:HandleWither.java

示例7: createWither

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public MethodDeclaration createWither(TypeDeclaration parent, EclipseNode fieldNode, String name, int modifier, EclipseNode sourceNode, List<Annotation> onMethod, List<Annotation> onParam, boolean makeAbstract ) {
	ASTNode source = sourceNode.get();
	if (name == null) return null;
	FieldDeclaration field = (FieldDeclaration) fieldNode.get();
	int pS = source.sourceStart, pE = source.sourceEnd;
	long p = (long) pS << 32 | pE;
	MethodDeclaration method = new MethodDeclaration(parent.compilationResult);
	if (makeAbstract) modifier = modifier | ClassFileConstants.AccAbstract | ExtraCompilerModifiers.AccSemicolonBody;
	method.modifiers = modifier;
	method.returnType = cloneSelfType(fieldNode, source);
	if (method.returnType == null) return null;
	
	Annotation[] deprecated = null;
	if (isFieldDeprecated(fieldNode)) {
		deprecated = new Annotation[] { generateDeprecatedAnnotation(source) };
	}
	method.annotations = copyAnnotations(source, onMethod.toArray(new Annotation[0]), deprecated);
	Argument param = new Argument(field.name, p, copyType(field.type, source), ClassFileConstants.AccFinal);
	param.sourceStart = pS; param.sourceEnd = pE;
	method.arguments = new Argument[] { param };
	method.selector = name.toCharArray();
	method.binding = null;
	method.thrownExceptions = null;
	method.typeParameters = null;
	method.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	
	Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
	Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
	
	if (!makeAbstract) {
		List<Expression> args = new ArrayList<Expression>();
		for (EclipseNode child : fieldNode.up().down()) {
			if (child.getKind() != Kind.FIELD) continue;
			FieldDeclaration childDecl = (FieldDeclaration) child.get();
			// Skip fields that start with $
			if (childDecl.name != null && childDecl.name.length > 0 && childDecl.name[0] == '$') continue;
			long fieldFlags = childDecl.modifiers;
			// Skip static fields.
			if ((fieldFlags & ClassFileConstants.AccStatic) != 0) continue;
			// Skip initialized final fields.
			if (((fieldFlags & ClassFileConstants.AccFinal) != 0) && childDecl.initialization != null) continue;
			if (child.get() == fieldNode.get()) {
				args.add(new SingleNameReference(field.name, p));
			} else {
				args.add(createFieldAccessor(child, FieldAccess.ALWAYS_FIELD, source));
			}
		}
		
		AllocationExpression constructorCall = new AllocationExpression();
		constructorCall.arguments = args.toArray(new Expression[0]);
		constructorCall.type = cloneSelfType(fieldNode, source);
		
		Expression identityCheck = new EqualExpression(
				createFieldAccessor(fieldNode, FieldAccess.ALWAYS_FIELD, source),
				new SingleNameReference(field.name, p),
				OperatorIds.EQUAL_EQUAL);
		ThisReference thisRef = new ThisReference(pS, pE);
		Expression conditional = new ConditionalExpression(identityCheck, thisRef, constructorCall);
		Statement returnStatement = new ReturnStatement(conditional, pS, pE);
		method.bodyStart = method.declarationSourceStart = method.sourceStart = source.sourceStart;
		method.bodyEnd = method.declarationSourceEnd = method.sourceEnd = source.sourceEnd;
		
		List<Statement> statements = new ArrayList<Statement>(5);
		if (nonNulls.length > 0) {
			Statement nullCheck = generateNullCheck(field, sourceNode);
			if (nullCheck != null) statements.add(nullCheck);
		}
		statements.add(returnStatement);
		
		method.statements = statements.toArray(new Statement[0]);
	}
	param.annotations = copyAnnotations(source, nonNulls, nullables, onParam.toArray(new Annotation[0]));
	
	method.traverse(new SetGeneratedByVisitor(source), parent.scope);
	return method;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:77,代码来源:HandleWither.java

示例8: decodeModifiers

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
private static void decodeModifiers(Set<Modifier> result, int modifiers, int[] checkBits) {
	if (checkBits == null) return;
	for (int i = 0, max = checkBits.length; i < max; i++) {
		switch(checkBits[i]) {
			case ClassFileConstants.AccPublic :
				appendModifier(result, modifiers, checkBits[i], Modifier.PUBLIC);
				break;
			case ClassFileConstants.AccProtected:
				appendModifier(result, modifiers, checkBits[i], Modifier.PROTECTED);
				break;
			case ClassFileConstants.AccPrivate :
				appendModifier(result, modifiers, checkBits[i], Modifier.PRIVATE);
				break;
			case ClassFileConstants.AccAbstract :
				appendModifier(result, modifiers, checkBits[i], Modifier.ABSTRACT);
				break;
			case ExtraCompilerModifiers.AccDefaultMethod :
				try {
					appendModifier(result, modifiers, checkBits[i], Modifier.valueOf("DEFAULT")); //$NON-NLS-1$
				} catch(IllegalArgumentException iae) {
					// Don't have JDK 1.8, just ignore and proceed.
				}
				break;
			case ClassFileConstants.AccStatic :
				appendModifier(result, modifiers, checkBits[i], Modifier.STATIC);
				break;
			case ClassFileConstants.AccFinal :
				appendModifier(result, modifiers, checkBits[i], Modifier.FINAL);
				break;
			case ClassFileConstants.AccSynchronized :
				appendModifier(result, modifiers, checkBits[i], Modifier.SYNCHRONIZED);
				break;
			case ClassFileConstants.AccNative :
				appendModifier(result, modifiers, checkBits[i], Modifier.NATIVE);
				break;
			case ClassFileConstants.AccStrictfp :
				appendModifier(result, modifiers, checkBits[i], Modifier.STRICTFP);
				break;
			case ClassFileConstants.AccTransient :
				appendModifier(result, modifiers, checkBits[i], Modifier.TRANSIENT);
				break;
			case ClassFileConstants.AccVolatile :
				appendModifier(result, modifiers, checkBits[i], Modifier.VOLATILE);
				break;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:48,代码来源:Factory.java

示例9: checkKeyword

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
private boolean checkKeyword() {
	if (this.currentElement instanceof RecoveredUnit) {
		RecoveredUnit unit = (RecoveredUnit) this.currentElement;
		int index = -1;
		if ((index = this.indexOfAssistIdentifier()) > -1) {
			int ptr = this.identifierPtr - this.identifierLengthStack[this.identifierLengthPtr] + index + 1;

			char[] ident = this.identifierStack[ptr];
			long pos = this.identifierPositionStack[ptr];

			char[][] keywords = new char[Keywords.COUNT][];
			int count = 0;
			if(unit.typeCount == 0
				&& (!this.compilationUnit.isPackageInfo() || this.compilationUnit.currentPackage != null)
				&& this.lastModifiers == ClassFileConstants.AccDefault) {
				keywords[count++] = Keywords.IMPORT;
			}
			if(unit.typeCount == 0
				&& unit.importCount == 0
				&& this.lastModifiers == ClassFileConstants.AccDefault
				&& this.compilationUnit.currentPackage == null) {
				keywords[count++] = Keywords.PACKAGE;
			}
			if (!this.compilationUnit.isPackageInfo()) {
				if((this.lastModifiers & ClassFileConstants.AccPublic) == 0) {
					boolean hasNoPublicType = true;
					for (int i = 0; i < unit.typeCount; i++) {
						if((unit.types[i].typeDeclaration.modifiers & ClassFileConstants.AccPublic) != 0) {
							hasNoPublicType = false;
						}
					}
					if(hasNoPublicType) {
						keywords[count++] = Keywords.PUBLIC;
					}
				}
				if((this.lastModifiers & ClassFileConstants.AccAbstract) == 0
					&& (this.lastModifiers & ClassFileConstants.AccFinal) == 0) {
					keywords[count++] = Keywords.ABSTRACT;
				}
				if((this.lastModifiers & ClassFileConstants.AccAbstract) == 0
					&& (this.lastModifiers & ClassFileConstants.AccFinal) == 0) {
					keywords[count++] = Keywords.FINAL;
				}
	
				keywords[count++] = Keywords.CLASS;
				if (this.options.complianceLevel >= ClassFileConstants.JDK1_5) {
					keywords[count++] = Keywords.ENUM;
				}
	
				if((this.lastModifiers & ClassFileConstants.AccFinal) == 0) {
					keywords[count++] = Keywords.INTERFACE;
				}
			}
			if(count != 0) {
				System.arraycopy(keywords, 0, keywords = new char[count][], 0, count);

				this.assistNode = new CompletionOnKeyword2(ident, pos, keywords);
				this.lastCheckPoint = this.assistNode.sourceEnd + 1;
				this.isOrphanCompletionNode = true;
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:66,代码来源:CompletionParser.java

示例10: isAbstract

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

		if (this.binding != null)
			return this.binding.isAbstract();
		return (this.modifiers & ClassFileConstants.AccAbstract) != 0;
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:AbstractMethodDeclaration.java

示例11: canBeInstantiated

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Answer true if the receiver can be instantiated
 */
public boolean canBeInstantiated() {
	return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) == 0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:ReferenceBinding.java

示例12: isAbstract

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Answer true if the receiver is an abstract type
*/
public final boolean isAbstract() {
	return (this.modifiers & ClassFileConstants.AccAbstract) != 0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:ReferenceBinding.java

示例13: isAbstract

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
public final boolean isAbstract() {
	return (this.modifiers & ClassFileConstants.AccAbstract) != 0;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:MethodBinding.java

示例14: createMethod

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Error management:
 * 		keep null for all the errors that prevent the method to be created
 * 		otherwise return a correct method binding (but without the element
 *		that caused the problem) : i.e. Incorrect thrown exception
 */
MethodBinding createMethod(AbstractMethodDeclaration method) {
	// is necessary to ensure error reporting
	this.referenceContext = method;
	method.scope = this;
	SourceTypeBinding declaringClass = referenceType().binding;
	int modifiers = method.modifiers | ExtraCompilerModifiers.AccUnresolved;
	if (method.isConstructor()) {
		if (method.isDefaultConstructor())
			modifiers |= ExtraCompilerModifiers.AccIsDefaultConstructor;
		method.binding = new MethodBinding(modifiers, null, null, declaringClass);
		checkAndSetModifiersForConstructor(method.binding);
	} else {
		if (declaringClass.isInterface()) {// interface or annotation type
			if (method.isDefaultMethod() || method.isStatic()) {
				modifiers |= ClassFileConstants.AccPublic; // default method is not abstract
			} else {
				modifiers |= ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract;
			}
		}
		method.binding =
			new MethodBinding(modifiers, method.selector, null, null, null, declaringClass);
		checkAndSetModifiersForMethod(method.binding);
	}
	this.isStatic = method.binding.isStatic();

	Argument[] argTypes = method.arguments;
	int argLength = argTypes == null ? 0 : argTypes.length;
	long sourceLevel = compilerOptions().sourceLevel;
	if (argLength > 0) {
		Argument argument = argTypes[--argLength];
		if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5)
			method.binding.modifiers |= ClassFileConstants.AccVarargs;
		if (CharOperation.equals(argument.name, ConstantPool.This)) {
			problemReporter().illegalThisDeclaration(argument);
		}
		while (--argLength >= 0) {
			argument = argTypes[argLength];
			if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5)
				problemReporter().illegalVararg(argument, method);
			if (CharOperation.equals(argument.name, ConstantPool.This)) {
				problemReporter().illegalThisDeclaration(argument);
			}
		}
	}
	if (method.receiver != null) {
		if (sourceLevel <= ClassFileConstants.JDK1_7) {
			problemReporter().illegalSourceLevelForThis(method.receiver);
		}
		if (method.receiver.annotations != null) {
			method.bits |= ASTNode.HasTypeAnnotations;
		}
	}

	TypeParameter[] typeParameters = method.typeParameters();
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, If they exist at all, process type parameters irrespective of source level.
    if (typeParameters == null || typeParameters.length == 0) {
	    method.binding.typeVariables = Binding.NO_TYPE_VARIABLES;
	} else {
		method.binding.typeVariables = createTypeVariables(typeParameters, method.binding);
		method.binding.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
	}
	return method.binding;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:70,代码来源:MethodScope.java

示例15: checkAndSetModifiersForMethod

import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; //导入方法依赖的package包/类
/**
 * Spec : 8.4.3 & 9.4
 */
private void checkAndSetModifiersForMethod(MethodBinding methodBinding) {
	int modifiers = methodBinding.modifiers;
	final ReferenceBinding declaringClass = methodBinding.declaringClass;
	if ((modifiers & ExtraCompilerModifiers.AccAlternateModifierProblem) != 0)
		problemReporter().duplicateModifierForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext);

	// after this point, tests on the 16 bits reserved.
	int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag;

	// set the requested modifiers for a method in an interface/annotation
	if (declaringClass.isInterface()) {
		if ((realModifiers & ~(ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract)) != 0) {
			if ((declaringClass.modifiers & ClassFileConstants.AccAnnotation) != 0)
				problemReporter().illegalModifierForAnnotationMember((AbstractMethodDeclaration) this.referenceContext);
			else
				problemReporter().illegalModifierForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext);
		}
		return;
	}

	// check for abnormal modifiers
	final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected
		| ClassFileConstants.AccAbstract | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp);
	if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) {
		problemReporter().illegalModifierForMethod((AbstractMethodDeclaration) this.referenceContext);
		modifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~UNEXPECTED_MODIFIERS;
	}

	// check for incompatible modifiers in the visibility bits, isolate the visibility bits
	int accessorBits = realModifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate);
	if ((accessorBits & (accessorBits - 1)) != 0) {
		problemReporter().illegalVisibilityModifierCombinationForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext);

		// need to keep the less restrictive so disable Protected/Private as necessary
		if ((accessorBits & ClassFileConstants.AccPublic) != 0) {
			if ((accessorBits & ClassFileConstants.AccProtected) != 0)
				modifiers &= ~ClassFileConstants.AccProtected;
			if ((accessorBits & ClassFileConstants.AccPrivate) != 0)
				modifiers &= ~ClassFileConstants.AccPrivate;
		} else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) {
			modifiers &= ~ClassFileConstants.AccPrivate;
		}
	}

	// check for modifiers incompatible with abstract modifier
	if ((modifiers & ClassFileConstants.AccAbstract) != 0) {
		int incompatibleWithAbstract = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp;
		if ((modifiers & incompatibleWithAbstract) != 0)
			problemReporter().illegalAbstractModifierCombinationForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext);
		if (!methodBinding.declaringClass.isAbstract())
			problemReporter().abstractMethodInAbstractClass((SourceTypeBinding) declaringClass, (AbstractMethodDeclaration) this.referenceContext);
	}

	/* DISABLED for backward compatibility with javac (if enabled should also mark private methods as final)
	// methods from a final class are final : 8.4.3.3
	if (methodBinding.declaringClass.isFinal())
		modifiers |= AccFinal;
	*/
	// native methods cannot also be tagged as strictfp
	if ((modifiers & ClassFileConstants.AccNative) != 0 && (modifiers & ClassFileConstants.AccStrictfp) != 0)
		problemReporter().nativeMethodsCannotBeStrictfp(declaringClass, (AbstractMethodDeclaration) this.referenceContext);

	// static members are only authorized in a static member or top level type
	if (((realModifiers & ClassFileConstants.AccStatic) != 0) && declaringClass.isNestedType() && !declaringClass.isStatic())
		problemReporter().unexpectedStaticModifierForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext);

	methodBinding.modifiers = modifiers;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:72,代码来源:MethodScope.java


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