Java Code Examples for org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants#AccInterface
The following examples show how to use
org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants#AccInterface .
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: CompletionParser.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected void consumeCompilationUnit() { this.javadoc = null; checkComment(); if (this.javadoc != null && this.cursorLocation > this.javadoc.sourceStart && this.cursorLocation < this.javadoc.sourceEnd) { // completion is in an orphan javadoc comment => replace compilation unit one to allow completion resolution this.compilationUnit.javadoc = this.javadoc; // create a fake interface declaration to allow resolution if (this.compilationUnit.types == null) { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; this.compilationUnit.types[0] = declaration; } } super.consumeCompilationUnit(); }
Example 2
Source File: TypeDeclarationPattern.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected void decodeModifiers() { // Extract suffix from modifiers instead of index key switch (this.modifiers & (ClassFileConstants.AccInterface|ClassFileConstants.AccEnum|ClassFileConstants.AccAnnotation)) { case ClassFileConstants.AccAnnotation: case ClassFileConstants.AccAnnotation+ClassFileConstants.AccInterface: this.typeSuffix = ANNOTATION_TYPE_SUFFIX; break; case ClassFileConstants.AccEnum: this.typeSuffix = ENUM_SUFFIX; break; case ClassFileConstants.AccInterface: this.typeSuffix = INTERFACE_SUFFIX; break; default: this.typeSuffix = CLASS_SUFFIX; break; } }
Example 3
Source File: TypeDeclaration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public final static int kind(int flags) { switch (flags & (ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation|ClassFileConstants.AccEnum)) { case ClassFileConstants.AccInterface : return TypeDeclaration.INTERFACE_DECL; case ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation : return TypeDeclaration.ANNOTATION_TYPE_DECL; case ClassFileConstants.AccEnum : return TypeDeclaration.ENUM_DECL; default : return TypeDeclaration.CLASS_DECL; } }
Example 4
Source File: CompilationUnitDeclaration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type }
Example 5
Source File: IntersectionCastTypeBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public IntersectionCastTypeBinding(ReferenceBinding[] intersectingTypes, LookupEnvironment environment) { this.intersectingTypes = intersectingTypes; this.length = intersectingTypes.length; if (!intersectingTypes[0].isClass()) { this.javaLangObject = environment.getResolvedType(TypeConstants.JAVA_LANG_OBJECT, null); this.modifiers |= ClassFileConstants.AccInterface; } }
Example 6
Source File: HandleUtilityClass.java From EasyMPermission with MIT License | 4 votes |
private void changeModifiersAndGenerateConstructor(EclipseNode typeNode, EclipseNode annotationNode) { TypeDeclaration classDecl = (TypeDeclaration) typeNode.get(); boolean makeConstructor = true; classDecl.modifiers |= ClassFileConstants.AccFinal; boolean markStatic = true; boolean requiresClInit = false; boolean alreadyHasClinit = false; if (typeNode.up().getKind() == Kind.COMPILATION_UNIT) markStatic = false; if (markStatic && typeNode.up().getKind() == Kind.TYPE) { TypeDeclaration typeDecl = (TypeDeclaration) typeNode.up().get(); if ((typeDecl.modifiers & ClassFileConstants.AccInterface) != 0) markStatic = false; } if (markStatic) classDecl.modifiers |= ClassFileConstants.AccStatic; for (EclipseNode element : typeNode.down()) { if (element.getKind() == Kind.FIELD) { FieldDeclaration fieldDecl = (FieldDeclaration) element.get(); if ((fieldDecl.modifiers & ClassFileConstants.AccStatic) == 0) { requiresClInit = true; fieldDecl.modifiers |= ClassFileConstants.AccStatic; } } else if (element.getKind() == Kind.METHOD) { AbstractMethodDeclaration amd = (AbstractMethodDeclaration) element.get(); if (amd instanceof ConstructorDeclaration) { ConstructorDeclaration constrDecl = (ConstructorDeclaration) element.get(); if (getGeneratedBy(constrDecl) == null && (constrDecl.bits & ASTNode.IsDefaultConstructor) == 0) { element.addError("@UtilityClasses cannot have declared constructors."); makeConstructor = false; continue; } } else if (amd instanceof MethodDeclaration) { amd.modifiers |= ClassFileConstants.AccStatic; } else if (amd instanceof Clinit) { alreadyHasClinit = true; } } else if (element.getKind() == Kind.TYPE) { ((TypeDeclaration) element.get()).modifiers |= ClassFileConstants.AccStatic; } } if (makeConstructor) createPrivateDefaultConstructor(typeNode, annotationNode); if (requiresClInit && !alreadyHasClinit) classDecl.addClinit(); }
Example 7
Source File: DocumentElementParser.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
protected void consumeInterfaceHeaderName1() { // InterfaceHeaderName ::= Modifiersopt 'interface' 'Identifier' TypeDeclaration typeDecl = new TypeDeclaration(this.compilationUnit.compilationResult); if (this.nestedMethod[this.nestedType] == 0) { if (this.nestedType != 0) { typeDecl.bits |= ASTNode.IsMemberType; } } else { // Record that the block has a declaration for local types typeDecl.bits |= ASTNode.IsLocalType; markEnclosingMemberWithLocalType(); blockReal(); } //highlight the name of the type long pos = this.identifierPositionStack[this.identifierPtr]; typeDecl.sourceEnd = (int) pos; typeDecl.sourceStart = (int) (pos >>> 32); typeDecl.name = this.identifierStack[this.identifierPtr--]; this.identifierLengthPtr--; //compute the declaration source too // 'class' and 'interface' push an int position this.typeStartPosition = typeDecl.declarationSourceStart = this.intStack[this.intPtr--]; this.intPtr--; int declSourceStart = this.intStack[this.intPtr--]; typeDecl.modifiersSourceStart = this.intStack[this.intPtr--]; typeDecl.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccInterface; if (typeDecl.declarationSourceStart > declSourceStart) { typeDecl.declarationSourceStart = declSourceStart; } // consume annotations int length; if ((length = this.expressionLengthStack[this.expressionLengthPtr--]) != 0) { System.arraycopy( this.expressionStack, (this.expressionPtr -= length) + 1, typeDecl.annotations = new Annotation[length], 0, length); } typeDecl.bodyStart = typeDecl.sourceEnd + 1; pushOnAstStack(typeDecl); // javadoc typeDecl.javadoc = this.javadoc; this.javadoc = null; }
Example 8
Source File: ReferenceBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Answer true if the receiver can be instantiated */ public boolean canBeInstantiated() { return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) == 0; }
Example 9
Source File: ReferenceBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean isClass() { return (this.modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) == 0; }
Example 10
Source File: ReferenceBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public boolean isInterface() { // consider strict interfaces and annotation types return (this.modifiers & ClassFileConstants.AccInterface) != 0; }
Example 11
Source File: ReferenceBinding.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Answer true if the receiver is a static member type (or toplevel) */ public final boolean isStatic() { return (this.modifiers & (ClassFileConstants.AccStatic | ClassFileConstants.AccInterface)) != 0 || (this.tagBits & TagBits.IsNestedType) == 0; }