### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java,v retrieving revision 1.34 diff -u -r1.34 ClassFileMatchLocator.java --- search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 18 Jul 2007 14:53:15 -0000 1.34 +++ search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java 19 Jul 2007 13:23:02 -0000 @@ -58,102 +58,115 @@ 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; } - // Get methods from binary type info + // Define arrays to store methods/fields from binary type if necessary IBinaryMethod[] binaryMethods = info.getMethods(); int bMethodsLength = binaryMethods == null ? 0 : binaryMethods.length; - IBinaryMethod[] inaccurateMethods = new IBinaryMethod[bMethodsLength]; + IBinaryMethod[] unresolvedMethods = null; char[][] binaryMethodSignatures = null; - if (bMethodsLength > 0) { - System.arraycopy(binaryMethods, 0, inaccurateMethods, 0, bMethodsLength); - } + boolean hasUnresolvedMethods = false; // Get fields from binary type info IBinaryField[] binaryFields = info.getFields(); int bFieldsLength = binaryFields == null ? 0 : binaryFields.length; - IBinaryField[] inaccurateFields = new IBinaryField[bFieldsLength]; - if (bFieldsLength > 0) { - System.arraycopy(binaryFields, 0, inaccurateFields, 0, bFieldsLength); - } + IBinaryField[] unresolvedFields = null; + boolean hasUnresolvedFields = false; // Report as many accurate matches as possible - if (((InternalSearchPattern)pattern).mustResolve) { + int accuracy = SearchMatch.A_ACCURATE; + boolean mustResolve = ((InternalSearchPattern)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; - // Report accurate methods + // 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]; - int level = locator.patternLocator.resolveLevel(method); char[] methodSignature = method.genericSignature(); if (methodSignature == null) methodSignature = method.signature(); - switch (level) { - case PatternLocator.ACCURATE_MATCH: - IMethod methodHandle = binaryType.getMethod( - new String(method.isConstructor() ? binding.compoundName[binding.compoundName.length-1] : method.selector), - CharOperation.toStrings(Signature.getParameterTypes(convertClassFileFormat(methodSignature)))); - locator.reportBinaryMemberDeclaration(null, methodHandle, method, info, SearchMatch.A_ACCURATE); - // fall through impossible match case to remove the reported method - case PatternLocator.IMPOSSIBLE_MATCH: - // Store binary method signatures to avoid multiple computation - if (binaryMethodSignatures == null) { - binaryMethodSignatures = new char[bMethodsLength][]; - for (int j=0; j