Java Code Examples for org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants#AccVarargs
The following examples show how to use
org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants#AccVarargs .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean isVarargs() { return (this.modifiers & ClassFileConstants.AccVarargs) != 0; }
Example 2
Source File: MethodScope.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * 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; }