List of usage examples for org.eclipse.jdt.internal.compiler.lookup TypeConstants CharArray_JAVA_LANG_ENUM
null CharArray_JAVA_LANG_ENUM
To view the source code for org.eclipse.jdt.internal.compiler.lookup TypeConstants CharArray_JAVA_LANG_ENUM.
Click Source Link
From source file:org.eclipse.ajdt.core.parserbridge.AJSourceElementNotifier.java
License:Open Source License
protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boolean notifyTypePresence, TypeDeclaration declaringType) { if (CharOperation.equals(TypeConstants.PACKAGE_INFO_NAME, typeDeclaration.name)) return;// w w w . ja v a2 s.c o m // AspectJ change begin boolean isAspect = false; org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration ajtypeDeclaration = new org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration( new org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult( typeDeclaration.compilationResult.fileName, typeDeclaration.compilationResult.unitIndex, typeDeclaration.compilationResult.totalUnitsKnown, 500)); if (ajtypeDeclaration instanceof AspectDeclaration) { isAspect = true; } // AspectJ change end // range check boolean isInRange = initialPosition <= typeDeclaration.declarationSourceStart && eofPosition >= typeDeclaration.declarationSourceEnd; FieldDeclaration[] fields = typeDeclaration.fields; AbstractMethodDeclaration[] methods = typeDeclaration.methods; TypeDeclaration[] memberTypes = typeDeclaration.memberTypes; int fieldCounter = fields == null ? 0 : fields.length; int methodCounter = methods == null ? 0 : methods.length; int memberTypeCounter = memberTypes == null ? 0 : memberTypes.length; int fieldIndex = 0; int methodIndex = 0; int memberTypeIndex = 0; if (notifyTypePresence) { char[][] interfaceNames = getInterfaceNames(typeDeclaration); int kind = TypeDeclaration.kind(typeDeclaration.modifiers); char[] implicitSuperclassName = TypeConstants.CharArray_JAVA_LANG_OBJECT; if (isInRange) { int currentModifiers = typeDeclaration.modifiers; // remember deprecation so as to not lose it below boolean deprecated = (currentModifiers & ClassFileConstants.AccDeprecated) != 0 || hasDeprecatedAnnotation(typeDeclaration.annotations); boolean isEnumInit = typeDeclaration.allocation != null && typeDeclaration.allocation.enumConstant != null; char[] superclassName; if (isEnumInit) { currentModifiers |= ClassFileConstants.AccEnum; superclassName = declaringType.name; } else { superclassName = getSuperclassName(typeDeclaration); } ISourceElementRequestor.TypeInfo typeInfo = new ISourceElementRequestor.TypeInfo(); if (typeDeclaration.allocation == null) { typeInfo.declarationStart = typeDeclaration.declarationSourceStart; } else if (isEnumInit) { typeInfo.declarationStart = typeDeclaration.allocation.enumConstant.sourceStart; } else { typeInfo.declarationStart = typeDeclaration.allocation.sourceStart; } typeInfo.modifiers = deprecated ? (currentModifiers & ExtraCompilerModifiers.AccJustFlag) | ClassFileConstants.AccDeprecated : currentModifiers & ExtraCompilerModifiers.AccJustFlag; typeInfo.name = typeDeclaration.name; typeInfo.nameSourceStart = isEnumInit ? typeDeclaration.allocation.enumConstant.sourceStart : typeDeclaration.sourceStart; typeInfo.nameSourceEnd = sourceEnd(typeDeclaration); typeInfo.superclass = superclassName; typeInfo.superinterfaces = interfaceNames; typeInfo.typeParameters = getTypeParameterInfos(typeDeclaration.typeParameters); typeInfo.categories = (char[][]) this.nodesToCategories.get(typeDeclaration); typeInfo.secondary = typeDeclaration.isSecondary(); typeInfo.anonymousMember = typeDeclaration.allocation != null && typeDeclaration.allocation.enclosingInstance != null; typeInfo.annotations = typeDeclaration.annotations; typeInfo.node = typeDeclaration; requestor.enterType(typeInfo, isAspect, (isAspect ? ((AspectDeclaration) ajtypeDeclaration).isPrivileged : false)); // AspectJ change switch (kind) { case TypeDeclaration.CLASS_DECL: if (superclassName != null) implicitSuperclassName = superclassName; break; case TypeDeclaration.INTERFACE_DECL: implicitSuperclassName = TypeConstants.CharArray_JAVA_LANG_OBJECT; break; case TypeDeclaration.ENUM_DECL: implicitSuperclassName = TypeConstants.CharArray_JAVA_LANG_ENUM; break; case TypeDeclaration.ANNOTATION_TYPE_DECL: implicitSuperclassName = TypeConstants.CharArray_JAVA_LANG_ANNOTATION_ANNOTATION; break; } } if (this.nestedTypeIndex == this.typeNames.length) { // need a resize System.arraycopy(this.typeNames, 0, (this.typeNames = new char[this.nestedTypeIndex * 2][]), 0, this.nestedTypeIndex); System.arraycopy(this.superTypeNames, 0, (this.superTypeNames = new char[this.nestedTypeIndex * 2][]), 0, this.nestedTypeIndex); } this.typeNames[this.nestedTypeIndex] = typeDeclaration.name; this.superTypeNames[this.nestedTypeIndex++] = implicitSuperclassName; } while ((fieldIndex < fieldCounter) || (memberTypeIndex < memberTypeCounter) || (methodIndex < methodCounter)) { FieldDeclaration nextFieldDeclaration = null; AbstractMethodDeclaration nextMethodDeclaration = null; TypeDeclaration nextMemberDeclaration = null; int position = Integer.MAX_VALUE; int nextDeclarationType = -1; if (fieldIndex < fieldCounter) { nextFieldDeclaration = fields[fieldIndex]; if (nextFieldDeclaration.declarationSourceStart < position) { position = nextFieldDeclaration.declarationSourceStart; nextDeclarationType = 0; // FIELD } } if (methodIndex < methodCounter) { nextMethodDeclaration = methods[methodIndex]; if (nextMethodDeclaration.declarationSourceStart < position) { position = nextMethodDeclaration.declarationSourceStart; nextDeclarationType = 1; // METHOD } } if (memberTypeIndex < memberTypeCounter) { nextMemberDeclaration = memberTypes[memberTypeIndex]; if (nextMemberDeclaration.declarationSourceStart < position) { position = nextMemberDeclaration.declarationSourceStart; nextDeclarationType = 2; // MEMBER } } switch (nextDeclarationType) { case 0: fieldIndex++; notifySourceElementRequestor(nextFieldDeclaration, typeDeclaration); break; case 1: methodIndex++; notifySourceElementRequestor(nextMethodDeclaration); break; case 2: memberTypeIndex++; notifySourceElementRequestor(nextMemberDeclaration, true, null); } } if (notifyTypePresence) { if (isInRange) { requestor.exitType(typeDeclaration.declarationSourceEnd); } nestedTypeIndex--; } }