Example usage for org.eclipse.jdt.internal.compiler.env IBinaryType getFields

List of usage examples for org.eclipse.jdt.internal.compiler.env IBinaryType getFields

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.env IBinaryType getFields.

Prototype


IBinaryField[] getFields();

Source Link

Document

Answer the receiver's fields or null if the array is empty.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.ClassFileInfo.java

License:Open Source License

/**
 * Creates the handles and infos for the fields of the given binary type.
 * Adds new handles to the given vector.
 *///from   www. j a va  2 s  .c o  m
private void generateFieldInfos(IType type, IBinaryType typeInfo, HashMap newElements,
        ArrayList childrenHandles) {
    // Make the fields
    IBinaryField[] fields = typeInfo.getFields();
    if (fields == null) {
        return;
    }
    JavaModelManager manager = ((JavaElement) type).manager;
    for (int i = 0, fieldCount = fields.length; i < fieldCount; i++) {
        IBinaryField fieldInfo = fields[i];
        BinaryField field = new BinaryField((JavaElement) type, manager,
                manager.intern(new String(fieldInfo.getName())));
        newElements.put(field, fieldInfo);
        childrenHandles.add(field);
        generateAnnotationsInfos(field, fieldInfo.getAnnotations(), fieldInfo.getTagBits(), newElements);
    }
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.ClassFileMatchLocator.java

License:Open Source License

/**
 * Locate declaration in the current class file. This class file is always in a jar.
 *///from w  ww  .  j  av a 2s  .c o m
public void locateMatches(MatchLocator locator, ClassFile classFile, IBinaryType info) throws CoreException {
    SearchPattern pattern = locator.pattern;

    // check annotations references
    matchAnnotations(pattern, locator, classFile, info);

    // check class definition
    BinaryType binaryType = (BinaryType) classFile.getType();
    if (matchBinary(pattern, info, null)) {
        binaryType = new ResolvedBinaryType((JavaElement) binaryType.getParent(), binaryType.getElementName(),
                binaryType.getKey());
        locator.reportBinaryMemberDeclaration(null, binaryType, null, info, SearchMatch.A_ACCURATE);
        return;
    }

    // Define arrays to store methods/fields from binary type if necessary
    IBinaryMethod[] binaryMethods = info.getMethods();
    int bMethodsLength = binaryMethods == null ? 0 : binaryMethods.length;
    IBinaryMethod[] unresolvedMethods = null;
    char[][] binaryMethodSignatures = null;
    boolean hasUnresolvedMethods = false;

    // Get fields from binary type info
    IBinaryField[] binaryFields = info.getFields();
    int bFieldsLength = binaryFields == null ? 0 : binaryFields.length;
    IBinaryField[] unresolvedFields = null;
    boolean hasUnresolvedFields = false;

    // Report as many accurate matches as possible
    int accuracy = SearchMatch.A_ACCURATE;
    boolean mustResolve = pattern.mustResolve;
    if (mustResolve) {
        BinaryTypeBinding binding = locator.cacheBinaryType(binaryType, info);
        if (binding != null) {
            // filter out element not in hierarchy scope
            if (!locator.typeInHierarchy(binding))
                return;

            // Search matches on resolved methods
            MethodBinding[] availableMethods = binding.availableMethods();
            int aMethodsLength = availableMethods == null ? 0 : availableMethods.length;
            hasUnresolvedMethods = bMethodsLength != aMethodsLength;
            for (int i = 0; i < aMethodsLength; i++) {
                MethodBinding method = availableMethods[i];
                char[] methodSignature = method.genericSignature();
                if (methodSignature == null)
                    methodSignature = method.signature();

                // Report the match if possible
                int level = locator.patternLocator.resolveLevel(method);
                if (level != PatternLocator.IMPOSSIBLE_MATCH) {
                    IMethod methodHandle = binaryType.getMethod(
                            new String(method.isConstructor()
                                    ? binding.compoundName[binding.compoundName.length - 1]
                                    : method.selector),
                            CharOperation.toStrings(
                                    Signature.getParameterTypes(convertClassFileFormat(methodSignature))));
                    accuracy = level == PatternLocator.ACCURATE_MATCH ? SearchMatch.A_ACCURATE
                            : SearchMatch.A_INACCURATE;
                    locator.reportBinaryMemberDeclaration(null, methodHandle, method, info, accuracy);
                }

                // Remove method from unresolved list
                if (hasUnresolvedMethods) {
                    if (binaryMethodSignatures == null) { // Store binary method signatures to avoid multiple computation
                        binaryMethodSignatures = new char[bMethodsLength][];
                        for (int j = 0; j < bMethodsLength; j++) {
                            IBinaryMethod binaryMethod = binaryMethods[j];
                            char[] signature = binaryMethod.getGenericSignature();
                            if (signature == null)
                                signature = binaryMethod.getMethodDescriptor();
                            binaryMethodSignatures[j] = signature;
                        }
                    }
                    for (int j = 0; j < bMethodsLength; j++) {
                        if (CharOperation.equals(binaryMethods[j].getSelector(), method.selector)
                                && CharOperation.equals(binaryMethodSignatures[j], methodSignature)) {
                            if (unresolvedMethods == null) {
                                System.arraycopy(binaryMethods, 0,
                                        unresolvedMethods = new IBinaryMethod[bMethodsLength], 0,
                                        bMethodsLength);
                            }
                            unresolvedMethods[j] = null;
                            break;
                        }
                    }
                }
            }

            // Search matches on resolved fields
            FieldBinding[] availableFields = binding.availableFields();
            int aFieldsLength = availableFields == null ? 0 : availableFields.length;
            hasUnresolvedFields = bFieldsLength != aFieldsLength;
            for (int i = 0; i < aFieldsLength; i++) {
                FieldBinding field = availableFields[i];

                // Report the match if possible
                int level = locator.patternLocator.resolveLevel(field);
                if (level != PatternLocator.IMPOSSIBLE_MATCH) {
                    IField fieldHandle = binaryType.getField(new String(field.name));
                    accuracy = level == PatternLocator.ACCURATE_MATCH ? SearchMatch.A_ACCURATE
                            : SearchMatch.A_INACCURATE;
                    locator.reportBinaryMemberDeclaration(null, fieldHandle, field, info, accuracy);
                }

                // Remove the field from unresolved list
                if (hasUnresolvedFields) {
                    for (int j = 0; j < bFieldsLength; j++) {
                        if (CharOperation.equals(binaryFields[j].getName(), field.name)) {
                            if (unresolvedFields == null) {
                                System.arraycopy(binaryFields, 0,
                                        unresolvedFields = new IBinaryField[bFieldsLength], 0, bFieldsLength);
                            }
                            unresolvedFields[j] = null;
                            break;
                        }
                    }
                }
            }

            // If all methods/fields were accurate then returns now
            if (!hasUnresolvedMethods && !hasUnresolvedFields) {
                return;
            }
        }
        accuracy = SearchMatch.A_INACCURATE;
    }

    // Report inaccurate methods
    if (mustResolve)
        binaryMethods = unresolvedMethods;
    bMethodsLength = binaryMethods == null ? 0 : binaryMethods.length;
    for (int i = 0; i < bMethodsLength; i++) {
        IBinaryMethod method = binaryMethods[i];
        if (method == null)
            continue; // impossible match or already reported as accurate
        if (matchBinary(pattern, method, info)) {
            char[] name;
            if (method.isConstructor()) {
                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=329727
                // We don't need the enclosing type name for the constructor name
                name = info.getSourceName();
            } else {
                name = method.getSelector();
            }
            String selector = new String(name);
            char[] methodSignature = binaryMethodSignatures == null ? null : binaryMethodSignatures[i];
            if (methodSignature == null) {
                methodSignature = method.getGenericSignature();
                if (methodSignature == null)
                    methodSignature = method.getMethodDescriptor();
            }
            String[] parameterTypes = CharOperation
                    .toStrings(Signature.getParameterTypes(convertClassFileFormat(methodSignature)));
            IMethod methodHandle = binaryType.getMethod(selector, parameterTypes);
            methodHandle = new ResolvedBinaryMethod(binaryType, selector, parameterTypes,
                    methodHandle.getKey());
            locator.reportBinaryMemberDeclaration(null, methodHandle, null, info, accuracy);
        }
    }

    // Report inaccurate fields
    if (mustResolve)
        binaryFields = unresolvedFields;
    bFieldsLength = binaryFields == null ? 0 : binaryFields.length;
    for (int i = 0; i < bFieldsLength; i++) {
        IBinaryField field = binaryFields[i];
        if (field == null)
            continue; // impossible match or already reported as accurate
        if (matchBinary(pattern, field, info)) {
            String fieldName = new String(field.getName());
            IField fieldHandle = binaryType.getField(fieldName);
            fieldHandle = new ResolvedBinaryField(binaryType, fieldName, fieldHandle.getKey());
            locator.reportBinaryMemberDeclaration(null, fieldHandle, null, info, accuracy);
        }
    }
}

From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.ClassFileMatchLocator.java

License:Open Source License

private void matchAnnotations(SearchPattern pattern, MatchLocator locator, ClassFile classFile,
        IBinaryType binaryType) throws CoreException {
    // Only process TypeReference patterns
    switch (pattern.kind) {
    case TYPE_REF_PATTERN:
        break;/*from   w ww  .j  a  v a 2s .  c  om*/
    case OR_PATTERN:
        SearchPattern[] patterns = ((OrPattern) pattern).patterns;
        for (int i = 0, length = patterns.length; i < length; i++) {
            matchAnnotations(patterns[i], locator, classFile, binaryType);
        }
        // $FALL-THROUGH$ - fall through default to return
    default:
        return;
    }
    TypeReferencePattern typeReferencePattern = (TypeReferencePattern) pattern;

    // Look for references in class annotations
    IBinaryAnnotation[] annotations = binaryType.getAnnotations();
    BinaryType classFileBinaryType = (BinaryType) classFile.getType();
    BinaryTypeBinding binaryTypeBinding = null;
    if (checkAnnotations(typeReferencePattern, annotations, binaryType.getTagBits())) {
        classFileBinaryType = new ResolvedBinaryType((JavaElement) classFileBinaryType.getParent(),
                classFileBinaryType.getElementName(), classFileBinaryType.getKey());
        TypeReferenceMatch match = new TypeReferenceMatch(classFileBinaryType, SearchMatch.A_ACCURATE, -1, 0,
                false, locator.getParticipant(), locator.currentPossibleMatch.resource);
        // TODO 3.4 M7 (frederic) - bug 209996: see how create the annotation handle from the binary and put it in the local element
        match.setLocalElement(null);
        locator.report(match);
    }

    // Look for references in methods annotations
    MethodInfo[] methods = (MethodInfo[]) binaryType.getMethods();
    if (methods != null) {
        for (int i = 0, max = methods.length; i < max; i++) {
            MethodInfo method = methods[i];
            if (checkAnnotations(typeReferencePattern, method.getAnnotations(), method.getTagBits())) {
                binaryTypeBinding = locator.cacheBinaryType(classFileBinaryType, binaryType);
                IMethod methodHandle = classFileBinaryType
                        .getMethod(
                                new String(method.isConstructor()
                                        ? binaryTypeBinding.compoundName[binaryTypeBinding.compoundName.length
                                                - 1]
                                        : method.getSelector()),
                                CharOperation.toStrings(Signature.getParameterTypes(
                                        convertClassFileFormat(method.getMethodDescriptor()))));
                TypeReferenceMatch match = new TypeReferenceMatch(methodHandle, SearchMatch.A_ACCURATE, -1, 0,
                        false, locator.getParticipant(), locator.currentPossibleMatch.resource);
                // TODO 3.4 M7 (frederic) - bug 209996: see how create the annotation handle from the binary and put it in the local element
                match.setLocalElement(null);
                locator.report(match);
            }
        }
    }

    // Look for references in fields annotations
    FieldInfo[] fields = (FieldInfo[]) binaryType.getFields();
    if (fields != null) {
        for (int i = 0, max = fields.length; i < max; i++) {
            FieldInfo field = fields[i];
            if (checkAnnotations(typeReferencePattern, field.getAnnotations(), field.getTagBits())) {
                IField fieldHandle = classFileBinaryType.getField(new String(field.getName()));
                TypeReferenceMatch match = new TypeReferenceMatch(fieldHandle, SearchMatch.A_ACCURATE, -1, 0,
                        false, locator.getParticipant(), locator.currentPossibleMatch.resource);
                // TODO 3.4 M7 (frederic) - bug 209996: see how create the annotation handle from the binary and put it in the local element
                match.setLocalElement(null);
                locator.report(match);
            }
        }
    }
}

From source file:io.takari.maven.plugins.compile.jdt.ClassfileDigester.java

License:Open Source License

public byte[] digest(IBinaryType classFile) {

    // type level comparison
    // modifiers/*from ww  w  .jav  a 2  s .c  o  m*/
    updateInt(classFile.getModifiers());

    // only consider a portion of the tagbits which indicate a structural change for dependents
    // e.g. @Override change has no influence outside
    long OnlyStructuralTagBits = TagBits.AnnotationTargetMASK // different @Target status ?
            | TagBits.AnnotationDeprecated // different @Deprecated status ?
            | TagBits.AnnotationRetentionMASK // different @Retention status ?
            | TagBits.HierarchyHasProblems; // different hierarchy status ?

    // meta-annotations
    updateLong(classFile.getTagBits() & OnlyStructuralTagBits);
    // annotations
    updateAnnotations(classFile.getAnnotations());

    // generic signature
    updateChars(classFile.getGenericSignature());
    // superclass
    updateChars(classFile.getSuperclassName());
    // interfaces
    char[][] interfacesNames = classFile.getInterfaceNames();
    if (interfacesNames != null) {
        for (int i = 0; i < interfacesNames.length; i++) {
            updateChars(interfacesNames[i]);
        }
    }

    // member types
    IBinaryNestedType[] memberTypes = classFile.getMemberTypes();
    if (memberTypes != null) {
        for (int i = 0; i < memberTypes.length; i++) {
            updateChars(memberTypes[i].getName());
            updateInt(memberTypes[i].getModifiers());
        }
    }

    // fields
    FieldInfo[] fieldInfos = (FieldInfo[]) classFile.getFields();
    if (fieldInfos != null) {
        for (int i = 0; i < fieldInfos.length; i++) {
            updateField(fieldInfos[i]);
        }
    }

    // methods
    MethodInfo[] methodInfos = (MethodInfo[]) classFile.getMethods();
    if (methodInfos != null) {
        for (int i = 0; i < methodInfos.length; i++) {
            updateMethod(methodInfos[i]);
        }
    }

    // missing types
    char[][][] missingTypes = classFile.getMissingTypeNames();
    if (missingTypes != null) {
        for (int i = 0; i < missingTypes.length; i++) {
            for (int j = 0; j < missingTypes[i].length; j++) {
                if (j > 0) {
                    updateChar('.'); // don't ask why
                }
                updateChars(missingTypes[i][j]);
            }
        }
    }

    return digester.digest();
}

From source file:org.eclipse.che.jdt.BinaryTypeConvector.java

License:Open Source License

public static String toJsonBinaryType(IBinaryType type) {
    JsonObject object = new JsonObject();
    object.add("annotations", toJsonAnnotations(type.getAnnotations()));
    object.add("enclosingMethod", type.getEnclosingMethod() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.getEnclosingMethod())));
    object.add("enclosingTypeName", type.getEnclosingTypeName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.getEnclosingTypeName())));
    object.add("fields", toJsonFields(type.getFields()));
    object.add("genericSignature", type.getGenericSignature() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.getGenericSignature())));
    object.add("interfaceNames", toJsonArrayString(type.getInterfaceNames()));
    object.add("memberTypes", toJsonMemberTypes(type.getMemberTypes()));
    object.add("methods", toJsonMethods(type.getMethods()));
    object.add("missingTypeNames", toJsonMissingTypeNames(type.getMissingTypeNames()));
    object.add("name",
            type.getName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(type.getName())));
    object.add("sourceName", type.getSourceName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.getSourceName())));
    object.add("superclassName", type.getSuperclassName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.getSuperclassName())));
    object.add("tagBits", new JsonPrimitive(String.valueOf(type.getTagBits())));
    object.add("anonymous", new JsonPrimitive(type.isAnonymous()));
    object.add("local", new JsonPrimitive(type.isLocal()));
    object.add("member", new JsonPrimitive(type.isMember()));
    object.add("sourceFileName", type.sourceFileName() == null ? JsonNull.INSTANCE
            : new JsonPrimitive(new String(type.sourceFileName())));
    object.add("modifiers", new JsonPrimitive(type.getModifiers()));
    object.add("binaryType", new JsonPrimitive(type.isBinaryType()));
    object.add("fileName",
            type.getFileName() == null ? JsonNull.INSTANCE : new JsonPrimitive(new String(type.getFileName())));
    return gson.toJson(object);
}

From source file:org.eclipse.che.jdt.internal.core.search.matching.ClassFileMatchLocator.java

License:Open Source License

/**
 * Locate declaration in the current class file. This class file is always in a jar.
 *//* w  w w.j a va 2  s. c o  m*/
public void locateMatches(MatchLocator locator, ClassFile classFile, IBinaryType info) throws CoreException {
    SearchPattern pattern = locator.pattern;

    // check annotations references
    matchAnnotations(pattern, locator, classFile, info);

    // check class definition
    BinaryType binaryType = (BinaryType) classFile.getType();
    if (matchBinary(pattern, info, null)) {
        binaryType = new ResolvedBinaryType((JavaElement) binaryType.getParent(), binaryType.getElementName(),
                binaryType.getKey());
        locator.reportBinaryMemberDeclaration(null, binaryType, null, info, SearchMatch.A_ACCURATE);
        return;
    }

    // Define arrays to store methods/fields from binary type if necessary
    IBinaryMethod[] binaryMethods = info.getMethods();
    int bMethodsLength = binaryMethods == null ? 0 : binaryMethods.length;
    IBinaryMethod[] unresolvedMethods = null;
    char[][] binaryMethodSignatures = null;
    boolean hasUnresolvedMethods = false;

    // Get fields from binary type info
    IBinaryField[] binaryFields = info.getFields();
    int bFieldsLength = binaryFields == null ? 0 : binaryFields.length;
    IBinaryField[] unresolvedFields = null;
    boolean hasUnresolvedFields = false;

    // Report as many accurate matches as possible
    int accuracy = SearchMatch.A_ACCURATE;
    boolean mustResolve = pattern.mustResolve;
    if (mustResolve) {
        BinaryTypeBinding binding = locator.cacheBinaryType(binaryType, info);
        if (binding != null) {
            // filter out element not in hierarchy scope
            if (!locator.typeInHierarchy(binding))
                return;

            // Search matches on resolved methods
            MethodBinding[] availableMethods = binding.availableMethods();
            int aMethodsLength = availableMethods == null ? 0 : availableMethods.length;
            hasUnresolvedMethods = bMethodsLength != aMethodsLength;
            for (int i = 0; i < aMethodsLength; i++) {
                MethodBinding method = availableMethods[i];
                char[] methodSignature = method.genericSignature();
                if (methodSignature == null)
                    methodSignature = method.signature();

                // Report the match if possible
                int level = locator.patternLocator.resolveLevel(method);
                if (level != org.eclipse.jdt.internal.core.search.matching.PatternLocator.IMPOSSIBLE_MATCH) {
                    IMethod methodHandle = binaryType.getMethod(
                            new String(method.isConstructor()
                                    ? binding.compoundName[binding.compoundName.length - 1]
                                    : method.selector),
                            CharOperation.toStrings(
                                    Signature.getParameterTypes(convertClassFileFormat(methodSignature))));
                    accuracy = level == org.eclipse.jdt.internal.core.search.matching.PatternLocator.ACCURATE_MATCH
                            ? SearchMatch.A_ACCURATE
                            : SearchMatch.A_INACCURATE;
                    locator.reportBinaryMemberDeclaration(null, methodHandle, method, info, accuracy);
                }

                // Remove method from unresolved list
                if (hasUnresolvedMethods) {
                    if (binaryMethodSignatures == null) { // Store binary method signatures to avoid multiple computation
                        binaryMethodSignatures = new char[bMethodsLength][];
                        for (int j = 0; j < bMethodsLength; j++) {
                            IBinaryMethod binaryMethod = binaryMethods[j];
                            char[] signature = binaryMethod.getGenericSignature();
                            if (signature == null)
                                signature = binaryMethod.getMethodDescriptor();
                            binaryMethodSignatures[j] = signature;
                        }
                    }
                    for (int j = 0; j < bMethodsLength; j++) {
                        if (CharOperation.equals(binaryMethods[j].getSelector(), method.selector)
                                && CharOperation.equals(binaryMethodSignatures[j], methodSignature)) {
                            if (unresolvedMethods == null) {
                                System.arraycopy(binaryMethods, 0,
                                        unresolvedMethods = new IBinaryMethod[bMethodsLength], 0,
                                        bMethodsLength);
                            }
                            unresolvedMethods[j] = null;
                            break;
                        }
                    }
                }
            }

            // Search matches on resolved fields
            FieldBinding[] availableFields = binding.availableFields();
            int aFieldsLength = availableFields == null ? 0 : availableFields.length;
            hasUnresolvedFields = bFieldsLength != aFieldsLength;
            for (int i = 0; i < aFieldsLength; i++) {
                FieldBinding field = availableFields[i];

                // Report the match if possible
                int level = locator.patternLocator.resolveLevel(field);
                if (level != org.eclipse.jdt.internal.core.search.matching.PatternLocator.IMPOSSIBLE_MATCH) {
                    IField fieldHandle = binaryType.getField(new String(field.name));
                    accuracy = level == PatternLocator.ACCURATE_MATCH ? SearchMatch.A_ACCURATE
                            : SearchMatch.A_INACCURATE;
                    locator.reportBinaryMemberDeclaration(null, fieldHandle, field, info, accuracy);
                }

                // Remove the field from unresolved list
                if (hasUnresolvedFields) {
                    for (int j = 0; j < bFieldsLength; j++) {
                        if (CharOperation.equals(binaryFields[j].getName(), field.name)) {
                            if (unresolvedFields == null) {
                                System.arraycopy(binaryFields, 0,
                                        unresolvedFields = new IBinaryField[bFieldsLength], 0, bFieldsLength);
                            }
                            unresolvedFields[j] = null;
                            break;
                        }
                    }
                }
            }

            // If all methods/fields were accurate then returns now
            if (!hasUnresolvedMethods && !hasUnresolvedFields) {
                return;
            }
        }
        accuracy = SearchMatch.A_INACCURATE;
    }

    // Report inaccurate methods
    if (mustResolve)
        binaryMethods = unresolvedMethods;
    bMethodsLength = binaryMethods == null ? 0 : binaryMethods.length;
    for (int i = 0; i < bMethodsLength; i++) {
        IBinaryMethod method = binaryMethods[i];
        if (method == null)
            continue; // impossible match or already reported as accurate
        if (matchBinary(pattern, method, info)) {
            char[] name;
            if (method.isConstructor()) {
                // https://bugs.eclipse.org/bugs/show_bug.cgi?id=329727
                // We don't need the enclosing type name for the constructor name
                name = info.getSourceName();
            } else {
                name = method.getSelector();
            }
            String selector = new String(name);
            char[] methodSignature = binaryMethodSignatures == null ? null : binaryMethodSignatures[i];
            if (methodSignature == null) {
                methodSignature = method.getGenericSignature();
                if (methodSignature == null)
                    methodSignature = method.getMethodDescriptor();
            }
            String[] parameterTypes = CharOperation
                    .toStrings(Signature.getParameterTypes(convertClassFileFormat(methodSignature)));
            IMethod methodHandle = binaryType.getMethod(selector, parameterTypes);
            methodHandle = new ResolvedBinaryMethod(binaryType, selector, parameterTypes,
                    methodHandle.getKey());
            locator.reportBinaryMemberDeclaration(null, methodHandle, null, info, accuracy);
        }
    }

    // Report inaccurate fields
    if (mustResolve)
        binaryFields = unresolvedFields;
    bFieldsLength = binaryFields == null ? 0 : binaryFields.length;
    for (int i = 0; i < bFieldsLength; i++) {
        IBinaryField field = binaryFields[i];
        if (field == null)
            continue; // impossible match or already reported as accurate
        if (matchBinary(pattern, field, info)) {
            String fieldName = new String(field.getName());
            IField fieldHandle = binaryType.getField(fieldName);
            fieldHandle = new ResolvedBinaryField(binaryType, fieldName, fieldHandle.getKey());
            locator.reportBinaryMemberDeclaration(null, fieldHandle, null, info, accuracy);
        }
    }
}