Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 123346 Details for
Bug 261973
[assist] Constructor completion should be improved (bug 6930)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug261973_002.txt (text/plain), 27.15 KB, created by
David Audel
on 2009-01-22 04:06:20 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2009-01-22 04:06:20 EST
Size:
27.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests2.java,v >retrieving revision 1.43 >diff -u -r1.43 CompletionTests2.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests2.java 16 Jan 2009 14:29:34 -0000 1.43 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests2.java 22 Jan 2009 09:01:27 -0000 >@@ -36,6 +36,7 @@ > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.tests.util.Util; > import org.eclipse.jdt.internal.codeassist.RelevanceConstants; >+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.core.JavaModelManager; > > import junit.framework.*; >@@ -2614,7 +2615,7 @@ > assertResults( > "AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_1.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p21, p22), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + > " AllConstructors33[TYPE_REF]{p6930.AllConstructors33, p6930, Lp6930.AllConstructors33;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + >- "AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_1.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p11, p12), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + >+ "AllConstructors33[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors33;, (Lp6930_2.ParamType;Lp6930_2.ParamType;)V, AllConstructors33, (p11, p12), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + > " AllConstructors33[TYPE_REF]{p6930.AllConstructors33, p6930, Lp6930.AllConstructors33;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } finally { >@@ -2623,6 +2624,134 @@ > JavaCore.setOptions(oldOptions); > } > } >+public void testBug6930_34() throws Exception { >+ Hashtable oldOptions = JavaCore.getOptions(); >+ >+ try { >+ Hashtable options = new Hashtable(oldOptions); >+ options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); >+ JavaCore.setOptions(options); >+ >+ IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin"); >+ >+ Map compileOptions = new HashMap(); >+ compileOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE); >+ >+ String[] pathsAndContents = >+ new String[] { >+ "p6930/AllConstructors34.java", >+ "package p6930;\n" + >+ "public class AllConstructors34 {\n" + >+ " public AllConstructors34(Object o) {}\n" + >+ "}" >+ }; >+ createJar( >+ pathsAndContents, >+ p.getProject().getLocation().append("lib6930.jar").toOSString(), >+ compileOptions); >+ >+ addLibraryEntry(p, "/P/lib6930.jar", null); >+ >+ refresh(p); >+ >+ waitUntilIndexesReady(); >+ >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/P/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " new AllConstructors\n" + >+ " }\n" + >+ "}"); >+ >+ // do completion >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); >+ requestor.allowAllRequiredProposals(); >+ NullProgressMonitor monitor = new NullProgressMonitor(); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "AllConstructors"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); >+ >+ assertResults( >+ "AllConstructors34[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors34;, (Ljava.lang.Object;)V, AllConstructors34, (arg0), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + >+ " AllConstructors34[TYPE_REF]{p6930.AllConstructors34, p6930, Lp6930.AllConstructors34;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", >+ requestor.getResults()); >+ } finally { >+ deleteProject("P"); >+ >+ JavaCore.setOptions(oldOptions); >+ } >+} >+public void testBug6930_35() throws Exception { >+ Hashtable oldOptions = JavaCore.getOptions(); >+ >+ try { >+ Hashtable options = new Hashtable(oldOptions); >+ options.put(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); >+ JavaCore.setOptions(options); >+ >+ IJavaProject p = createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin"); >+ >+ Map compileOptions = new HashMap(); >+ compileOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE); >+ >+ String[] pathsAndContents = >+ new String[] { >+ "p6930/AllConstructors35.java", >+ "package p6930;\n" + >+ "public class AllConstructors35 {\n" + >+ " public AllConstructors35(Object o) {}\n" + >+ "}" >+ }; >+ createJar( >+ pathsAndContents, >+ p.getProject().getLocation().append("lib6930.jar").toOSString(), >+ compileOptions); >+ >+ createSourceZip( >+ pathsAndContents, >+ p.getProject().getLocation().append("lib6930src.zip").toOSString()); >+ >+ addLibraryEntry(p, "/P/lib6930.jar", "/P/lib6930src.zip"); >+ >+ refresh(p); >+ >+ waitUntilIndexesReady(); >+ >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/P/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " new AllConstructors\n" + >+ " }\n" + >+ "}"); >+ >+ // do completion >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, false, true, true); >+ requestor.allowAllRequiredProposals(); >+ NullProgressMonitor monitor = new NullProgressMonitor(); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "AllConstructors"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); >+ >+ assertResults( >+ "AllConstructors35[CONSTRUCTOR_INVOCATION]{(), Lp6930.AllConstructors35;, (Ljava.lang.Object;)V, AllConstructors35, (o), "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}\n" + >+ " AllConstructors35[TYPE_REF]{p6930.AllConstructors35, p6930, Lp6930.AllConstructors35;, null, null, "+(R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED)+"}", >+ requestor.getResults()); >+ } finally { >+ deleteProject("P"); >+ >+ JavaCore.setOptions(oldOptions); >+ } >+} > public void testBug79288() throws Exception { > try { > // create variable >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v >retrieving revision 1.191 >diff -u -r1.191 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 22 Oct 2008 08:27:50 -0000 1.191 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 22 Jan 2009 09:01:27 -0000 >@@ -107,7 +107,7 @@ > IProgressMonitor monitor = new NullProgressMonitor(); > monitor.setCanceled(true); /*force completion to abort*/ > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner, monitor); >- assertTrue("Should not be cancelled", false); >+ assertTrue("Should be cancelled", false); > } catch (OperationCanceledException e) { > assertResults( > "", >Index: src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java,v >retrieving revision 1.228 >diff -u -r1.228 AbstractJavaModelTests.java >--- src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 16 Jan 2009 14:29:34 -0000 1.228 >+++ src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java 22 Jan 2009 09:01:22 -0000 >@@ -1129,6 +1129,10 @@ > org.eclipse.jdt.core.tests.util.Util.createJar(javaPathsAndContents, jarPath, "1.4"); > } > >+ protected void createJar(String[] javaPathsAndContents, String jarPath, Map options) throws IOException { >+ org.eclipse.jdt.core.tests.util.Util.createJar(javaPathsAndContents, null, jarPath, null, "1.4", options); >+ } >+ > protected void createJar(String[] javaPathsAndContents, String jarPath, String[] classpath, String compliance) throws IOException { > org.eclipse.jdt.core.tests.util.Util.createJar(javaPathsAndContents, null,jarPath, classpath, compliance); > } >@@ -1610,6 +1614,9 @@ > getWorkspace().run(create, null); > return project; > } >+ public void createSourceZip(String[] pathsAndContents, String zipPath) throws IOException { >+ org.eclipse.jdt.core.tests.util.Util.createSourceZip(pathsAndContents, zipPath); >+ } > public void deleteResource(File resource) { > int retryCount = 0; > while (++retryCount <= 60) { // wait 1 minute at most >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java,v >retrieving revision 1.75 >diff -u -r1.75 Util.java >--- src/org/eclipse/jdt/core/tests/util/Util.java 20 Nov 2008 15:55:05 -0000 1.75 >+++ src/org/eclipse/jdt/core/tests/util/Util.java 22 Jan 2009 09:01:29 -0000 >@@ -360,6 +360,11 @@ > public static void createJar(String[] javaPathsAndContents, String[] extraPathsAndContents, String jarPath, String[] classpath, String compliance) throws IOException { > createJar(javaPathsAndContents, extraPathsAndContents, getCompileOptions(compliance), classpath, jarPath); > } >+public static void createJar(String[] javaPathsAndContents, String[] extraPathsAndContents, String jarPath, String[] classpath, String compliance, Map options) throws IOException { >+ Map compileOptions = getCompileOptions(compliance); >+ compileOptions.putAll(options); >+ createJar(javaPathsAndContents, extraPathsAndContents, compileOptions, classpath, jarPath); >+} > public static void createSourceZip(String[] pathsAndContents, String zipPath) throws IOException { > String sourcesPath = getOutputDirectory() + File.separator + "sources"; > createSourceDir(pathsAndContents, sourcesPath); >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java,v >retrieving revision 1.13 >diff -u -r1.13 InternalCompletionProposal.java >--- codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java 16 Jan 2009 14:29:29 -0000 1.13 >+++ codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java 22 Jan 2009 09:01:32 -0000 >@@ -29,6 +29,7 @@ > import org.eclipse.jdt.internal.compiler.env.IBinaryType; > import org.eclipse.jdt.internal.core.BinaryType; > import org.eclipse.jdt.internal.core.JavaElement; >+import org.eclipse.jdt.internal.core.JavaModelManager; > import org.eclipse.jdt.internal.core.NameLookup; > import org.eclipse.jdt.internal.core.SourceMapper; > >@@ -38,9 +39,7 @@ > */ > public class InternalCompletionProposal extends CompletionProposal { > private static Object NO_ATTACHED_SOURCE = new Object(); >- private static final int OPENED_BYNARY_TYPES_THRESHOLD = 100; // threshold of opened binary to avoid to harm java model cache >- >- >+ > protected CompletionEngine completionEngine; > protected NameLookup nameLookup; > >@@ -220,7 +219,7 @@ > if (this.hasNoParameterNamesFromIndex) { > IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot)type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); > if (packageFragmentRoot.isArchive() || >- this.completionEngine.openedBinaryTypes < OPENED_BYNARY_TYPES_THRESHOLD) { >+ this.completionEngine.openedBinaryTypes < getOpenedBinaryTypesThreshold()) { > SourceMapper mapper = ((JavaElement)method).getSourceMapper(); > if (mapper != null) { > try { >@@ -339,6 +338,10 @@ > protected char[] getDeclarationTypeName() { > return this.declarationTypeName; > } >+ >+ private int getOpenedBinaryTypesThreshold() { >+ return JavaModelManager.getJavaModelManager().getOpenableCacheSize() / 10; >+ } > > protected char[] getPackageName() { > return this.packageName; >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.385 >diff -u -r1.385 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 19 Jan 2009 16:31:45 -0000 1.385 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 22 Jan 2009 09:01:32 -0000 >@@ -5214,56 +5214,30 @@ > } > > if (guessedType != null && guessedType.isValidBinding()) { >- if (guessedType instanceof ReferenceBinding) { >- ReferenceBinding refBinding = (ReferenceBinding) guessedType; >+ if (guessedType instanceof SourceTypeBinding) { >+ SourceTypeBinding refBinding = (SourceTypeBinding) guessedType; > >- MethodBinding bestConstructor = null; >- int[] bestMatchingLengths = null; >- >- MethodBinding[] methods = refBinding.methods(); >+ refBinding.methods(); // force resolution >+ if (refBinding.scope == null || refBinding.scope.referenceContext == null) return null; >+ TypeDeclaration typeDeclaration = refBinding.scope.referenceContext; >+ AbstractMethodDeclaration[] methods = typeDeclaration.methods; > next : for (int i = 0; i < methods.length; i++) { >- MethodBinding method = methods[i]; >+ AbstractMethodDeclaration method = methods[i]; > >- if (!method.isConstructor()) break next; >+ if (method.binding == null || !method.isConstructor()) continue next; > >- TypeBinding[] parameters = method.parameters; >- //TODO take careful of member types >- int parametersLength = parameters == null ? 0 : parameters.length; >- if (parameterCount != parametersLength) continue next; >+ Argument[] arguments = method.arguments; >+ int argumentsLength = arguments == null ? 0 : arguments.length; >+ if (parameterCount != argumentsLength) continue next; > >- int[] matchingLengths = new int[parameterCount]; >- for (int j = 0; j < parametersLength; j++) { >- TypeBinding parameter = parameters[j]; >- >- char[] parameterTypeName; >- if (parameter instanceof ReferenceBinding) { >- parameterTypeName = CharOperation.concatWith(((ReferenceBinding)parameter).compoundName, '.'); >- } else { >- parameterTypeName = parameter.sourceName(); >- } >- >- if (!CharOperation.endsWith(parameterTypeName, parameterTypes[j])) { >+ for (int j = 0; j < argumentsLength; j++) { >+ if (!CharOperation.equals(CharOperation.concatWith(arguments[j].type.getTypeName(), '.'), parameterTypes[j])) { > continue next; > } >- >- int matchingLength = parameterTypes[j].length; >- >- if (bestMatchingLengths != null) { >- if (bestMatchingLengths[j] > matchingLength) { >- continue next; >- } >- } >- >- matchingLengths[j] = matchingLength; > } > >- >- bestConstructor = method; >- bestMatchingLengths = matchingLengths; >+ return getSignature(method.binding); > } >- >- if (bestConstructor == null) return null; >- return getSignature(bestConstructor); > } > } > >Index: search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java,v >retrieving revision 1.59 >diff -u -r1.59 BasicSearchEngine.java >--- search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 21 Jan 2009 15:58:49 -0000 1.59 >+++ search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java 22 Jan 2009 09:01:34 -0000 >@@ -430,43 +430,6 @@ > } > return true; > } >- >- boolean match(char[] patternPkg, char[] patternTypeName, int matchRule, char[] pkg, char[] typeName) { >- >- boolean isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0; >- >- if (patternPkg != null && !CharOperation.equals(patternPkg, pkg, true)) >- return false; >- >- if (patternTypeName != null) { >- boolean isCamelCase = (matchRule & (SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH)) != 0; >- int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK; >- if (!isCaseSensitive && !isCamelCase) { >- patternTypeName = CharOperation.toLowerCase(patternTypeName); >- } >- boolean matchFirstChar = !isCaseSensitive || patternTypeName[0] == typeName[0]; >- switch(matchMode) { >- case SearchPattern.R_EXACT_MATCH : >- return matchFirstChar && CharOperation.equals(patternTypeName, typeName, isCaseSensitive); >- case SearchPattern.R_PREFIX_MATCH : >- return matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, isCaseSensitive); >- case SearchPattern.R_PATTERN_MATCH : >- return CharOperation.match(patternTypeName, typeName, isCaseSensitive); >- case SearchPattern.R_REGEXP_MATCH : >- // TODO (frederic) implement regular expression match >- break; >- case SearchPattern.R_CAMELCASE_MATCH: >- if (matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, false)) { >- return true; >- } >- return !isCaseSensitive && matchFirstChar && CharOperation.prefixEquals(patternTypeName, typeName, false); >- case SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH: >- return matchFirstChar && CharOperation.camelCaseMatch(patternTypeName, typeName, true); >- } >- } >- return true; >- >- } > > boolean match(char patternTypeSuffix, char[] patternPkg, char[] patternTypeName, int matchRule, int typeKind, char[] pkg, char[] typeName) { > switch(patternTypeSuffix) { >@@ -493,14 +456,18 @@ > break; > case IIndexConstants.TYPE_SUFFIX : // nothing > } >- >- boolean isCaseSensitive = (matchRule & SearchPattern.R_CASE_SENSITIVE) != 0; >- if (patternPkg != null && !CharOperation.equals(patternPkg, pkg, isCaseSensitive)) >- return false; >- >+ return match(patternPkg, matchRule, patternTypeName, matchRule, pkg, typeName); >+ } >+ >+ boolean match(char[] patternPkg, int matchRulePkg, char[] patternTypeName, int matchRuleTypeName, char[] pkg, char[] typeName) { >+ boolean isPkgCaseSensitive = (matchRulePkg & SearchPattern.R_CASE_SENSITIVE) != 0; >+ if (patternPkg != null && !CharOperation.equals(patternPkg, pkg, isPkgCaseSensitive)) >+ return false; >+ >+ boolean isCaseSensitive = (matchRuleTypeName & SearchPattern.R_CASE_SENSITIVE) != 0; > if (patternTypeName != null) { >- boolean isCamelCase = (matchRule & (SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH)) != 0; >- int matchMode = matchRule & JavaSearchPattern.MATCH_MODE_MASK; >+ boolean isCamelCase = (matchRuleTypeName & (SearchPattern.R_CAMELCASE_MATCH | SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH)) != 0; >+ int matchMode = matchRuleTypeName & JavaSearchPattern.MATCH_MODE_MASK; > if (!isCaseSensitive && !isCamelCase) { > patternTypeName = CharOperation.toLowerCase(patternTypeName); > } >@@ -554,6 +521,8 @@ > > // Validate match rule first > final int validatedTypeMatchRule = SearchPattern.validateMatchRule(typeName == null ? null : new String (typeName), typeMatchRule); >+ >+ final int pkgMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE; > > // Debug > if (VERBOSE) { >@@ -685,7 +654,7 @@ > for (int j = 0, allTypesLength = allTypes.length; j < allTypesLength; j++) { > IType type = allTypes[j]; > char[] simpleName = type.getElementName().toCharArray(); >- if (match(packageName, typeName, validatedTypeMatchRule, packageDeclaration, simpleName) && !type.isMember()) { >+ if (match(packageName, pkgMatchRule, typeName, validatedTypeMatchRule, packageDeclaration, simpleName) && !type.isMember()) { > > int extraFlags = ExtraFlags.getExtraFlags(type); > >@@ -752,7 +721,7 @@ > private void endVisit(TypeDeclaration typeDeclaration) { > if (!hasConstructor(typeDeclaration) && typeDeclaration.enclosingType == null) { > >- if (match(packageName, typeName, validatedTypeMatchRule, packageDeclaration, typeDeclaration.name)) { >+ if (match(packageName, pkgMatchRule, typeName, validatedTypeMatchRule, packageDeclaration, typeDeclaration.name)) { > nameRequestor.acceptConstructor( > Flags.AccPublic, > typeName, >@@ -793,7 +762,7 @@ > } > public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope classScope) { > TypeDeclaration typeDeclaration = this.declaringTypes[this.declaringTypesPtr]; >- if (match(packageName, typeName, validatedTypeMatchRule, packageDeclaration, typeDeclaration.name)) { >+ if (match(packageName, pkgMatchRule, typeName, validatedTypeMatchRule, packageDeclaration, typeDeclaration.name)) { > Argument[] arguments = constructorDeclaration.arguments; > int length = arguments == null ? 0 : arguments.length; > char[][] parameterNames = new char[length][]; >Index: search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java,v >retrieving revision 1.21 >diff -u -r1.21 ConstructorDeclarationPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java 16 Jan 2009 14:29:29 -0000 1.21 >+++ search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java 22 Jan 2009 09:01:34 -0000 >@@ -10,14 +10,10 @@ > *******************************************************************************/ > package org.eclipse.jdt.internal.core.search.matching; > >-import java.io.IOException; >- > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.core.search.SearchPattern; > import org.eclipse.jdt.internal.compiler.ExtraFlags; > import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; >-import org.eclipse.jdt.internal.core.index.EntryResult; >-import org.eclipse.jdt.internal.core.index.Index; > > public class ConstructorDeclarationPattern extends ConstructorPattern { > public int extraFlags; >@@ -152,40 +148,6 @@ > return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || this.varargs) > && matchesName(this.declaringSimpleName, pattern.declaringSimpleName); > } >-public EntryResult[] queryIn(Index index) throws IOException { >- char[] key = this.declaringSimpleName; // can be null >- int matchRule = getMatchRule(); >- >- switch(getMatchMode()) { >- case R_EXACT_MATCH : >- if (this.declaringSimpleName != null && this.parameterCount >= 0 && !this.varargs) { >- key = createIndexKey(this.declaringSimpleName, this.parameterCount); >- } >- matchRule &= ~R_EXACT_MATCH; >- matchRule |= R_PREFIX_MATCH; >- break; >- case R_PREFIX_MATCH : >- // do a prefix query with the declaringSimpleName >- break; >- case R_PATTERN_MATCH : >- if (this.parameterCount >= 0 && !this.varargs) >- key = createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount); >- else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*') >- key = CharOperation.concat(this.declaringSimpleName, ONE_STAR, SEPARATOR); >- key = CharOperation.concat(key, ONE_STAR); >- // else do a pattern query with just the declaringSimpleName >- break; >- case R_REGEXP_MATCH : >- // TODO (frederic) implement regular expression match >- break; >- case R_CAMELCASE_MATCH: >- case R_CAMELCASE_SAME_PART_COUNT_MATCH: >- // do a prefix query with the declaringSimpleName >- break; >- } >- >- return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null >-} > private void removeInternalFlags() { > this.extraFlags = this.extraFlags & ~ExtraFlags.ParameterTypesStoredAsSignature; // ParameterTypesStoredAsSignature is an internal flags only used to decode key > } >Index: search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java,v >retrieving revision 1.45 >diff -u -r1.45 ConstructorPattern.java >--- search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java 16 Jan 2009 14:29:29 -0000 1.45 >+++ search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java 22 Jan 2009 09:01:34 -0000 >@@ -528,11 +528,13 @@ > // do a prefix query with the declaringSimpleName > break; > case R_PATTERN_MATCH : >- if (this.parameterCount >= 0 && !this.varargs) >- key = createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount); >- else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*') >+ if (this.parameterCount >= 0 && !this.varargs) { >+ key = CharOperation.concat(createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount), ONE_STAR); >+ } else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*') { > key = CharOperation.concat(this.declaringSimpleName, ONE_STAR, SEPARATOR); >- key = CharOperation.concat(key, ONE_STAR); >+ } else if (key != null){ >+ key = CharOperation.concat(key, ONE_STAR); >+ } > // else do a pattern query with just the declaringSimpleName > break; > case R_REGEXP_MATCH : >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.425 >diff -u -r1.425 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 7 Jan 2009 16:43:06 -0000 1.425 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 22 Jan 2009 09:01:33 -0000 >@@ -4683,4 +4683,8 @@ > public Stats debugNewOpenableCacheStats() { > return this.cache.openableCache.new Stats(); > } >+ >+ public int getOpenableCacheSize() { >+ return this.cache.openableCache.getSpaceLimit(); >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261973
: 123346