### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/core/compiler/CharOperation.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java,v retrieving revision 1.89 diff -u -r1.89 CharOperation.java --- compiler/org/eclipse/jdt/core/compiler/CharOperation.java 19 Nov 2010 19:06:48 -0000 1.89 +++ compiler/org/eclipse/jdt/core/compiler/CharOperation.java 25 Jan 2011 16:14:44 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2514,10 +2514,17 @@ /* check first segment */ char patternChar = 0; - while ((iPattern < patternEnd) - && (patternChar = pattern[iPattern]) != '*') { - if (iName == nameEnd) - return false; + while (true) { + if (iPattern == patternEnd) { + if (iName == nameEnd) return true; // the chars match + return false; // pattern has ended but not the name, no match + } + if ((patternChar = pattern[iPattern]) == '*') { + break; + } + if (iName == nameEnd) { + return false; // name has ended but not the pattern + } if (patternChar != (isCaseSensitive ? name[iName] #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java,v retrieving revision 1.37 diff -u -r1.37 UtilTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java 27 Jun 2008 16:04:45 -0000 1.37 +++ src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java 25 Jan 2011 16:14:47 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -738,6 +738,12 @@ // Verify that there were no unexpected results assertTrue(this.camelCaseErrors.toString(), this.camelCaseErrors.length()==0); } +// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=324189 +public void test74() { + + assertTrue("Pattern matching failure", + !CharOperation.match("A".toCharArray(), "AnotherA".toCharArray(), true)); +} public static Class testClass() { return UtilTest.class; } #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v retrieving revision 1.213 diff -u -r1.213 JavaSearchBugsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 21 Jan 2011 14:47:16 -0000 1.213 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 25 Jan 2011 16:14:54 -0000 @@ -12809,4 +12809,19 @@ deleteProject("P"); } } +// Test the special case in comment 20 of bug 324189 +public void testBug324189e() throws CoreException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/b324189/A.java", + "package b324189;\n" + + "public class A{\n" + + " public void run() {}\n" + + "}\n"+ + "class AnotherA {" + + " public void run() {} \n" + + " }\n" + ); + search("A.run()", METHOD, DECLARATIONS); + assertSearchResults("src/b324189/A.java void b324189.A.run() [run] EXACT_MATCH"); +} } \ No newline at end of file