/** * @see ISourceType */ public ISourceField[] getFields() { SourceField[] fieldHandles = getFieldHandles(); int length = fieldHandles.length; ISourceField[] fields = new ISourceField[length]; for (int i = 0; i < length; i++) { try { ISourceField field = (ISourceField) fieldHandles[i].getElementInfo(); fields[i] = field; } catch (JavaModelException e) { // ignore } } return fields; } public SourceField[] getFieldHandles() {
@Override public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, AccessRestriction accessRestriction) { // Need to reparse the entire source of the compilation unit so as to get source positions // (case of processing a source that was not known by beginToCompile (e.g. when asking to createBinding)) SourceTypeElementInfo sourceType = (SourceTypeElementInfo) sourceTypes[0]; accept((org.eclipse.jdt.internal.compiler.env.ICompilationUnit) sourceType.getHandle().getCompilationUnit(), accessRestriction); }
/** * @see IType */ public String[] getSuperInterfaceNames() throws JavaModelException { SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); char[][] names= info.getInterfaceNames(); return CharOperation.toStrings(names); }
private TypeDeclaration convert(SourceType typeHandle, CompilationResult compilationResult) throws JavaModelException { SourceTypeElementInfo typeInfo = (SourceTypeElementInfo) typeHandle.getElementInfo(); if (typeInfo.isAnonymousMember()) throw new AnonymousMemberFound(); if (typeInfo.getEnclosingType() == null) { if (typeHandle.isAnonymous()) { type.name = CharOperation.NO_CHAR; type.name = typeInfo.getName(); type.name = typeInfo.getName(); int start, end; // only positions available type.sourceStart = start = typeInfo.getNameSourceStart(); type.sourceEnd = end = typeInfo.getNameSourceEnd(); type.modifiers = typeInfo.getModifiers(); type.declarationSourceStart = typeInfo.getDeclarationSourceStart(); type.declarationSourceEnd = typeInfo.getDeclarationSourceEnd(); type.bodyEnd = type.declarationSourceEnd; char[][] typeParameterNames = typeInfo.getTypeParameterNames(); if (typeParameterNames.length > 0) { int parameterCount = typeParameterNames.length; char[][][] typeParameterBounds = typeInfo.getTypeParameterBounds(); type.typeParameters = new TypeParameter[parameterCount]; for (int i = 0; i < parameterCount; i++) { if (typeInfo.getSuperclassName() != null) { type.superclass = createTypeReference(typeInfo.getSuperclassName(), start, end, true /* include generics */); type.superclass.bits |= ASTNode.IsSuperType;
SourceTypeElementInfo oldSourceTypeInfo = (SourceTypeElementInfo)oldInfo; SourceTypeElementInfo newSourceTypeInfo = (SourceTypeElementInfo)newInfo; if (!CharOperation.equals(oldSourceTypeInfo.getSuperclassName(), newSourceTypeInfo.getSuperclassName()) || !CharOperation.equals(oldSourceTypeInfo.getInterfaceNames(), newSourceTypeInfo.getInterfaceNames())) { this.delta.changed(newElement, IJavaElementDelta.F_SUPER_TYPES); if (!CharOperation.equals(oldSourceTypeInfo.getTypeParameterNames(), newSourceTypeInfo.getTypeParameterNames()) || !equals(oldSourceTypeInfo.getTypeParameterBounds(), newSourceTypeInfo.getTypeParameterBounds())) { this.delta.changed(newElement, IJavaElementDelta.F_CONTENT);
/** * @see IType#isAnnotation() * @since 3.0 */ @Override public boolean isAnnotation() throws JavaModelException { SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); return TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.ANNOTATION_TYPE_DECL; }
/** * @see ISourceType */ public ISourceType[] getMemberTypes() { SourceType[] memberTypeHandles = getMemberTypeHandles(); int length = memberTypeHandles.length; ISourceType[] memberTypes = new ISourceType[length]; for (int i = 0; i < length; i++) { try { ISourceType type = (ISourceType) memberTypeHandles[i].getElementInfo(); memberTypes[i] = type; } catch (JavaModelException e) { // ignore } } return memberTypes; } public SourceType[] getMemberTypeHandles() {
/** * @see ISourceType */ public ISourceMethod[] getMethods() { SourceMethod[] methodHandles = getMethodHandles(); int length = methodHandles.length; ISourceMethod[] methods = new ISourceMethod[length]; int methodIndex = 0; for (int i = 0; i < length; i++) { try { ISourceMethod method = (ISourceMethod) methodHandles[i].getElementInfo(); methods[methodIndex++] = method; } catch (JavaModelException e) { // ignore } } return methods; } public SourceMethod[] getMethodHandles() {
private TypeDeclaration convert(SourceType typeHandle, CompilationResult compilationResult) throws JavaModelException { SourceTypeElementInfo typeInfo = (SourceTypeElementInfo) typeHandle.getElementInfo(); if (typeInfo.isAnonymousMember()) throw new AnonymousMemberFound(); if (typeInfo.getEnclosingType() == null) { if (typeHandle.isAnonymous()) { type.name = CharOperation.NO_CHAR; type.name = typeInfo.getName(); type.name = typeInfo.getName(); int start, end; // only positions available type.sourceStart = start = typeInfo.getNameSourceStart(); type.sourceEnd = end = typeInfo.getNameSourceEnd(); type.modifiers = typeInfo.getModifiers(); type.declarationSourceStart = typeInfo.getDeclarationSourceStart(); type.declarationSourceEnd = typeInfo.getDeclarationSourceEnd(); type.bodyEnd = type.declarationSourceEnd; char[][] typeParameterNames = typeInfo.getTypeParameterNames(); if (typeParameterNames.length > 0) { int parameterCount = typeParameterNames.length; char[][][] typeParameterBounds = typeInfo.getTypeParameterBounds(); type.typeParameters = new TypeParameter[parameterCount]; for (int i = 0; i < parameterCount; i++) { if (typeInfo.getSuperclassName() != null) { type.superclass = createTypeReference(typeInfo.getSuperclassName(), start, end, true /* include generics */); type.superclass.bits |= ASTNode.IsSuperType;
SourceTypeElementInfo oldSourceTypeInfo = (SourceTypeElementInfo)oldInfo; SourceTypeElementInfo newSourceTypeInfo = (SourceTypeElementInfo)newInfo; if (!CharOperation.equals(oldSourceTypeInfo.getSuperclassName(), newSourceTypeInfo.getSuperclassName()) || !CharOperation.equals(oldSourceTypeInfo.getInterfaceNames(), newSourceTypeInfo.getInterfaceNames())) { this.delta.changed(newElement, IJavaElementDelta.F_SUPER_TYPES); if (!CharOperation.equals(oldSourceTypeInfo.getTypeParameterNames(), newSourceTypeInfo.getTypeParameterNames()) || !equals(oldSourceTypeInfo.getTypeParameterBounds(), newSourceTypeInfo.getTypeParameterBounds())) { this.delta.changed(newElement, IJavaElementDelta.F_CONTENT);
/** * @see IType#isEnum() * @since 3.0 */ public boolean isEnum() throws JavaModelException { SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); return TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.ENUM_DECL; }
/** * @see ISourceType */ public ISourceType[] getMemberTypes() { SourceType[] memberTypeHandles = getMemberTypeHandles(); int length = memberTypeHandles.length; ISourceType[] memberTypes = new ISourceType[length]; for (int i = 0; i < length; i++) { try { ISourceType type = (ISourceType) memberTypeHandles[i].getElementInfo(); memberTypes[i] = type; } catch (JavaModelException e) { // ignore } } return memberTypes; } public SourceType[] getMemberTypeHandles() {
/** * @see ISourceType */ public ISourceMethod[] getMethods() { SourceMethod[] methodHandles = getMethodHandles(); int length = methodHandles.length; ISourceMethod[] methods = new ISourceMethod[length]; int methodIndex = 0; for (int i = 0; i < length; i++) { try { ISourceMethod method = (ISourceMethod) methodHandles[i].getElementInfo(); methods[methodIndex++] = method; } catch (JavaModelException e) { // ignore } } return methods; } public SourceMethod[] getMethodHandles() {
private TypeDeclaration convert(SourceType typeHandle, CompilationResult compilationResult) throws JavaModelException { SourceTypeElementInfo typeInfo = (SourceTypeElementInfo) typeHandle.getElementInfo(); if (typeInfo.isAnonymousMember()) throw new AnonymousMemberFound(); if (typeInfo.getEnclosingType() == null) { if (typeHandle.isAnonymous()) { type.name = CharOperation.NO_CHAR; type.name = typeInfo.getName(); type.name = typeInfo.getName(); int start, end; // only positions available type.sourceStart = start = typeInfo.getNameSourceStart(); type.sourceEnd = end = typeInfo.getNameSourceEnd(); type.modifiers = typeInfo.getModifiers(); type.declarationSourceStart = typeInfo.getDeclarationSourceStart(); type.declarationSourceEnd = typeInfo.getDeclarationSourceEnd(); type.bodyEnd = type.declarationSourceEnd; char[][] typeParameterNames = typeInfo.getTypeParameterNames(); if (typeParameterNames.length > 0) { int parameterCount = typeParameterNames.length; char[][][] typeParameterBounds = typeInfo.getTypeParameterBounds(); type.typeParameters = new TypeParameter[parameterCount]; for (int i = 0; i < parameterCount; i++) { if (typeInfo.getSuperclassName() != null) { type.superclass = createTypeReference(typeInfo.getSuperclassName(), start, end, true /* include generics */); type.superclass.bits |= ASTNode.IsSuperType;
SourceTypeElementInfo oldSourceTypeInfo = (SourceTypeElementInfo)oldInfo; SourceTypeElementInfo newSourceTypeInfo = (SourceTypeElementInfo)newInfo; if (!CharOperation.equals(oldSourceTypeInfo.getSuperclassName(), newSourceTypeInfo.getSuperclassName()) || !CharOperation.equals(oldSourceTypeInfo.getInterfaceNames(), newSourceTypeInfo.getInterfaceNames())) { this.delta.changed(newElement, IJavaElementDelta.F_SUPER_TYPES); if (!CharOperation.equals(oldSourceTypeInfo.getTypeParameterNames(), newSourceTypeInfo.getTypeParameterNames()) || !equals(oldSourceTypeInfo.getTypeParameterBounds(), newSourceTypeInfo.getTypeParameterBounds())) { this.delta.changed(newElement, IJavaElementDelta.F_CONTENT);
public void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, AccessRestriction accessRestriction) { // Need to reparse the entire source of the compilation unit so as to get source positions // (case of processing a source that was not known by beginToCompile (e.g. when asking to createBinding)) SourceTypeElementInfo sourceType = (SourceTypeElementInfo) sourceTypes[0]; accept((org.eclipse.jdt.internal.compiler.env.ICompilationUnit) sourceType.getHandle().getCompilationUnit(), accessRestriction); }
/** * @see IType#isEnum() * @since 3.0 */ @Override public boolean isEnum() throws JavaModelException { SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); return TypeDeclaration.kind(info.getModifiers()) == TypeDeclaration.ENUM_DECL; }
/** * @see IType */ @Override public String[] getSuperInterfaceNames() throws JavaModelException { SourceTypeElementInfo info = (SourceTypeElementInfo) getElementInfo(); char[][] names= info.getInterfaceNames(); return CharOperation.toStrings(names); }
/** * @see ISourceType */ public ISourceField[] getFields() { SourceField[] fieldHandles = getFieldHandles(); int length = fieldHandles.length; ISourceField[] fields = new ISourceField[length]; for (int i = 0; i < length; i++) { try { ISourceField field = (ISourceField) fieldHandles[i].getElementInfo(); fields[i] = field; } catch (JavaModelException e) { // ignore } } return fields; } public SourceField[] getFieldHandles() {
/** * @see ISourceType */ @Override public ISourceType[] getMemberTypes() { SourceType[] memberTypeHandles = getMemberTypeHandles(); int length = memberTypeHandles.length; ISourceType[] memberTypes = new ISourceType[length]; for (int i = 0; i < length; i++) { try { ISourceType type = (ISourceType) memberTypeHandles[i].getElementInfo(); memberTypes[i] = type; } catch (JavaModelException e) { // ignore } } return memberTypes; } public SourceType[] getMemberTypeHandles() {