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 199943 Details for
Bug 352160
[content assist] Use index to find global functions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix Patch - Update 4
352160_method_content_assist.txt (text/plain), 281.52 KB, created by
Ian Tewksbury
on 2011-07-19 15:48:12 EDT
(
hide
)
Description:
Fix Patch - Update 4
Filename:
MIME Type:
Creator:
Ian Tewksbury
Created:
2011-07-19 15:48:12 EDT
Size:
281.52 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.jsdt.core >Index: src/org/eclipse/wst/jsdt/core/CompletionProposal.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/CompletionProposal.java,v >retrieving revision 1.9.2.1 >diff -u -r1.9.2.1 CompletionProposal.java >--- src/org/eclipse/wst/jsdt/core/CompletionProposal.java 1 Jul 2011 22:12:20 -0000 1.9.2.1 >+++ src/org/eclipse/wst/jsdt/core/CompletionProposal.java 19 Jul 2011 19:46:19 -0000 >@@ -13,6 +13,7 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.wst.jsdt.core.compiler.CharOperation; > import org.eclipse.wst.jsdt.internal.codeassist.InternalCompletionProposal; >+import org.eclipse.wst.jsdt.internal.core.util.QualificationHelpers; > > /** > * Completion proposal. >@@ -1402,37 +1403,37 @@ > // return this.declarationPackageName; > // } > // >-// /** >-// * Returns the type name of the relevant >-// * declaration in the context without the package fragment, >-// * or <code>null</code> if none. >-// * <p> >-// * This field is available for the following kinds of >-// * completion proposals: >-// * <ul> >-// * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - the dot-based type name >-// * of the type that is being subclassed or implemented</li> >-// * <li><code>FIELD_REF</code> - the dot-based type name >-// * of the type that declares the field that is referenced >-// * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li> >-// * <li><code>FUNCTION_REF</code> - the dot-based type name >-// * of the type that declares the method that is referenced >-// * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li> >-// * <li><code>FUNCTION_DECLARATION</code> - the dot-based type name >-// * of the type that declares the method that is being >-// * implemented or overridden</li> >-// * </ul> >-// * For kinds of completion proposals, this method returns >-// * <code>null</code>. Clients must not modify the array >-// * returned. >-// * </p> >-// * >-// * @return the dot-based package name, or >-// * <code>null</code> if none >-// * @see #getDeclarationSignature() >-// * @see #getSignature() >-// * >-// */ >+ /** >+ * Returns the type name of the relevant >+ * declaration in the context without the package fragment, >+ * or <code>null</code> if none. >+ * <p> >+ * This field is available for the following kinds of >+ * completion proposals: >+ * <ul> >+ * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - the dot-based type name >+ * of the type that is being subclassed or implemented</li> >+ * <li><code>FIELD_REF</code> - the dot-based type name >+ * of the type that declares the field that is referenced >+ * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li> >+ * <li><code>FUNCTION_REF</code> - the dot-based type name >+ * of the type that declares the method that is referenced >+ * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li> >+ * <li><code>FUNCTION_DECLARATION</code> - the dot-based type name >+ * of the type that declares the method that is being >+ * implemented or overridden</li> >+ * </ul> >+ * For kinds of completion proposals, this method returns >+ * <code>null</code>. Clients must not modify the array >+ * returned. >+ * </p> >+ * >+ * @return the dot-based package name, or >+ * <code>null</code> if none >+ * @see #getDeclarationSignature() >+ * @see #getSignature() >+ * >+ */ > public char[] getDeclarationTypeName() { > return this.declarationTypeName; > } >@@ -1861,6 +1862,10 @@ > public char[][] getParameterTypeNames() { > return this.parameterTypeNames; > } >+ >+ public char[] getReturnType() { >+ return QualificationHelpers.createFullyQualifiedName(this.getReturnQualification(), this.getReturnSimpleName()); >+ } > > /** > * Returns the accessibility of the proposal. >Index: src/org/eclipse/wst/jsdt/core/compiler/CharOperation.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/compiler/CharOperation.java,v >retrieving revision 1.6.18.2 >diff -u -r1.6.18.2 CharOperation.java >--- src/org/eclipse/wst/jsdt/core/compiler/CharOperation.java 1 Jul 2011 22:12:21 -0000 1.6.18.2 >+++ src/org/eclipse/wst/jsdt/core/compiler/CharOperation.java 19 Jul 2011 19:46:19 -0000 >@@ -1089,20 +1089,21 @@ > int size = length - 1; > int index = length; > while (--index >= 0) { >- if (array[index].length == 0 && ignoreEmptyElements) >+ if ((array[index] == null || array[index].length == 0) && ignoreEmptyElements) { > size--; >- else >- size += array[index].length; >+ } else { >+ size += array[index] != null ? array[index].length : 0; >+ } > } > if (size <= 0) > return CharOperation.NO_CHAR; > char[] result = new char[size]; > index = length; > while (--index >= 0) { >- length = array[index].length; >+ length = array[index] != null ? array[index].length : 0; > if (length > 0 || (length == 0 && !ignoreEmptyElements)) { > System.arraycopy( >- array[index], >+ array[index] != null ? array[index] : NO_CHAR, > 0, > result, > (size -= length), >Index: src/org/eclipse/wst/jsdt/core/search/SearchPattern.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/search/SearchPattern.java,v >retrieving revision 1.19 >diff -u -r1.19 SearchPattern.java >--- src/org/eclipse/wst/jsdt/core/search/SearchPattern.java 23 Nov 2009 20:38:10 -0000 1.19 >+++ src/org/eclipse/wst/jsdt/core/search/SearchPattern.java 19 Jul 2011 19:46:19 -0000 >@@ -981,16 +981,12 @@ > findReferences, > isFunction, > selectorChars, >- declaringTypeQualification, >- declaringTypeSimpleName, >- declaringTypeSignature, >- returnTypeQualification, >- returnTypeSimpleName, >- returnTypeSignature, > parameterTypeQualifications, > parameterTypeSimpleNames, >- parameterTypeSignatures, >- typeArguments, >+ returnTypeQualification, >+ returnTypeSimpleName, >+ declaringTypeQualification, >+ declaringTypeSimpleName, > matchRule); > } > } >@@ -1475,15 +1471,12 @@ > findMethodReferences, > isFunction, > selector, >- declaringQualification, >- declaringSimpleName, >- returnQualification, >- returnSimpleName, >- returnSignature, > parameterQualifications, > parameterSimpleNames, >- parameterSignatures, >- method, >+ returnQualification, >+ returnSimpleName, >+ declaringQualification, >+ declaringSimpleName, > matchRule); > } > break; >Index: src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.67.2.10 >diff -u -r1.67.2.10 CompletionEngine.java >--- src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java 14 Jul 2011 05:53:54 -0000 1.67.2.10 >+++ src/org/eclipse/wst/jsdt/internal/codeassist/CompletionEngine.java 19 Jul 2011 19:46:19 -0000 >@@ -161,6 +161,7 @@ > import org.eclipse.wst.jsdt.internal.core.SourceMethodElementInfo; > import org.eclipse.wst.jsdt.internal.core.SourceType; > import org.eclipse.wst.jsdt.internal.core.SourceTypeElementInfo; >+import org.eclipse.wst.jsdt.internal.core.util.QualificationHelpers; > import org.eclipse.wst.jsdt.internal.oaametadata.ClassData; > import org.eclipse.wst.jsdt.internal.oaametadata.Method; > >@@ -675,6 +676,19 @@ > } > > /** >+ * @see org.eclipse.wst.jsdt.internal.codeassist.ISearchRequestor#acceptFunction(char[], int, char[][], char[][], char[][], char[], char[], char[], char[], int, java.lang.String) >+ */ >+ public void acceptFunction(char[] signature, int parameterCount, >+ char[][] parameterQualifications, char[][] parameterSimpleNames, >+ char[][] parameterNames, char[] returnQualification, >+ char[] returnSimpleName, char[] declaringQualification, >+ char[] declaringSimpleName, int modifiers, String path) { >+ >+ this.proposeFunction(signature, parameterCount, parameterQualifications, parameterSimpleNames, parameterNames, >+ returnQualification, returnSimpleName, declaringQualification, declaringSimpleName, modifiers, path); >+ } >+ >+ /** > * @see org.eclipse.wst.jsdt.internal.codeassist.ISearchRequestor#acceptConstructor( > * int, char[], int, char[][], char[][], java.lang.String, org.eclipse.wst.jsdt.internal.compiler.env.AccessRestriction) > */ >@@ -756,8 +770,8 @@ > if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.LOCAL_VARIABLE_REF)) { > CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.LOCAL_VARIABLE_REF, CompletionEngine.this.actualCompletionPosition); > proposal.setSignature(JAVA_LANG_OBJECT_SIGNATURE); >- proposal.setPackageName(JAVA_LANG_NAME); >- proposal.setTypeName(OBJECT); >+ proposal.setReturnQualification(JAVA_LANG_NAME); >+ proposal.setReturnSimpleName(OBJECT); > proposal.setName(name); > proposal.setCompletion(name); > proposal.setFlags(Flags.AccDefault); >@@ -777,8 +791,6 @@ > * @param name the name of the binding > * @param exactMatch <code>true</code> if an exact match is needed, <code>false</code> otherwise > * @param prefixRequired >- * @param onlyConstructors <code>true</code> if only constructors should be accepted, >- * <code>false</code> otherwise. Only applies when matching on {@link Binding#METHOD}s. > */ > private void acceptBindings(char[] name,boolean exactMatch, boolean prefixRequired) { > >@@ -866,10 +878,10 @@ > proposal.setParameterTypeNames(parameterFullTypeNames); > > if(method.returnType!=null) { >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > }else { >- proposal.setTypeName(null); >+ proposal.setReturnSimpleName(null); > } > > >@@ -900,8 +912,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterFullTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setName(bindingName); > proposal.setCompletion(javadocCompletion); > proposal.setFlags( modifiers); >@@ -991,8 +1003,8 @@ > } > proposal.setSignature(getSignature(variableBinding.type)); > proposal.setDeclarationTypeName(packageName); >- proposal.setPackageName(variableBinding.type.qualifiedPackageName()); >- proposal.setTypeName(variableBinding.type.qualifiedSourceName()); >+ proposal.setReturnQualification(variableBinding.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(variableBinding.type.qualifiedSourceName()); > proposal.setName(variableBinding.name); > proposal.setCompletion(completion); > proposal.setFlags(variableBinding.modifiers); >@@ -1010,8 +1022,8 @@ > CompletionProposal proposal = this.createProposal(CompletionProposal.JSDOC_FIELD_REF, this.actualCompletionPosition); > proposal.setSignature(getSignature(variableBinding.type)); > proposal.setDeclarationPackageName(packageName); >- proposal.setPackageName(variableBinding.type.qualifiedPackageName()); >- proposal.setTypeName(variableBinding.type.qualifiedSourceName()); >+ proposal.setReturnQualification(variableBinding.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(variableBinding.type.qualifiedSourceName()); > proposal.setName(variableBinding.name); > proposal.setCompletion(javadocCompletion); > proposal.setFlags(variableBinding.modifiers); >@@ -1716,11 +1728,6 @@ > long completionPosition = access.nameSourcePosition; > setSourceRange((int) (completionPosition >>> 32), (int) completionPosition); > >- >- >-// this.assistNodeIsClass = true; >-// this.assistNodeIsConstructor = true; >- > // can be the start of a qualified type name > if (qualifiedBinding == null) { > >@@ -1732,13 +1739,14 @@ > } else { > this.completionToken = access.token; > if (qualifiedBinding.problemId() == ProblemReasons.NotFound) { >- // complete method members with missing return type >- // class X { >- // Missing f() {return null;} >- // void foo() { >- // f().| >- // } >- // } >+ /* complete method members with missing return type >+ * class X { >+ * Missing f() {return null;} >+ * void foo() { >+ * f().| >+ * } >+ * } >+ */ > if (this.assistNodeInJavadoc == 0 && > (this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) || > this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) { >@@ -2572,8 +2580,8 @@ > proposal.setSignature(signature); > //proposal.setDeclarationPackageName(null); > //proposal.setDeclarationTypeName(null); >- proposal.setPackageName(CharOperation.concatWith(JAVA_LANG, '.')); >- proposal.setTypeName(CLASS); >+ proposal.setReturnQualification(CharOperation.concatWith(JAVA_LANG, '.')); >+ proposal.setReturnSimpleName(CLASS); > proposal.setName(classField); > proposal.setCompletion(classField); > proposal.setFlags(Flags.AccStatic | Flags.AccPublic); >@@ -3189,8 +3197,8 @@ > proposal.setSignature(getSignature(field.type)); > proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(field.declaringClass.qualifiedSourceName()); >- proposal.setPackageName(field.type.qualifiedPackageName()); >- proposal.setTypeName(field.type.qualifiedSourceName()); >+ proposal.setReturnQualification(field.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(field.type.qualifiedSourceName()); > proposal.setName(field.name); > if (missingElements != null) { > CompletionProposal[] subProposals = new CompletionProposal[missingElements.length]; >@@ -3222,8 +3230,8 @@ > proposal.setSignature(getSignature(field.type)); > proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(field.declaringClass.qualifiedSourceName()); >- proposal.setPackageName(field.type.qualifiedPackageName()); >- proposal.setTypeName(field.type.qualifiedSourceName()); >+ proposal.setReturnQualification(field.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(field.type.qualifiedSourceName()); > proposal.setName(field.name); > proposal.setCompletion(javadocCompletion); > proposal.setFlags(field.modifiers); >@@ -3662,8 +3670,8 @@ > proposal.setSignature(getSignature(field.type)); > proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(field.declaringClass.qualifiedSourceName()); >- proposal.setPackageName(field.type.qualifiedPackageName()); >- proposal.setTypeName(field.type.qualifiedSourceName()); >+ proposal.setReturnQualification(field.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(field.type.qualifiedSourceName()); > proposal.setName(field.name); > proposal.setCompletion(completion); > proposal.setFlags(field.modifiers); >@@ -3678,8 +3686,8 @@ > char[] packageName = receiverType.qualifiedPackageName(); > typeImportProposal.setDeclarationSignature(packageName); > typeImportProposal.setSignature(getSignature(receiverType)); >- typeImportProposal.setPackageName(packageName); >- typeImportProposal.setTypeName(receiverType.qualifiedSourceName()); >+ typeImportProposal.setReturnQualification(packageName); >+ typeImportProposal.setReturnSimpleName(receiverType.qualifiedSourceName()); > typeImportProposal.setCompletion(typeImportCompletion); > typeImportProposal.setFlags(receiverType.modifiers); > typeImportProposal.setAdditionalFlags(CompletionFlags.Default); >@@ -3702,8 +3710,8 @@ > proposal.setSignature(getSignature(field.type)); > proposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName()); > proposal.setDeclarationTypeName(field.declaringClass.qualifiedSourceName()); >- proposal.setPackageName(field.type.qualifiedPackageName()); >- proposal.setTypeName(field.type.qualifiedSourceName()); >+ proposal.setReturnQualification(field.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(field.type.qualifiedSourceName()); > proposal.setName(field.name); > proposal.setCompletion(completion); > proposal.setFlags(field.modifiers); >@@ -3717,8 +3725,8 @@ > fieldImportProposal.setSignature(getSignature(field.type)); > fieldImportProposal.setDeclarationPackageName(field.declaringClass.qualifiedPackageName()); > fieldImportProposal.setDeclarationTypeName(field.declaringClass.qualifiedSourceName()); >- fieldImportProposal.setPackageName(field.type.qualifiedPackageName()); >- fieldImportProposal.setTypeName(field.type.qualifiedSourceName()); >+ fieldImportProposal.setReturnQualification(field.type.qualifiedPackageName()); >+ fieldImportProposal.setReturnSimpleName(field.type.qualifiedSourceName()); > fieldImportProposal.setName(field.name); > fieldImportProposal.setCompletion(fieldImportCompletion); > fieldImportProposal.setFlags(field.modifiers); >@@ -4441,8 +4449,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setName(method.selector); > proposal.setIsContructor(method.isConstructor()); > >@@ -4483,8 +4491,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setName(method.selector); > proposal.setCompletion(javadocCompletion); > proposal.setFlags(method.modifiers); >@@ -4639,8 +4647,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setName(method.selector); > proposal.setCompletion(completion); > proposal.setFlags(method.modifiers); >@@ -4667,8 +4675,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setName(method.selector); > proposal.setCompletion(completion); > proposal.setFlags(method.modifiers); >@@ -4684,8 +4692,8 @@ > char[] packageName = receiverType.qualifiedPackageName(); > typeImportProposal.setDeclarationSignature(packageName); > typeImportProposal.setSignature(getSignature(receiverType)); >- typeImportProposal.setPackageName(packageName); >- typeImportProposal.setTypeName(receiverType.qualifiedSourceName()); >+ typeImportProposal.setReturnQualification(packageName); >+ typeImportProposal.setReturnSimpleName(receiverType.qualifiedSourceName()); > typeImportProposal.setCompletion(typeImportCompletion); > typeImportProposal.setFlags(receiverType.modifiers); > typeImportProposal.setAdditionalFlags(CompletionFlags.Default); >@@ -4712,8 +4720,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setName(method.selector); > proposal.setCompletion(completion); > proposal.setFlags(method.modifiers); >@@ -4733,8 +4741,8 @@ > methodImportProposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > methodImportProposal.setParameterPackageNames(parameterPackageNames); > methodImportProposal.setParameterTypeNames(parameterTypeNames); >- methodImportProposal.setPackageName(method.returnType.qualifiedPackageName()); >- methodImportProposal.setTypeName(method.returnType.qualifiedSourceName()); >+ methodImportProposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ methodImportProposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > methodImportProposal.setName(method.selector); > methodImportProposal.setCompletion(methodImportCompletion); > methodImportProposal.setFlags(method.modifiers); >@@ -4769,8 +4777,8 @@ > proposal.completionEngine = this; > proposal.setDeclarationSignature(packageName); > proposal.setSignature(getSignature(typeBinding)); >- proposal.setPackageName(packageName); >- proposal.setTypeName(typeName); >+ proposal.setReturnQualification(packageName); >+ proposal.setReturnSimpleName(typeName); > proposal.setCompletion(fullyQualifiedName); > proposal.setFlags(typeBinding.modifiers); > proposal.setReplaceRange(start - this.offset, end - this.offset); >@@ -4782,7 +4790,7 @@ > > proposal = this.createProposal(CompletionProposal.PACKAGE_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(packageName); >- proposal.setPackageName(packageName); >+ proposal.setReturnQualification(packageName); > proposal.setCompletion(packageName); > proposal.setReplaceRange(start - this.offset, end - this.offset); > proposal.setRelevance(relevance); >@@ -5057,8 +5065,8 @@ > proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); > proposal.setParameterPackageNames(parameterPackageNames); > proposal.setParameterTypeNames(parameterFullTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setReturnQualification(method.returnType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(method.returnType.qualifiedSourceName()); > proposal.setCompletion(completion.toString().toCharArray()); > proposal.setName(method.selector); > proposal.setFlags(method.modifiers); >@@ -5813,10 +5821,10 @@ > : getSignature(local.type)); > if(local.type == null) { > //proposal.setPackageName(null); >- proposal.setTypeName(local.declaration.getTypeName().toCharArray()); >+ proposal.setReturnSimpleName(local.declaration.getTypeName().toCharArray()); > } else { >- proposal.setPackageName(local.type.qualifiedPackageName()); >- proposal.setTypeName(local.type.qualifiedSourceName()); >+ proposal.setReturnQualification(local.type.qualifiedPackageName()); >+ proposal.setReturnSimpleName(local.type.qualifiedSourceName()); > } > proposal.setName(local.name); > proposal.setCompletion(local.name); >@@ -5875,20 +5883,11 @@ > null, > null, > false); >- >- > } > break; >-// case Scope.CLASS_SCOPE : > case Scope.COMPILATION_UNIT_SCOPE : > CompilationUnitScope compilationUnitScope = (CompilationUnitScope) currentScope; >-// ClassScope classScope = (ClassScope) currentScope; > SourceTypeBinding enclosingType = compilationUnitScope.enclosingCompilationUnit(); >- /* if (tokenLength == 0) { // only search inside the type itself if no prefix was provided >- findFields(token, enclosingType.fields(), classScope, fieldsFound, staticsOnly); >- findMethods(token, enclosingType.methods(), classScope, methodsFound, staticsOnly, false); >- break done; >- } else { */ > if(!insideTypeAnnotation) { > if(proposeField) { > findFields( >@@ -5931,10 +5930,6 @@ > } > staticsOnly |= enclosingType.isStatic(); > insideTypeAnnotation = false; >- // } >-// break; >- >-// case Scope.COMPILATION_UNIT_SCOPE : > break done2; > } > currentScope = currentScope.parent; >@@ -5953,14 +5948,11 @@ > } > > //propose methods from environment if token length is not 0 >- if (proposeMethod && token.length > 0) >- { >- this.nameEnvironment.findBindings( >+ if (proposeMethod && token.length > 0) { >+ this.nameEnvironment.findFunctions( > token, >- Binding.METHOD, >- this.options.camelCaseMatch, >+ null, > this); >- acceptBindings(token,false,false); > } > > //propose fields from environment if token length is not 0 >@@ -6000,8 +5992,8 @@ > if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) { > CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.VARIABLE_DECLARATION, CompletionEngine.this.actualCompletionPosition); > proposal.setSignature(getSignature(type.resolvedType)); >- proposal.setPackageName(type.resolvedType.qualifiedPackageName()); >- proposal.setTypeName(type.resolvedType.qualifiedSourceName()); >+ proposal.setReturnQualification(type.resolvedType.qualifiedPackageName()); >+ proposal.setReturnSimpleName(type.resolvedType.qualifiedSourceName()); > proposal.setName(name); > proposal.setCompletion(name); > //proposal.setFlags(Flags.AccDefault); >@@ -6270,8 +6262,8 @@ > if(!CompletionEngine.this.requestor.isIgnored(CompletionProposal.VARIABLE_DECLARATION)) { > CompletionProposal proposal = CompletionEngine.this.createProposal(CompletionProposal.VARIABLE_DECLARATION, CompletionEngine.this.actualCompletionPosition); > proposal.setSignature(getSignature(typeBinding)); >- proposal.setPackageName(q); >- proposal.setTypeName(displayName); >+ proposal.setReturnQualification(q); >+ proposal.setReturnSimpleName(displayName); > proposal.setName(name); > proposal.setCompletion(name); > //proposal.setFlags(Flags.AccDefault); >@@ -6899,7 +6891,7 @@ > proposal.setDeclarationTypeName(reference.qualifiedSourceName()); > > //proposal.setPackageName(null); >- proposal.setTypeName(VOID); >+ proposal.setReturnSimpleName(VOID); > proposal.setName(token); > //proposal.setParameterPackageNames(null); > //proposal.setParameterTypeNames(null); >@@ -7012,8 +7004,8 @@ > proposal.completionEngine = this; > proposal.setDeclarationSignature(packageName); > proposal.setSignature(createNonGenericTypeSignature(typeName)); >- proposal.setPackageName(packageName); >- proposal.setTypeName(typeName); >+ proposal.setReturnQualification(packageName); >+ proposal.setReturnSimpleName(typeName); > proposal.setCompletion(completionName); > proposal.setFlags(modifiers); > proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >@@ -7033,8 +7025,8 @@ > proposal.completionEngine = this; > proposal.setDeclarationSignature(packageName); > proposal.setSignature(createNonGenericTypeSignature(typeName)); >- proposal.setPackageName(packageName); >- proposal.setTypeName(typeName); >+ proposal.setReturnQualification(packageName); >+ proposal.setReturnSimpleName(typeName); > proposal.setCompletion(javadocCompletion); > proposal.setFlags(modifiers); > int start = (this.assistNodeInJavadoc & CompletionOnJavadoc.REPLACE_TAG) != 0 ? this.javadocTagPosition : this.startPosition; >@@ -7060,8 +7052,8 @@ > proposal.completionEngine = this; > proposal.setDeclarationSignature(refBinding.qualifiedPackageName()); > proposal.setSignature(getSignature(refBinding)); >- proposal.setPackageName(refBinding.qualifiedPackageName()); >- proposal.setTypeName(typeName); >+ proposal.setReturnQualification(refBinding.qualifiedPackageName()); >+ proposal.setReturnSimpleName(typeName); > proposal.setCompletion(completionName); > proposal.setFlags(refBinding.modifiers); > proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >@@ -7080,8 +7072,8 @@ > proposal.completionEngine = this; > proposal.setDeclarationSignature(refBinding.qualifiedPackageName()); > proposal.setSignature(getSignature(refBinding)); >- proposal.setPackageName(refBinding.qualifiedPackageName()); >- proposal.setTypeName(typeName); >+ proposal.setReturnQualification(refBinding.qualifiedPackageName()); >+ proposal.setReturnSimpleName(typeName); > proposal.setCompletion(javadocCompletion); > proposal.setFlags(refBinding.modifiers); > int start = (this.assistNodeInJavadoc & CompletionOnJavadoc.REPLACE_TAG) != 0 ? this.javadocTagPosition : this.startPosition; >@@ -7406,8 +7398,8 @@ > CompletionProposal proposal = createProposal(CompletionProposal.TYPE_REF, this.actualCompletionPosition); > proposal.setDeclarationSignature(packageName); > proposal.setSignature(getSignature(refBinding)); >- proposal.setPackageName(packageName); >- proposal.setTypeName(typeName); >+ proposal.setReturnQualification(packageName); >+ proposal.setReturnSimpleName(typeName); > proposal.setCompletion(completionName); > proposal.setFlags(refBinding.modifiers); > proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >@@ -7511,6 +7503,77 @@ > } > > /** >+ * <p>Creates a function proposal based on all of the given information</p> >+ * >+ * @param signature >+ * @param parameterCount >+ * @param parameterQualifications >+ * @param parameterSimpleNames >+ * @param parameterNames >+ * @param returnQualification >+ * @param returnSimpleName >+ * @param declaringQualification >+ * @param declaringSimpleName >+ * @param modifiers >+ * @param path >+ */ >+ private void proposeFunction(char[] signature, >+ int parameterCount, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, >+ char[][] parameterNames, >+ char[] returnQualification, >+ char[] returnSimpleName, >+ char[] declaringQualification, >+ char[] declaringSimpleName, >+ int modifiers, >+ String path) { >+ >+ //compute completion >+ char[] completion; >+ if (this.source != null >+ && this.source.length > this.endPosition >+ && this.source[this.endPosition] == '(') { >+ >+ completion = signature; >+ } else { >+ completion = CharOperation.concat(signature, new char[] { '(', ')' }); >+ } >+ >+ //compute relevance >+ int relevance = computeBaseRelevance(); >+ relevance += computeRelevanceForInterestingProposal(); >+ if (this.completionToken != null) relevance += computeRelevanceForCaseMatching(this.completionToken, signature); >+ relevance += computeRelevanceForExpectingType(returnQualification, returnSimpleName); >+ relevance += computeRelevanceForQualification(false); >+ relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); >+ >+ this.noProposal = false; >+ // Standard proposal >+ if(!this.requestor.isIgnored(CompletionProposal.METHOD_REF) && (this.assistNodeInJavadoc & CompletionOnJavadoc.ONLY_INLINE_TAG) == 0) { >+ CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); >+ proposal.setDeclarationSignature(QualificationHelpers.createFullyQualifiedName(declaringQualification, declaringSimpleName)); >+ proposal.setDeclarationPackageName(declaringQualification); >+ proposal.setDeclarationTypeName(declaringSimpleName); >+ proposal.setParameterPackageNames(parameterQualifications); >+ proposal.setParameterTypeNames(parameterSimpleNames); >+ proposal.setReturnQualification(returnQualification); >+ proposal.setReturnSimpleName(returnSimpleName); >+ proposal.setName(signature); >+ proposal.setCompletion(completion); >+ proposal.setFlags(modifiers | Flags.AccPublic ); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ if(parameterNames != null) proposal.setParameterNames(parameterNames); >+ proposal.setIsContructor(false); >+ this.requestor.accept(proposal); >+ if(DEBUG) { >+ this.printDebug(proposal); >+ } >+ } >+ } >+ >+ /** > * <p>Represents a constructor accepted from the index.</p> > */ > private static class AcceptedConstructor { >Index: src/org/eclipse/wst/jsdt/internal/codeassist/ISearchRequestor.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/ISearchRequestor.java,v >retrieving revision 1.5.2.1 >diff -u -r1.5.2.1 ISearchRequestor.java >--- src/org/eclipse/wst/jsdt/internal/codeassist/ISearchRequestor.java 1 Jul 2011 22:12:20 -0000 1.5.2.1 >+++ src/org/eclipse/wst/jsdt/internal/codeassist/ISearchRequestor.java 19 Jul 2011 19:46:19 -0000 >@@ -64,4 +64,31 @@ > char[][] parameterNames, > String path, > AccessRestriction access); >+ >+ /** >+ * <p>Accept a function defined with all of the given information</p> >+ * >+ * @param signature >+ * @param parameterCount >+ * @param parameterQualifications >+ * @param parameterSimpleNames >+ * @param parameterNames >+ * @param returnQualification >+ * @param returnSimpleName >+ * @param declaringQualification >+ * @param declaringSimpleName >+ * @param modifiers >+ * @param path >+ */ >+ public void acceptFunction(char[] signature, >+ int parameterCount, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, >+ char[][] parameterNames, >+ char[] returnQualification, >+ char[] returnSimpleName, >+ char[] declaringQualification, >+ char[] declaringSimpleName, >+ int modifiers, >+ String path); > } >Index: src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java,v >retrieving revision 1.7 >diff -u -r1.7 InternalCompletionProposal.java >--- src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java 16 Nov 2009 15:50:42 -0000 1.7 >+++ src/org/eclipse/wst/jsdt/internal/codeassist/InternalCompletionProposal.java 19 Jul 2011 19:46:19 -0000 >@@ -41,8 +41,8 @@ > > protected char[] declarationPackageName; > protected char[] declarationTypeName; >- protected char[] packageName; >- protected char[] typeName; >+ protected char[] returnQualification; >+ protected char[] returnSimpleName; > protected char[][] parameterPackageNames; > protected char[][] parameterTypeNames; > >@@ -143,12 +143,12 @@ > return this.declarationTypeName; > } > >- protected char[] getPackageName() { >- return this.packageName; >+ protected char[] getReturnQualification() { >+ return this.returnQualification; > } > >- protected char[] getTypeName() { >- return this.typeName; >+ protected char[] getReturnSimpleName() { >+ return this.returnSimpleName; > } > > protected char[][] getParameterPackageNames() { >@@ -168,12 +168,12 @@ > this.declarationTypeName = declarationTypeName; > } > >- protected void setPackageName(char[] packageName) { >- this.packageName = packageName; >+ protected void setReturnQualification(char[] packageName) { >+ this.returnQualification = packageName; > } > >- protected void setTypeName(char[] typeName) { >- this.typeName = typeName; >+ protected void setReturnSimpleName(char[] typeName) { >+ this.returnSimpleName = typeName; > } > > protected void setParameterPackageNames(char[][] parameterPackageNames) { >Index: src/org/eclipse/wst/jsdt/internal/codeassist/MissingTypesGuesser.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/MissingTypesGuesser.java,v >retrieving revision 1.10.2.1 >diff -u -r1.10.2.1 MissingTypesGuesser.java >--- src/org/eclipse/wst/jsdt/internal/codeassist/MissingTypesGuesser.java 1 Jul 2011 22:12:20 -0000 1.10.2.1 >+++ src/org/eclipse/wst/jsdt/internal/codeassist/MissingTypesGuesser.java 19 Jul 2011 19:46:19 -0000 >@@ -333,7 +333,19 @@ > > //do nothing > } >- >+ >+ /** >+ * @see org.eclipse.wst.jsdt.internal.codeassist.ISearchRequestor#acceptFunction(char[], int, char[][], char[][], char[][], char[], char[], char[], char[], int, java.lang.String) >+ */ >+ public void acceptFunction(char[] signature, int parameterCount, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, char[][] parameterNames, >+ char[] returnQualification, char[] returnSimpleName, >+ char[] declaringQualification, char[] declaringSimpleName, >+ int modifiers, String path) { >+ >+ //do nothing >+ } > }; > nameEnvironment.findExactTypes(missingSimpleName, true, IJavaScriptSearchConstants.TYPE, storage); > if(results.size() == 0) return null; >Index: src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java,v >retrieving revision 1.33.2.3 >diff -u -r1.33.2.3 SelectionEngine.java >--- src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java 1 Jul 2011 22:12:20 -0000 1.33.2.3 >+++ src/org/eclipse/wst/jsdt/internal/codeassist/SelectionEngine.java 19 Jul 2011 19:46:20 -0000 >@@ -303,6 +303,19 @@ > > // do nothing > } >+ >+ /** >+ * @see org.eclipse.wst.jsdt.internal.codeassist.ISearchRequestor#acceptFunction(char[], int, char[][], char[][], char[][], char[], char[], char[], char[], int, java.lang.String) >+ */ >+ public void acceptFunction(char[] signature, int parameterCount, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, char[][] parameterNames, >+ char[] returnQualification, char[] returnSimpleName, >+ char[] declaringQualification, char[] declaringSimpleName, >+ int modifiers, String path) { >+ >+ //do nothing >+ } > > private void acceptQualifiedTypes() { > if(this.acceptedClasses != null){ >@@ -1287,15 +1300,8 @@ > localParser.inferTypes(parsedUnit,this.compilerOptions); > return parsedUnit; > } catch (AbortCompilationUnit e) { >-// // at this point, currentCompilationUnitResult may not be sourceUnit, but some other >-// // one requested further along to resolve sourceUnit. >-// if (unitResult.compilationUnit == sourceUnit) { // only report once >-// requestor.acceptResult(unitResult.tagAsAccepted()); >-// } else { >- throw e; // want to abort enclosing request to compile >-// } >+ throw e; // want to abort enclosing request to compile > } > > } >- > } >Index: src/org/eclipse/wst/jsdt/internal/compiler/ISourceElementRequestor.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/ISourceElementRequestor.java,v >retrieving revision 1.7 >diff -u -r1.7 ISourceElementRequestor.java >--- src/org/eclipse/wst/jsdt/internal/compiler/ISourceElementRequestor.java 24 Jun 2009 14:48:04 -0000 1.7 >+++ src/org/eclipse/wst/jsdt/internal/compiler/ISourceElementRequestor.java 19 Jul 2011 19:46:20 -0000 >@@ -60,6 +60,7 @@ > public int nameSourceEnd; > public char[][] parameterTypes; > public char[][] parameterNames; >+ public char[] declaringType; > public char[][] categories; > } > >Index: src/org/eclipse/wst/jsdt/internal/compiler/SourceElementParser.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/SourceElementParser.java,v >retrieving revision 1.48.2.6 >diff -u -r1.48.2.6 SourceElementParser.java >--- src/org/eclipse/wst/jsdt/internal/compiler/SourceElementParser.java 13 Jul 2011 20:43:02 -0000 1.48.2.6 >+++ src/org/eclipse/wst/jsdt/internal/compiler/SourceElementParser.java 19 Jul 2011 19:46:20 -0000 >@@ -193,7 +193,7 @@ > > char[] selector = Util.getTypeName(leftHandSide); > MethodDeclaration methodDecl = ((IFunctionExpression) righHandSide).getMethodDeclaration(); >- if(selector != null && methodDecl.isConstructor()) { >+ if(selector != null) { > notifySourceElementRequestor(methodDecl, > selector); > } >@@ -798,6 +798,13 @@ > methodInfo.parameterTypes = argumentTypes; > methodInfo.parameterNames = argumentNames; > methodInfo.categories = (char[][]) this.nodesToCategories.get(methodDeclaration); >+ InferredMethod inferredMeth = methodDeclaration.getInferredMethod(); >+ if(inferredMeth != null) { >+ InferredType declaringType = inferredMeth.inType; >+ if(declaringType != null) { >+ methodInfo.declaringType = declaringType.getName(); >+ } >+ } > > //enter either constructor or method where appropriate > if(methodInfo.isConstructor) { >@@ -916,6 +923,13 @@ > methodInfo.parameterTypes = argumentTypes; > methodInfo.parameterNames = argumentNames; > methodInfo.categories = (char[][]) this.nodesToCategories.get(methodDeclaration); >+ InferredMethod inferredMeth = methodDeclaration.getInferredMethod(); >+ if(inferredMeth != null) { >+ InferredType declaringType = inferredMeth.inType; >+ if(declaringType != null) { >+ methodInfo.declaringType = declaringType.getName(); >+ } >+ } > requestor.enterConstructor(methodInfo); > } > /* need this check because a constructor could have been made a constructor after the >@@ -970,6 +984,13 @@ > methodInfo.parameterTypes = argumentTypes; > methodInfo.parameterNames = argumentNames; > methodInfo.categories = (char[][]) this.nodesToCategories.get(methodDeclaration); >+ InferredMethod inferredMeth = methodDeclaration.getInferredMethod(); >+ if(inferredMeth != null) { >+ InferredType declaringType = inferredMeth.inType; >+ if(declaringType != null) { >+ methodInfo.declaringType = declaringType.getName(); >+ } >+ } > requestor.enterMethod(methodInfo); > } > >Index: src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitScope.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitScope.java,v >retrieving revision 1.60.2.4 >diff -u -r1.60.2.4 CompilationUnitScope.java >--- src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitScope.java 13 Jul 2011 20:43:02 -0000 1.60.2.4 >+++ src/org/eclipse/wst/jsdt/internal/compiler/lookup/CompilationUnitScope.java 19 Jul 2011 19:46:20 -0000 >@@ -632,25 +632,6 @@ > } > > void connectTypeHierarchy(char[][] typeNames) { >- // if(superType!=null) { >- // if(superType instanceof SourceTypeBinding) { >- // ((SourceTypeBinding)superType).classScope.buildFieldsAndMethods(); >- // ((SourceTypeBinding)superType).classScope.connectTypeHierarchy(); >- // >- // } >- // ReferenceBinding[] memberTypes = superType.memberTypes(); >- // ReferenceBinding[] memberFields = superType.typeVariables(); >- // FunctionBinding[] memberMethods = superType.availableMethods(); >- // for(int i=0;i<memberTypes.length;i++) { >- // recordReference(memberTypes[i], memberTypes[i].sourceName); >- // } >- // } >- >- // if(superTypeName!=null) { >- // ReferenceBinding binding = environment.askForType(new char[][] >- // {superTypeName}); >- // this.recordSuperTypeReference(binding); >- // } > if (classScope != null) > classScope.connectTypeHierarchy(); > nextType: for (int i = 0; i < referenceContext.numberInferredTypes; i++) { >@@ -667,9 +648,9 @@ > continue nextType; > > } >- if (inferredType.binding != null) >+ if (inferredType.binding != null) { > inferredType.binding.classScope.connectTypeHierarchy(); >- >+ } > } > } > void connectTypeHierarchy() { >Index: src/org/eclipse/wst/jsdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.49.2.1 >diff -u -r1.49.2.1 Scope.java >--- src/org/eclipse/wst/jsdt/internal/compiler/lookup/Scope.java 1 Jul 2011 22:12:21 -0000 1.49.2.1 >+++ src/org/eclipse/wst/jsdt/internal/compiler/lookup/Scope.java 19 Jul 2011 19:46:20 -0000 >@@ -30,7 +30,6 @@ > import org.eclipse.wst.jsdt.internal.compiler.util.HashtableOfObject; > import org.eclipse.wst.jsdt.internal.compiler.util.ObjectVector; > import org.eclipse.wst.jsdt.internal.compiler.util.SimpleSet; >-import org.eclipse.wst.jsdt.internal.core.Logger; > > public abstract class Scope implements TypeConstants, TypeIds { > >@@ -1359,14 +1358,7 @@ > MethodBinding constructor = null; > if (methods == null || methods == Binding.NO_METHODS || methods.length == 0){ > constructor = new MethodBinding(0, receiverType.sourceName, receiverType, null,receiverType); >- } else { >- >- if(methods.length > 1) { >- Logger.log(Logger.WARNING, "There should only ever be one match for a constructor search" + >- " but found " + methods.length + " when looking for " + >- new String(receiverType.sourceName) + ". Using the first match."); >- } >- >+ } else { > //should only ever be one constructor so use the first one in the list > constructor = methods[0]; > } >Index: src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java,v >retrieving revision 1.22.2.2 >diff -u -r1.22.2.2 SearchableEnvironment.java >--- src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java 1 Jul 2011 22:12:19 -0000 1.22.2.2 >+++ src/org/eclipse/wst/jsdt/internal/core/SearchableEnvironment.java 19 Jul 2011 19:46:20 -0000 >@@ -37,6 +37,7 @@ > import org.eclipse.wst.jsdt.internal.compiler.impl.ITypeRequestor; > import org.eclipse.wst.jsdt.internal.core.search.BasicSearchEngine; > import org.eclipse.wst.jsdt.internal.core.search.IConstructorRequestor; >+import org.eclipse.wst.jsdt.internal.core.search.IFunctionRequester; > import org.eclipse.wst.jsdt.internal.core.search.IRestrictedAccessBindingRequestor; > import org.eclipse.wst.jsdt.internal.core.search.IRestrictedAccessTypeRequestor; > >@@ -168,16 +169,10 @@ > for (int i = 0, index = 1; i < length; i++) { > ISourceType otherType = (ISourceType) ((JavaElement) types[i]) > .getElementInfo(); >- if (!otherType.equals(topLevelType) && index < length) // check >- // that >- // the >- // index >- // is >- // in >- // bounds >- // (see >- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=62861) >+ //check that the index is in bounds (see Bug 62861) >+ if (!otherType.equals(topLevelType) && index < length) { > sourceTypes[index++] = otherType; >+ } > } > return new NameEnvironmentAnswer(sourceTypes, > answer.restriction); >@@ -231,8 +226,6 @@ > System.arraycopy(elements, 0, units, 0, elements.length); > return new NameEnvironmentAnswer(units,answer.restriction); > } >- // return new NameEnvironmentAnswer((IBinaryType) ((BinaryType) >- // answer.type).getElementInfo(), answer.restriction); > } > return null; > } >@@ -586,41 +579,8 @@ > } > } > >- IProgressMonitor progressMonitor = new IProgressMonitor() { >- boolean isCanceled = false; >- >- public void beginTask(String name, int totalWork) { >- // implements interface method >- } >- >- public void done() { >- // implements interface method >- } >- >- public void internalWorked(double work) { >- // implements interface method >- } >- >- public boolean isCanceled() { >- return isCanceled; >- } >- >- public void setCanceled(boolean value) { >- isCanceled = value; >- } >- >- public void setTaskName(String name) { >- // implements interface method >- } >- >- public void subTask(String name) { >- // implements interface method >- } >- >- public void worked(int work) { >- // implements interface method >- } >- }; >+ IProgressMonitor progressMonitor = new CancelableProgressMonitor(); >+ > IRestrictedAccessBindingRequestor bindingRequestor = new IRestrictedAccessBindingRequestor() { > String exclude; > public boolean acceptBinding(int type,int modifiers, char[] packageName, >@@ -674,6 +634,80 @@ > findTypes(new String(prefix), storage, NameLookup.ACCEPT_ALL); > } > } >+ >+ /** >+ * <p>Used to find all functions in the environment using the given information.</p> >+ * >+ * <p><b>NOTE:</b> this function will currently ignore any results either from the index >+ * or working copies from the {@link #unitToSkip}.</p> >+ * >+ * @param selectorPrefix prefix to the selector to search for functions matches for, or >+ * <code>null</code> to search for functions with any selector. The <code>null</code> >+ * option is useful when searching for all functions on a given type. >+ * @param declaringTypeName fully qualified type name that any function results should be >+ * defined on, or <code>null</code> if the function results should not be defined on any type >+ * @param searchRequester search requester to return any search results too >+ */ >+ public void findFunctions(char[] selectorPrefix, String declaringTypeName, final ISearchRequestor searchRequester) { >+ //calculate the exclude path >+ final String excludePath; >+ if (this.unitToSkip != null && this.unitToSkip instanceof IJavaScriptElement) { >+ excludePath = ((IJavaScriptElement)this.unitToSkip).getPath().toString(); >+ } else { >+ excludePath = null; >+ } >+ >+ //create the requester >+ IFunctionRequester functionRequestor = new IFunctionRequester() { >+ public void acceptFunction(char[] signature, >+ int parameterCount, >+ char[][] parameterQualifications, char[][] parameterSimpleNames, >+ char[][] parameterNames, >+ char[] returnQualification, char[] returnSimpleName, >+ char[] declaringQualification, char[] declaringSimpleName, >+ int modifiers, >+ String path) { >+ >+ if (excludePath == null || !excludePath.equals(path)) { >+ searchRequester.acceptFunction(signature, parameterCount, parameterQualifications, parameterSimpleNames, parameterNames, >+ returnQualification, returnSimpleName, declaringQualification, declaringSimpleName, modifiers, path); >+ } >+ } >+ }; >+ >+ /* if selector specified then search for any selector with the given selector as a prefix >+ * else search for any selector >+ */ >+ char[] selectorPattern; >+ int selectorPatternMatchRule; >+ if(selectorPrefix != null) { >+ selectorPattern = selectorPrefix; >+ selectorPatternMatchRule = SearchPattern.R_PREFIX_MATCH; >+ } else { >+ selectorPattern = new char[] {'*'}; >+ selectorPatternMatchRule = SearchPattern.R_PATTERN_MATCH; >+ } >+ >+ /* if a declaring type name is specified then make it the pattern for matching >+ * else find methods not on a type >+ */ >+ String declaringType; >+ if(declaringTypeName != null) { >+ declaringType = declaringTypeName; >+ } else { >+ declaringType = null; >+ } >+ >+ //do the search >+ new BasicSearchEngine(this.workingCopies).searchAllFunctions( >+ functionRequestor, >+ selectorPattern, >+ declaringType, >+ selectorPatternMatchRule, >+ this.searchScope, >+ WAIT_UNTIL_READY_TO_SEARCH, >+ new CancelableProgressMonitor()); >+ } > > /** > * <p>The progress monitor is used to be able to cancel completion operations</p> >@@ -697,33 +731,7 @@ > excludePath = null; > } > >- IProgressMonitor progressMonitor = new IProgressMonitor() { >- boolean isCanceled = false; >- public void beginTask(String name, int totalWork) { >- // implements interface method >- } >- public void done() { >- // implements interface method >- } >- public void internalWorked(double work) { >- // implements interface method >- } >- public boolean isCanceled() { >- return this.isCanceled; >- } >- public void setCanceled(boolean value) { >- this.isCanceled = value; >- } >- public void setTaskName(String name) { >- // implements interface method >- } >- public void subTask(String name) { >- // implements interface method >- } >- public void worked(int work) { >- // implements interface method >- } >- }; >+ IProgressMonitor progressMonitor = new CancelableProgressMonitor(); > > IConstructorRequestor constructorRequestor = new IConstructorRequestor() { > /** >@@ -817,19 +825,6 @@ > this.nameLookup.seekBindings(prefix, bindingType,null, true, type, requestor); > } else { > throw new UnimplementedException("shouldnt get here"); //$NON-NLS-1$ >-// String packageName = prefix.substring(0, index); >-// JavaElementRequestor elementRequestor = new JavaElementRequestor(); >-// this.nameLookup.seekPackageFragments(packageName, false, >-// elementRequestor); >-// IPackageFragment[] fragments = elementRequestor >-// .getPackageFragments(); >-// if (fragments != null) { >-// String className = prefix.substring(index + 1); >-// for (int i = 0, length = fragments.length; i < length; i++) >-// if (fragments[i] != null) >-// this.nameLookup.seekTypes(className, fragments[i], >-// true, type, requestor); >-// } > } > } > /** >@@ -877,4 +872,35 @@ > { > nameLookup.setScriptFile(file); > } >+ >+ /** >+ * <p>A cancelable progress monitor</p> >+ */ >+ private static class CancelableProgressMonitor implements IProgressMonitor { >+ boolean isCanceled = false; >+ public void beginTask(String name, int totalWork) { >+ // implements interface method >+ } >+ public void done() { >+ // implements interface method >+ } >+ public void internalWorked(double work) { >+ // implements interface method >+ } >+ public boolean isCanceled() { >+ return this.isCanceled; >+ } >+ public void setCanceled(boolean value) { >+ this.isCanceled = value; >+ } >+ public void setTaskName(String name) { >+ // implements interface method >+ } >+ public void subTask(String name) { >+ // implements interface method >+ } >+ public void worked(int work) { >+ // implements interface method >+ } >+ } > } >Index: src/org/eclipse/wst/jsdt/internal/core/index/DiskIndex.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/index/DiskIndex.java,v >retrieving revision 1.4.24.1 >diff -u -r1.4.24.1 DiskIndex.java >--- src/org/eclipse/wst/jsdt/internal/core/index/DiskIndex.java 22 Jun 2010 19:28:14 -0000 1.4.24.1 >+++ src/org/eclipse/wst/jsdt/internal/core/index/DiskIndex.java 19 Jul 2011 19:46:20 -0000 >@@ -52,7 +52,7 @@ > private int bufferIndex, bufferEnd; // used when reading from the file into the streamBuffer > private int streamEnd; // used when writing data from the streamBuffer to the file > >-public static final String SIGNATURE= "INDEX VERSION 1.122"; //$NON-NLS-1$ >+public static final String SIGNATURE= "INDEX VERSION 1.123"; //$NON-NLS-1$ > private static final char[] SIGNATURE_CHARS = SIGNATURE.toCharArray(); > public static boolean DEBUG = false; > >Index: src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java,v >retrieving revision 1.27.2.1 >diff -u -r1.27.2.1 BasicSearchEngine.java >--- src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java 1 Jul 2011 22:12:19 -0000 1.27.2.1 >+++ src/org/eclipse/wst/jsdt/internal/core/search/BasicSearchEngine.java 19 Jul 2011 19:46:20 -0000 >@@ -29,7 +29,10 @@ > import org.eclipse.wst.jsdt.core.IType; > import org.eclipse.wst.jsdt.core.JavaScriptCore; > import org.eclipse.wst.jsdt.core.JavaScriptModelException; >+import org.eclipse.wst.jsdt.core.Signature; > import org.eclipse.wst.jsdt.core.WorkingCopyOwner; >+import org.eclipse.wst.jsdt.core.ast.IArgument; >+import org.eclipse.wst.jsdt.core.ast.IFunctionDeclaration; > import org.eclipse.wst.jsdt.core.compiler.CharOperation; > import org.eclipse.wst.jsdt.core.infer.InferredAttribute; > import org.eclipse.wst.jsdt.core.infer.InferredMethod; >@@ -52,6 +55,7 @@ > import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.wst.jsdt.internal.compiler.env.AccessRestriction; > import org.eclipse.wst.jsdt.internal.compiler.env.AccessRuleSet; >+import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.wst.jsdt.internal.compiler.lookup.Binding; > import org.eclipse.wst.jsdt.internal.compiler.lookup.BlockScope; >@@ -65,6 +69,7 @@ > import org.eclipse.wst.jsdt.internal.core.DefaultWorkingCopyOwner; > import org.eclipse.wst.jsdt.internal.core.JavaModelManager; > import org.eclipse.wst.jsdt.internal.core.JavaProject; >+import org.eclipse.wst.jsdt.internal.core.Logger; > import org.eclipse.wst.jsdt.internal.core.search.indexing.IIndexConstants; > import org.eclipse.wst.jsdt.internal.core.search.indexing.IndexManager; > import org.eclipse.wst.jsdt.internal.core.search.matching.ConstructorDeclarationPattern; >@@ -81,6 +86,7 @@ > import org.eclipse.wst.jsdt.internal.core.search.matching.SecondaryTypeDeclarationPattern; > import org.eclipse.wst.jsdt.internal.core.search.matching.TypeDeclarationPattern; > import org.eclipse.wst.jsdt.internal.core.util.Messages; >+import org.eclipse.wst.jsdt.internal.core.util.QualificationHelpers; > import org.eclipse.wst.jsdt.internal.core.util.Util; > > /** >@@ -101,6 +107,11 @@ > * compilation units. > */ > private IJavaScriptUnit[] workingCopies; >+ >+ /** >+ * <p>Set of all of the working copies paths</p> >+ */ >+ private HashSet fWorkingCopiesPaths; > > /* > * A working copy owner whose working copies will take precedent over >@@ -366,9 +377,9 @@ > return this.parser; > } > >- /* >- * Returns the list of working copies used by this search engine. >- * Returns null if none. >+ /** >+ * @return list of working copies used by this search engine, >+ * or <code>null</code> if none. > */ > private IJavaScriptUnit[] getWorkingCopies() { > IJavaScriptUnit[] copies; >@@ -425,6 +436,22 @@ > } > return result; > } >+ >+ /** >+ * @return {@link HashSet} of all of the working copy paths >+ */ >+ private HashSet getWorkingCopiesPaths() { >+ if(this.fWorkingCopiesPaths == null) { >+ this.fWorkingCopiesPaths = new HashSet(); >+ >+ IJavaScriptUnit[] workingCopies = this.getWorkingCopies(); >+ for(int i = 0; workingCopies != null && i < workingCopies.length; ++i) { >+ this.fWorkingCopiesPaths.add(workingCopies[i].getPath().toString()); >+ } >+ } >+ >+ return this.fWorkingCopiesPaths; >+ } > > /* > * Returns the list of working copies used to do the search on the given Java element. >@@ -566,7 +593,7 @@ > true,false,true, > bindingName, > null,null,null,null, >- null,null,null, >+ null,null, > matchRule); > > } >@@ -578,8 +605,6 @@ > searchPattern = new MethodPattern( > true,false,true, > bindingName, >- null,null,null,null, >- null,null,null, > matchRule); > > } >@@ -610,24 +635,7 @@ > final SearchPattern pattern =searchPattern; > final char typeSuffix=suffix; > >- // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor >- final HashSet workingCopyPaths = new HashSet(); >- String workingCopyPath = null; >- IJavaScriptUnit[] copies = getWorkingCopies(); >- final int copiesLength = copies == null ? 0 : copies.length; >- if (copies != null) { >- if (copiesLength == 1) { >- workingCopyPath = copies[0].getPath().toString(); >- } else { >- for (int i = 0; i < copiesLength; i++) { >- IJavaScriptUnit workingCopy = copies[i]; >- workingCopyPaths.add(workingCopy.getPath().toString()); >- } >- } >- } >- final String singleWkcpPath = workingCopyPath; >- >- // Index requestor >+ // Index requester > IndexQueryRequestor searchRequestor = new IndexQueryRequestor(){ > public boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access) { > // Filter unexpected types >@@ -691,6 +699,8 @@ > progressMonitor == null ? null : new SubProgressMonitor(progressMonitor, 100)); > > // add type names from working copies >+ IJavaScriptUnit[] copies = getWorkingCopies(); >+ final int copiesLength = copies == null ? 0 : copies.length; > if (copies != null && doParse) { > for (int i = 0; i < copiesLength; i++) { > IJavaScriptUnit workingCopy = copies[i]; >@@ -705,14 +715,6 @@ > IType[] allTypes = workingCopy.getAllTypes(); > for (int j = 0, allTypesLength = allTypes.length; j < allTypesLength; j++) { > IType type = allTypes[j]; >- IJavaScriptElement parent = type.getParent(); >- char[][] enclosingTypeNames; >- if (parent instanceof IType) { >- char[] parentQualifiedName = ((IType)parent).getTypeQualifiedName('.').toCharArray(); >- enclosingTypeNames = CharOperation.splitOn('.', parentQualifiedName); >- } else { >- enclosingTypeNames = CharOperation.NO_CHAR_CHAR; >- } > char[] simpleName = type.getElementName().toCharArray(); > int kind = TypeDeclaration.CLASS_DECL; > >@@ -726,16 +728,7 @@ > IFunction[] allMethods = workingCopy.getFunctions(); > for (int j = 0, allMethodsLength = allMethods.length; j < allMethodsLength; j++) { > IFunction method = allMethods[j]; >- IJavaScriptElement parent = method.getParent(); >-// char[][] enclosingTypeNames; >- if (parent instanceof IType) { >-// char[] parentQualifiedName = ((IType)parent).getTypeQualifiedName('.').toCharArray(); >-// enclosingTypeNames = CharOperation.splitOn('.', parentQualifiedName); >- } else { >-// enclosingTypeNames = CharOperation.NO_CHAR_CHAR; >- } > char[] simpleName = method.getElementName().toCharArray(); >-// int kind; > if (match(typeSuffix, packageName, bindingName, matchRule, 0, packageDeclaration, simpleName)) { > nameRequestor.acceptBinding(bindingType,method.getFlags(), packageDeclaration, simpleName, path, null); > } >@@ -749,16 +742,7 @@ > IField[] allFields = workingCopy.getFields (); > for (int j = 0, allFieldsLength = allFields.length; j < allFieldsLength; j++) { > IField field = allFields[j]; >- IJavaScriptElement parent = field.getParent(); >- char[][] enclosingTypeNames; >- if (parent instanceof IType) { >- char[] parentQualifiedName = ((IType)parent).getTypeQualifiedName('.').toCharArray(); >- enclosingTypeNames = CharOperation.splitOn('.', parentQualifiedName); >- } else { >- enclosingTypeNames = CharOperation.NO_CHAR_CHAR; >- } > char[] simpleName = field.getElementName().toCharArray(); >- int kind; > if (match(typeSuffix, packageName, bindingName, matchRule, 0, packageDeclaration, simpleName)) { > nameRequestor.acceptBinding(bindingType,field.getFlags(), packageDeclaration, simpleName, path, null); > } >@@ -799,24 +783,6 @@ > } > return true; > } >-// public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope classScope) { >-// if (match(typeSuffix, packageName, bindingName, matchRule, TypeDeclaration.kind(memberTypeDeclaration.modifiers), packageDeclaration, memberTypeDeclaration.name)) { >-// // compute encloising type names >-// TypeDeclaration enclosing = memberTypeDeclaration.enclosingType; >-// char[][] enclosingTypeNames = CharOperation.NO_CHAR_CHAR; >-// while (enclosing != null) { >-// enclosingTypeNames = CharOperation.arrayConcat(new char[][] {enclosing.name}, enclosingTypeNames); >-// if ((enclosing.bits & ASTNode.IsMemberType) != 0) { >-// enclosing = enclosing.enclosingType; >-// } else { >-// enclosing = null; >-// } >-// } >-// // report >-// nameRequestor.acceptType(memberTypeDeclaration.modifiers, packageDeclaration, memberTypeDeclaration.name, enclosingTypeNames, path, null); >-// } >-// return true; >-// } > public boolean visit(InferredType inferredType, BlockScope scope) { > if (bindingType==Binding.TYPE && > match(typeSuffix, packageName, bindingName, matchRule, TypeDeclaration.kind(0), packageDeclaration, inferredType.getName())) { >@@ -885,24 +851,10 @@ > IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager(); > final TypeDeclarationPattern pattern = new SecondaryTypeDeclarationPattern(); > >- // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requestor >- final HashSet workingCopyPaths = new HashSet(); >- String workingCopyPath = null; >- IJavaScriptUnit[] copies = getWorkingCopies(); >- final int copiesLength = copies == null ? 0 : copies.length; >- if (copies != null) { >- if (copiesLength == 1) { >- workingCopyPath = copies[0].getPath().toString(); >- } else { >- for (int i = 0; i < copiesLength; i++) { >- IJavaScriptUnit workingCopy = copies[i]; >- workingCopyPaths.add(workingCopy.getPath().toString()); >- } >- } >- } >- final String singleWkcpPath = workingCopyPath; >+ // Get working copy path(s). Store in a single string in case of only one to optimize comparison in requester >+ final HashSet workingCopyPaths = this.getWorkingCopiesPaths(); > >- // Index requestor >+ // Index requester > IndexQueryRequestor searchRequestor = new IndexQueryRequestor(){ > public boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access) { > // Filter unexpected types >@@ -913,19 +865,9 @@ > if (record.enclosingTypeNames == IIndexConstants.ONE_ZERO_CHAR) { > return true; // filter out local and anonymous classes > } >- switch (copiesLength) { >- case 0: >- break; >- case 1: >- if (singleWkcpPath.equals(documentPath)) { >- return true; // fliter out *the* working copy >- } >- break; >- default: >- if (workingCopyPaths.contains(documentPath)) { >- return true; // filter out working copies >- } >- break; >+ >+ if (workingCopyPaths.contains(documentPath)) { >+ return true; // filter out working copies > } > > // Accept document path >@@ -1610,7 +1552,7 @@ > record.modifiers, > record.declaringSimpleName, > record.parameterCount, >- record.parameterTypes, >+ record.parameterTypeNames, > record.parameterNames, > documentPath, > accessRestriction); >@@ -1637,4 +1579,273 @@ > } > } > } >+ >+ /** >+ * <p>Searches for all methods in the index and working copies.</p> >+ * >+ * @param functionRequester requester to report results to >+ * @param selectorPattern selector pattern that the results need to match >+ * @param declaringType type that all results must be defined on >+ * @param selectorPatternMatchRule the match rule used with the given <code>selectorPattern</code> >+ * @param scope of the search >+ * @param waitingPolicy policy to use when waiting for the index to index >+ * @param progressMonitor monitor to report status too >+ * >+ * @see SearchPattern >+ * >+ * @see IJob#ForceImmediate >+ * @see IJob#CancelIfNotReady >+ * @see IJob#WaitUntilReady >+ */ >+ public void searchAllFunctions(final IFunctionRequester functionRequester, >+ char[] selectorPattern, String declaringType, final int selectorPatternMatchRule, >+ IJavaScriptSearchScope scope, >+ int waitingPolicy, IProgressMonitor progressMonitor) { >+ >+ //determine the declaring type pattern characters >+ char[] declaringTypePatternChars = null; >+ if(declaringType != null && declaringType.trim().length() > 0) { >+ declaringTypePatternChars = declaringType.toCharArray(); >+ } >+ >+ //pattern for searching the index and working copies >+ final MethodPattern searchPattern = new MethodPattern(true, false, >+ selectorPattern, declaringTypePatternChars, selectorPatternMatchRule); >+ >+ //requester used to accept index matches >+ final HashSet workingCopiesPaths = this.getWorkingCopiesPaths(); >+ IndexQueryRequestor queryRequestor = new IndexQueryRequestor() { >+ /** >+ * @see org.eclipse.wst.jsdt.internal.core.search.IndexQueryRequestor#acceptIndexMatch(java.lang.String, org.eclipse.wst.jsdt.core.search.SearchPattern, org.eclipse.wst.jsdt.core.search.SearchParticipant, org.eclipse.wst.jsdt.internal.compiler.env.AccessRuleSet) >+ */ >+ public boolean acceptIndexMatch(String documentPath, >+ SearchPattern indexRecord, SearchParticipant participant, >+ AccessRuleSet access) { >+ >+ if(!workingCopiesPaths.contains(documentPath)) { >+ MethodPattern record = (MethodPattern)indexRecord; >+ functionRequester.acceptFunction(record.selector, record.parameterCount, >+ record.parameterQualifications, record.parameterSimpleNames, record.parameterNames, >+ record.returnQualification, record.returnSimpleName, >+ record.declaringQualification, record.declaringSimpleName, >+ record.modifiers, >+ documentPath); >+ } >+ >+ return true; >+ } >+ }; >+ >+ // Find function matches from index >+ IndexManager indexManager = JavaModelManager.getJavaModelManager().getIndexManager(); >+ try { >+ if (progressMonitor != null) { >+ progressMonitor.beginTask(Messages.engine_searching, 1000); >+ } >+ >+ indexManager.performConcurrentJob( >+ new PatternSearchJob( >+ searchPattern, >+ getDefaultSearchParticipant(), // JavaScript search only >+ scope, >+ queryRequestor), >+ waitingPolicy, >+ progressMonitor == null ? null : new SubProgressMonitor(progressMonitor, 1000)); >+ } finally { >+ if (progressMonitor != null) { >+ progressMonitor.done(); >+ } >+ } >+ >+ // find function matches from working copies >+ IJavaScriptUnit[] workingCopies = this.getWorkingCopies(); >+ for (int i = 0; workingCopies != null && i < workingCopies.length; i++) { >+ final IJavaScriptUnit workingCopy = workingCopies[i]; >+ >+ //skip this working copy if not in the scope >+ if(!scope.encloses(workingCopy)) { >+ continue; >+ } >+ >+ try { >+ /* if working copy is consistent use the working copy as is >+ * else need to re-parse the working copy and visit its AST >+ */ >+ if (workingCopy.isConsistent()) { >+ //check each function in the working copy for a match >+ IFunction[] allFunctions = workingCopy.getFunctions(); >+ for (int j = 0; j < allFunctions.length; ++j) { >+ IFunction function = allFunctions[j]; >+ >+ //selector must not be null for it to be a match >+ char[] wcSelector = null; >+ if(function.getElementName() != null) { >+ wcSelector = function.getElementName().toCharArray(); >+ } >+ if(wcSelector != null) { >+ >+ //create a pattern from the working copy method >+ char[] wcDeclaringType = null; >+ if(function.getDeclaringType() != null && function.getDeclaringType().getTypeQualifiedName() != null) { >+ wcDeclaringType = function.getDeclaringType().getTypeQualifiedName().toCharArray(); >+ } >+ MethodPattern wcPattern = new MethodPattern(true, false, >+ wcSelector ,wcDeclaringType, selectorPatternMatchRule); >+ >+ //if working copy function matches the search pattern then accept the function >+ if(searchPattern.matchesDecodedKey(wcPattern)) { >+ //figure out parameter names and types >+ String[] wcParameterNames = function.getParameterNames(); >+ char[][][] wcSeperatedParamTypes = >+ QualificationHelpers.seperateFullyQualifiednames(function.getParameterTypes(), wcParameterNames.length); >+ >+ //figure out the return type parts >+ char[] wcReturnQualification = null; >+ char[] wcReturnSimpleName = null; >+ String wcReturnTypeSig = function.getReturnType(); >+ if(wcReturnTypeSig != null) { >+ char[] wcReturnType = Signature.toString(wcReturnTypeSig).toCharArray(); >+ char[][] wcSeperatedReturnType = >+ QualificationHelpers.seperateFullyQualifedName(wcReturnType); >+ wcReturnQualification = wcSeperatedReturnType[QualificationHelpers.QULIFIERS_INDEX]; >+ wcReturnSimpleName = wcSeperatedReturnType[QualificationHelpers.SIMPLE_NAMES_INDEX]; >+ } >+ >+ //get the declaring type parts >+ char[][] wcSeperatedDeclaringType = QualificationHelpers.seperateFullyQualifedName(wcDeclaringType); >+ >+ //accept the method >+ functionRequester.acceptFunction(wcSelector, wcParameterNames.length, >+ wcSeperatedParamTypes[QualificationHelpers.QULIFIERS_INDEX], >+ wcSeperatedParamTypes[QualificationHelpers.SIMPLE_NAMES_INDEX], >+ QualificationHelpers.stringArrayToCharArray(wcParameterNames), >+ wcReturnQualification, wcReturnSimpleName, >+ wcSeperatedDeclaringType[QualificationHelpers.QULIFIERS_INDEX], >+ wcSeperatedDeclaringType[QualificationHelpers.SIMPLE_NAMES_INDEX], >+ function.getFlags(), workingCopy.getPath().toString()); >+ } >+ } >+ } >+ } else { >+ Parser basicParser = getParser(); >+ ICompilationUnit unit = (ICompilationUnit) workingCopy; >+ CompilationResult compilationUnitResult = new CompilationResult(unit, 0, 0, this.compilerOptions.maxProblemsPerUnit); >+ CompilationUnitDeclaration parsedUnit = basicParser.dietParse(unit, compilationUnitResult); >+ if (parsedUnit != null) { >+ basicParser.inferTypes(parsedUnit, null); >+ parsedUnit.traverse( new ASTVisitor() { >+ /** >+ * @see org.eclipse.wst.jsdt.internal.compiler.ASTVisitor#visit(org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration, org.eclipse.wst.jsdt.internal.compiler.lookup.Scope) >+ */ >+ public boolean visit(MethodDeclaration methodDeclaration, Scope scope) { >+ if(methodDeclaration.inferredMethod != null) { >+ this.visit(methodDeclaration.inferredMethod); >+ } else { >+ this.visit(methodDeclaration, methodDeclaration.getName(), null); >+ } >+ >+ return true; >+ } >+ >+ /** >+ * @see org.eclipse.wst.jsdt.internal.compiler.ASTVisitor#visit(org.eclipse.wst.jsdt.core.infer.InferredMethod, org.eclipse.wst.jsdt.internal.compiler.lookup.BlockScope) >+ */ >+ public boolean visit(InferredMethod inferredMethod, BlockScope scope) { >+ visit(inferredMethod); >+ return true; >+ } >+ >+ /** >+ * <p>Visits an {@link InferredMethod} on a working copy</p> >+ * >+ * @param inferredMethod {@link InferredMethod} on the working copy to visit >+ */ >+ private void visit(InferredMethod inferredMethod) { >+ char[] wcDeclaringType = null; >+ if(inferredMethod.inType != null) { >+ wcDeclaringType = inferredMethod.inType.getName(); >+ } >+ >+ this.visit(inferredMethod.getFunctionDeclaration(), >+ inferredMethod.name, wcDeclaringType); >+ } >+ >+ /** >+ * <p>Visits an {@link IFunctionDeclaration} using a given selector name >+ * and declaring type</p> >+ * >+ * @param funcDecl function declaration to visit >+ * @param wcSelector selector to use when visiting the declaration >+ * @param wcDeclaringType declaring type to use when visiting the declaration >+ */ >+ private void visit(IFunctionDeclaration funcDecl, >+ char[] wcSelector, char[] wcDeclaringType) { >+ >+ //create the working copy pattern >+ MethodPattern wcPattern = new MethodPattern(true, false, >+ wcSelector,wcDeclaringType, selectorPatternMatchRule); >+ >+ //if working copy function matches the search pattern then accept the function qualification >+ if(searchPattern.matchesDecodedKey(wcPattern)) { >+ //get parameter names and types >+ IArgument[] args = funcDecl.getArguments(); >+ char[][] wcParameterNames = null; >+ char[][] wcParameterQualifications = null; >+ char[][] wcParameterSimpleNames = null; >+ int wcParametersLength = 0; >+ if(args != null) { >+ wcParameterNames = new char[args.length][]; >+ wcParameterQualifications = new char[args.length][]; >+ wcParameterSimpleNames = new char[args.length][]; >+ wcParametersLength = args.length; >+ >+ for(int i = 0; i < args.length; ++i) { >+ wcParameterNames[i] = args[i].getName(); >+ if(args[i].getInferredType() != null) { >+ char[][] wcSeperatedParamType = >+ QualificationHelpers.seperateFullyQualifedName(args[i].getInferredType().getName()); >+ wcParameterQualifications[i] = wcSeperatedParamType[QualificationHelpers.QULIFIERS_INDEX]; >+ wcParameterSimpleNames[i] = wcSeperatedParamType[QualificationHelpers.SIMPLE_NAMES_INDEX]; >+ } >+ } >+ } >+ >+ //get return type >+ char[] wcReturnQualification = null; >+ char[] wcReturnSimpleName = null; >+ if(funcDecl.getInferredType() != null) { >+ char[][] seperatedReturnType = QualificationHelpers.seperateFullyQualifedName( >+ funcDecl.getInferredType().getName()); >+ wcReturnQualification = seperatedReturnType[QualificationHelpers.QULIFIERS_INDEX]; >+ wcReturnSimpleName = seperatedReturnType[QualificationHelpers.SIMPLE_NAMES_INDEX]; >+ } >+ >+ //get the declaring type parts >+ char[][] wcSeperatedDeclaringType = QualificationHelpers.seperateFullyQualifedName(wcDeclaringType); >+ >+ //get the modifiers >+ int modifiers = 0; >+ if(funcDecl instanceof MethodDeclaration) { >+ modifiers = ((MethodDeclaration) funcDecl).modifiers; >+ } >+ >+ //accept the method >+ functionRequester.acceptFunction(wcSelector, wcParametersLength, >+ wcParameterQualifications, >+ wcParameterSimpleNames, >+ wcParameterNames, >+ wcReturnQualification, wcReturnSimpleName, >+ wcSeperatedDeclaringType[QualificationHelpers.QULIFIERS_INDEX], >+ wcSeperatedDeclaringType[QualificationHelpers.SIMPLE_NAMES_INDEX], >+ modifiers, workingCopy.getPath().toString()); >+ } >+ } >+ }, parsedUnit.scope); >+ } >+ } >+ } catch(JavaScriptModelException e) { >+ Logger.logException("Error while processing working copy", e); >+ } >+ } >+ } > } >Index: src/org/eclipse/wst/jsdt/internal/core/search/IFunctionRequester.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/internal/core/search/IFunctionRequester.java >diff -N src/org/eclipse/wst/jsdt/internal/core/search/IFunctionRequester.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/jsdt/internal/core/search/IFunctionRequester.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.jsdt.internal.core.search; >+ >+/** >+ * <p>Requester to use when requesting function matches.</p> >+ */ >+public interface IFunctionRequester { >+ >+ /** >+ * <p>Accept a function defined with all of the given information.</p> >+ * >+ * @param signature >+ * @param parameterCount >+ * @param parameterQualifications >+ * @param parameterSimpleNames >+ * @param parameterNames >+ * @param returnQualification >+ * @param returnSimpleName >+ * @param declaringQualification >+ * @param declaringSimpleName >+ * @param modifiers >+ * @param path >+ */ >+ public void acceptFunction( >+ char[] signature, >+ int parameterCount, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, >+ char[][] parameterNames, >+ char[] returnQualification, >+ char[] returnSimpleName, >+ char[] declaringQualification, >+ char[] declaringSimpleName, >+ int modifiers, >+ String path); >+} >Index: src/org/eclipse/wst/jsdt/internal/core/search/IndexQueryRequestor.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/IndexQueryRequestor.java,v >retrieving revision 1.3 >diff -u -r1.3 IndexQueryRequestor.java >--- src/org/eclipse/wst/jsdt/internal/core/search/IndexQueryRequestor.java 30 Apr 2008 21:32:27 -0000 1.3 >+++ src/org/eclipse/wst/jsdt/internal/core/search/IndexQueryRequestor.java 19 Jul 2011 19:46:21 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 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 >@@ -15,11 +15,21 @@ > import org.eclipse.wst.jsdt.internal.compiler.env.AccessRuleSet; > > /** >- * TODO add spec >+ * <p>Requester used when searching an index for matches to a pattern.</p> > */ > public abstract class IndexQueryRequestor { > >- // answer false if requesting cancel >- public abstract boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, SearchParticipant participant, AccessRuleSet access); >+ /** >+ * <p>Accepts an index match when searching an index.</p> >+ * >+ * @param documentPath >+ * @param indexRecord >+ * @param participant >+ * @param access >+ * >+ * @return <code>true</code> to continue search, <code>false</code> to request cancel of search >+ */ >+ public abstract boolean acceptIndexMatch(String documentPath, SearchPattern indexRecord, >+ SearchParticipant participant, AccessRuleSet access); > > } >Index: src/org/eclipse/wst/jsdt/internal/core/search/indexing/AbstractIndexer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/AbstractIndexer.java,v >retrieving revision 1.12.2.2 >diff -u -r1.12.2.2 AbstractIndexer.java >--- src/org/eclipse/wst/jsdt/internal/core/search/indexing/AbstractIndexer.java 1 Jul 2011 22:12:20 -0000 1.12.2.2 >+++ src/org/eclipse/wst/jsdt/internal/core/search/indexing/AbstractIndexer.java 19 Jul 2011 19:46:21 -0000 >@@ -74,10 +74,16 @@ > protected void addIndexEntry(char[] category, char[] key) { > this.document.addIndexEntry(category, key); > } >- public void addMethodDeclaration(char[] methodName, char[][] parameterTypes, >- char[] returnType,boolean isFunction) { >+ public void addMethodDeclaration(char[] methodName, char[][] parameterTypes, char[][] paramaterNames, >+ char[] returnType, char[] declaringType, boolean isFunction, int modifiers) { > int argCount = parameterTypes == null ? 0 : parameterTypes.length; >- addIndexEntry(isFunction ? FUNCTION_DECL : METHOD_DECL, MethodPattern.createIndexKey(methodName, argCount)); >+ >+ //compute key >+ char[] key = MethodPattern.createIndexKey(methodName, argCount, >+ parameterTypes, paramaterNames, declaringType, returnType, modifiers); >+ if(key != null) { >+ addIndexEntry(isFunction ? FUNCTION_DECL : METHOD_DECL, key); >+ } > > if (parameterTypes != null) { > for (int i = 0; i < argCount; i++) >@@ -87,7 +93,10 @@ > addTypeReference(returnType); > } > public void addMethodReference(char[] methodName, int argCount) { >- addIndexEntry(METHOD_REF, MethodPattern.createIndexKey(methodName, argCount)); >+ char[] key = MethodPattern.createIndexKey(methodName, argCount); >+ if(key != null) { >+ addIndexEntry(METHOD_REF, key); >+ } > } > public void addNameReference(char[] name) { > addIndexEntry(REF, name); >Index: src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java,v >retrieving revision 1.11.2.1 >diff -u -r1.11.2.1 IIndexConstants.java >--- src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java 1 Jul 2011 22:12:20 -0000 1.11.2.1 >+++ src/org/eclipse/wst/jsdt/internal/core/search/indexing/IIndexConstants.java 19 Jul 2011 19:46:21 -0000 >@@ -14,43 +14,44 @@ > public interface IIndexConstants { > > /* index encoding */ >- char[] REF= "ref".toCharArray(); //$NON-NLS-1$ >- char[] METHOD_REF= "methodRef".toCharArray(); //$NON-NLS-1$ >- char[] CONSTRUCTOR_REF= "constructorRef".toCharArray(); //$NON-NLS-1$ >- char[] SUPER_REF = "superRef".toCharArray(); //$NON-NLS-1$ >- char[] TYPE_DECL = "typeDecl".toCharArray(); //$NON-NLS-1$ >- char[] METHOD_DECL= "methodDecl".toCharArray(); //$NON-NLS-1$ >- char[] FUNCTION_DECL= "functionDecl".toCharArray(); //$NON-NLS-1$ >- char[] CONSTRUCTOR_DECL= "constructorDecl".toCharArray(); //$NON-NLS-1$ >- char[] FIELD_DECL= "fieldDecl".toCharArray(); //$NON-NLS-1$ >- char[] VAR_DECL= "varDecl".toCharArray(); //$NON-NLS-1$ >- char[] OBJECT = "Object".toCharArray(); //$NON-NLS-1$ >- char[][] COUNTS= >+ final char[] REF= "ref".toCharArray(); //$NON-NLS-1$ >+ final char[] METHOD_REF= "methodRef".toCharArray(); //$NON-NLS-1$ >+ final char[] CONSTRUCTOR_REF= "constructorRef".toCharArray(); //$NON-NLS-1$ >+ final char[] SUPER_REF = "superRef".toCharArray(); //$NON-NLS-1$ >+ final char[] TYPE_DECL = "typeDecl".toCharArray(); //$NON-NLS-1$ >+ final char[] METHOD_DECL= "methodDecl".toCharArray(); //$NON-NLS-1$ >+ final char[] FUNCTION_DECL= "functionDecl".toCharArray(); //$NON-NLS-1$ >+ final char[] CONSTRUCTOR_DECL= "constructorDecl".toCharArray(); //$NON-NLS-1$ >+ final char[] FIELD_DECL= "fieldDecl".toCharArray(); //$NON-NLS-1$ >+ final char[] VAR_DECL= "varDecl".toCharArray(); //$NON-NLS-1$ >+ final char[] OBJECT = "Object".toCharArray(); //$NON-NLS-1$ >+ final char[][] COUNTS= > new char[][] { new char[] {'/', '0'}, new char[] {'/', '1'}, new char[] {'/', '2'}, new char[] {'/', '3'}, new char[] {'/', '4'}, > new char[] {'/', '5'}, new char[] {'/', '6'}, new char[] {'/', '7'}, new char[] {'/', '8'}, new char[] {'/', '9'} > }; >- char CLASS_SUFFIX = 'C'; >- char TYPE_SUFFIX = 0; >- char SEPARATOR= '/'; >- char PARAMETER_SEPARATOR= ','; >- char SECONDARY_SUFFIX = 'S'; >+ final char CLASS_SUFFIX = 'C'; >+ final char TYPE_SUFFIX = 0; >+ final char SEPARATOR= '/'; >+ final char PARAMETER_SEPARATOR= ','; >+ final char SECONDARY_SUFFIX = 'S'; >+ final char DOT = '.'; > >- char[] ONE_STAR = new char[] {'*'}; >- char[][] ONE_STAR_CHAR = new char[][] {ONE_STAR}; >+ final char[] ONE_STAR = new char[] {'*'}; >+ final char[][] ONE_STAR_CHAR = new char[][] {ONE_STAR}; > > // used as special marker for enclosing type name of local and anonymous classes >- char ZERO_CHAR = '0'; >- char[] ONE_ZERO = new char[] { ZERO_CHAR }; >- char[][] ONE_ZERO_CHAR = new char[][] {ONE_ZERO}; >+ final char ZERO_CHAR = '0'; >+ final char[] ONE_ZERO = new char[] { ZERO_CHAR }; >+ final char[][] ONE_ZERO_CHAR = new char[][] {ONE_ZERO}; > >- int PKG_REF_PATTERN = 0x0001; >- int PKG_DECL_PATTERN = 0x0002; >- int TYPE_REF_PATTERN = 0x0004; >- int TYPE_DECL_PATTERN = 0x0008; >- int SUPER_REF_PATTERN = 0x0010; >- int CONSTRUCTOR_PATTERN = 0x0020; >- int FIELD_PATTERN = 0x0040; >- int METHOD_PATTERN = 0x0080; >- int OR_PATTERN = 0x0100; >- int LOCAL_VAR_PATTERN = 0x0200; >+ final int PKG_REF_PATTERN = 0x0001; >+ final int PKG_DECL_PATTERN = 0x0002; >+ final int TYPE_REF_PATTERN = 0x0004; >+ final int TYPE_DECL_PATTERN = 0x0008; >+ final int SUPER_REF_PATTERN = 0x0010; >+ final int CONSTRUCTOR_PATTERN = 0x0020; >+ final int FIELD_PATTERN = 0x0040; >+ final int METHOD_PATTERN = 0x0080; >+ final int OR_PATTERN = 0x0100; >+ final int LOCAL_VAR_PATTERN = 0x0200; > } >Index: src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexer.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexer.java,v >retrieving revision 1.9 >diff -u -r1.9 SourceIndexer.java >--- src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexer.java 21 Aug 2008 21:17:06 -0000 1.9 >+++ src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexer.java 19 Jul 2011 19:46:21 -0000 >@@ -21,8 +21,8 @@ > import org.eclipse.wst.jsdt.internal.compiler.util.SuffixConstants; > import org.eclipse.wst.jsdt.internal.core.BasicCompilationUnit; > import org.eclipse.wst.jsdt.internal.core.JavaModelManager; >+import org.eclipse.wst.jsdt.internal.core.Logger; > import org.eclipse.wst.jsdt.internal.core.search.JavaSearchDocument; >-import org.eclipse.wst.jsdt.internal.core.search.processing.JobManager; > import org.eclipse.wst.jsdt.internal.oaametadata.LibraryAPIs; > import org.eclipse.wst.jsdt.internal.oaametadata.MetadataReader; > import org.eclipse.wst.jsdt.internal.oaametadata.MetadataSourceElementNotifier; >@@ -79,9 +79,7 @@ > try { > parser.parseCompilationUnit(compilationUnit, true/*full parse*/); > } catch (Exception e) { >- if (JobManager.VERBOSE) { >- e.printStackTrace(); >- } >+ Logger.logException("Error while indexing document", e); > } > } > public void indexMetadata() { >Index: src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexerRequestor.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexerRequestor.java,v >retrieving revision 1.17.2.1 >diff -u -r1.17.2.1 SourceIndexerRequestor.java >--- src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexerRequestor.java 1 Jul 2011 22:12:20 -0000 1.17.2.1 >+++ src/org/eclipse/wst/jsdt/internal/core/search/indexing/SourceIndexerRequestor.java 19 Jul 2011 19:46:21 -0000 >@@ -190,7 +190,9 @@ > */ > public void enterMethod(MethodInfo methodInfo) { > boolean isFunction=this.depth==0; >- this.indexer.addMethodDeclaration(methodInfo.name, methodInfo.parameterTypes, methodInfo.returnType,isFunction); >+ this.indexer.addMethodDeclaration(methodInfo.name, methodInfo.parameterTypes, >+ methodInfo.parameterNames, methodInfo.returnType, methodInfo.declaringType, >+ isFunction, methodInfo.modifiers); > this.methodDepth++; > } > /** >Index: src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorDeclarationPattern.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorDeclarationPattern.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 ConstructorDeclarationPattern.java >--- src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorDeclarationPattern.java 1 Jul 2011 22:20:30 -0000 1.1.2.2 >+++ src/org/eclipse/wst/jsdt/internal/core/search/matching/ConstructorDeclarationPattern.java 19 Jul 2011 19:46:21 -0000 >@@ -12,14 +12,18 @@ > > import org.eclipse.wst.jsdt.core.compiler.CharOperation; > import org.eclipse.wst.jsdt.core.search.SearchPattern; >-import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; > > /** > * <p>Pattern used to find and store constructor declarations.</p> > */ > public class ConstructorDeclarationPattern extends ConstructorPattern { >+ /** <p> Modifiers for the constructor</p> */ > public int modifiers; >- public char[][] parameterTypes; >+ >+ /** <p>Fully qualified type names for the parameters of the constructor</p> */ >+ public char[][] parameterTypeNames; >+ >+ /** <p>names of the parameters</p> */ > public char[][] parameterNames; > > public ConstructorDeclarationPattern(char[] declaringSimpleName, int matchRule) { >@@ -79,14 +83,14 @@ > > // initialize optional fields > this.modifiers = 0; >- this.parameterTypes = null; >+ this.parameterTypeNames = null; > this.parameterNames = null; > > /* if no parameters just decode modifiers > * else decode parameters and modifiers > */ > start = slash + 1; >- if (this.parameterCount == 0) { >+ if (this.parameterCount <= 0 ) { > slash = slash + 3; > last = slash - 1; > >@@ -96,7 +100,7 @@ > last = slash - 1; > > >- this.parameterTypes = CharOperation.splitOn(PARAMETER_SEPARATOR, key, start, slash); >+ this.parameterTypeNames = CharOperation.splitOn(PARAMETER_SEPARATOR, key, start, slash); > > start = slash + 1; > slash = CharOperation.indexOf(SEPARATOR, key, start); >@@ -110,8 +114,6 @@ > last = slash - 1; > > this.modifiers = key[last-1] + (key[last]<<16); >- } else { >- this.modifiers = ClassFileConstants.AccPublic; > } > } > >@@ -143,11 +145,7 @@ > if (parameterCount > 0) { > //get param types > if (parameterTypes != null && parameterTypes.length == parameterCount) { >- char[][] parameterTypeErasures = new char[parameterCount][]; >- for (int i = 0; i < parameterTypes.length; i++) { >- parameterTypeErasures[i] = getTypeErasure(parameterTypes[i]); >- } >- parameterTypesChars = CharOperation.concatWith(parameterTypeErasures, PARAMETER_SEPARATOR, false); >+ parameterTypesChars = CharOperation.concatWith(parameterTypes, PARAMETER_SEPARATOR, false); > } > > //get param names >@@ -214,37 +212,4 @@ > > return result; > } >- >- private static char[] getTypeErasure(char[] typeName) { >- char[] typeErasurename = new char[0]; >- if(typeName != null) { >- int index; >- if ((index = CharOperation.indexOf('<', typeName)) == -1) return typeName; >- >- int length = typeName.length; >- typeErasurename = new char[length - 2]; >- >- System.arraycopy(typeName, 0, typeErasurename, 0, index); >- >- int depth = 1; >- for (int i = index + 1; i < length; i++) { >- switch (typeName[i]) { >- case '<': >- depth++; >- break; >- case '>': >- depth--; >- break; >- default: >- if (depth == 0) { >- typeErasurename[index++] = typeName[i]; >- } >- break; >- } >- } >- >- System.arraycopy(typeErasurename, 0, typeErasurename = new char[index], 0, index); >- } >- return typeErasurename; >- } > } >Index: src/org/eclipse/wst/jsdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java,v >retrieving revision 1.4 >diff -u -r1.4 DeclarationOfReferencedMethodsPattern.java >--- src/org/eclipse/wst/jsdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java 30 Apr 2008 21:32:30 -0000 1.4 >+++ src/org/eclipse/wst/jsdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java 19 Jul 2011 19:46:21 -0000 >@@ -21,7 +21,7 @@ > protected SimpleSet knownMethods; > > public DeclarationOfReferencedMethodsPattern(IJavaScriptElement enclosingElement) { >- super(false, true, false,null, null, null, null, null, null, null, null, R_PATTERN_MATCH); >+ super(false, true, false,null, R_PATTERN_MATCH); > > this.enclosingElement = enclosingElement; > this.knownMethods = new SimpleSet(); >Index: src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java,v >retrieving revision 1.43.2.2 >diff -u -r1.43.2.2 MatchLocator.java >--- src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java 25 May 2011 18:48:33 -0000 1.43.2.2 >+++ src/org/eclipse/wst/jsdt/internal/core/search/matching/MatchLocator.java 19 Jul 2011 19:46:22 -0000 >@@ -926,10 +926,6 @@ > } > // Get binding from unit scope > char[] typeName = PatternLocator.qualifiedPattern(methodPattern.declaringSimpleName, methodPattern.declaringQualification); >- if (typeName == null) { >- if (methodPattern.declaringType == null) return null; >- typeName = methodPattern.declaringType.getFullyQualifiedName().toCharArray(); >- } > TypeBinding declaringTypeBinding = getType(typeName, typeName); > if (declaringTypeBinding != null) { > if (declaringTypeBinding.isArrayType()) { >Index: src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java,v >retrieving revision 1.24 >diff -u -r1.24 MethodLocator.java >--- src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java 13 Jan 2010 14:54:37 -0000 1.24 >+++ src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodLocator.java 19 Jul 2011 19:46:22 -0000 >@@ -24,7 +24,6 @@ > import org.eclipse.wst.jsdt.core.infer.InferredMethod; > import org.eclipse.wst.jsdt.core.search.MethodDeclarationMatch; > import org.eclipse.wst.jsdt.core.search.SearchMatch; >-import org.eclipse.wst.jsdt.core.search.SearchPattern; > import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode; > import org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration; > import org.eclipse.wst.jsdt.internal.compiler.ast.Argument; >@@ -79,7 +78,7 @@ > this.pattern.declaringSimpleName, > this.pattern.declaringQualification, > locator, >- this.pattern.declaringType, >+ null, > locator.progressMonitor).collect(); > } catch (JavaScriptModelException e) { > // inaccurate matches will be found >@@ -146,11 +145,6 @@ > } > } > >- // Verify type arguments (do not reject if pattern has no argument as it can be an erasure match) >- if (this.pattern.hasMethodArguments()) { >- return IMPOSSIBLE_MATCH; >- } >- > // Method declaration may match pattern > return nodeSet.addMatch(node, resolve ? POSSIBLE_MATCH : ACCURATE_MATCH); > } >@@ -158,7 +152,7 @@ > if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH; > > if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH; >- if (this.pattern.parameterSimpleNames != null && (!this.pattern.varargs || ((node.bits & ASTNode.InsideJavadoc) != 0))) { >+ if (this.pattern.parameterSimpleNames != null && ((node.bits & ASTNode.InsideJavadoc) != 0)) { > int length = this.pattern.parameterSimpleNames.length; > ASTNode[] args = node.arguments; > int argsLength = args == null ? 0 : args.length; >@@ -295,11 +289,6 @@ > } > } > void matchReportReference(MessageSend messageSend, MatchLocator locator, MethodBinding methodBinding) throws CoreException { >- >- if (this.pattern.hasMethodArguments()) { // binding has no type params, compatible erasure if pattern does >- match.setRule(SearchPattern.R_ERASURE_MATCH); >- } >- > // See whether it is necessary to report or not > if (match.getRule() == 0) return; // impossible match > boolean report = (this.isErasureMatch && match.isErasure()) || (this.isEquivalentMatch && match.isEquivalent()) || match.isExact(); >@@ -311,23 +300,7 @@ > match.setLength(messageSend.sourceEnd - offset + 1); > locator.report(match); > } >-/* >- * Return whether method parameters are equals to pattern ones. >- */ >-private boolean methodParametersEqualsPattern(MethodBinding method) { >- TypeBinding[] methodParameters = method.parameters; >- >- int length = methodParameters.length; >- if (length != this.pattern.parameterSimpleNames.length) return false; > >- for (int i = 0; i < length; i++) { >- char[] paramQualifiedName = qualifiedPattern(this.pattern.parameterSimpleNames[i], this.pattern.parameterQualifications[i]); >- if (!CharOperation.match(paramQualifiedName, methodParameters[i].readableName(), this.isCaseSensitive)) { >- return false; >- } >- } >- return true; >-} > public SearchMatch newDeclarationMatch(ASTNode reference, IJavaScriptElement element, Binding elementBinding, int accuracy, int length, MatchLocator locator) { > if (elementBinding != null) { > MethodBinding methodBinding = (MethodBinding) elementBinding; >@@ -615,7 +588,7 @@ > nodeSet.mustResolve = true; > resolve = true; > } >- this.methodDeclarationsWithInvalidParam.put((AbstractMethodDeclaration)inferredMethod.getFunctionDeclaration(), null); >+ this.methodDeclarationsWithInvalidParam.put(inferredMethod.getFunctionDeclaration(), null); > } else { > return IMPOSSIBLE_MATCH; > } >Index: src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodPattern.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodPattern.java,v >retrieving revision 1.7.2.1 >diff -u -r1.7.2.1 MethodPattern.java >--- src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodPattern.java 1 Jul 2011 22:12:21 -0000 1.7.2.1 >+++ src/org/eclipse/wst/jsdt/internal/core/search/matching/MethodPattern.java 19 Jul 2011 19:46:22 -0000 >@@ -12,369 +12,659 @@ > > import java.io.IOException; > >-import org.eclipse.wst.jsdt.core.Flags; >-import org.eclipse.wst.jsdt.core.IFunction; >-import org.eclipse.wst.jsdt.core.IType; >-import org.eclipse.wst.jsdt.core.JavaScriptModelException; > import org.eclipse.wst.jsdt.core.compiler.CharOperation; > import org.eclipse.wst.jsdt.core.search.SearchPattern; >+import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.wst.jsdt.internal.core.Logger; > import org.eclipse.wst.jsdt.internal.core.index.EntryResult; > import org.eclipse.wst.jsdt.internal.core.index.Index; >-import org.eclipse.wst.jsdt.internal.core.util.Util; >- >-public class MethodPattern extends JavaSearchPattern { >- >-protected boolean findDeclarations; >-protected boolean findReferences; >- >-public char[] selector; >- >-public char[] declaringQualification; >-public char[] declaringSimpleName; >- >-public char[] returnQualification; >-public char[] returnSimpleName; >- >-public char[][] parameterQualifications; >-public char[][] parameterSimpleNames; >-public int parameterCount; >-public boolean varargs = false; >- >-protected boolean isFunction; >-// extra reference info >-protected IType declaringType; >- >-// Signatures and arguments for generic search >-char[][] returnTypeSignatures; >-char[][][] returnTypeArguments; >-char[][][] parametersTypeSignatures; >-char[][][][] parametersTypeArguments; >-boolean methodParameters = false; >-char[][] methodArguments; >- >-protected static char[][] REF_CATEGORIES = { METHOD_REF }; >-protected static char[][] REF_AND_DECL_CATEGORIES = { METHOD_REF, METHOD_DECL }; >-protected static char[][] DECL_CATEGORIES = { METHOD_DECL }; >-protected static char[][] FUNCTION_REF_AND_DECL_CATEGORIES = { METHOD_REF, FUNCTION_DECL, METHOD_DECL }; >-protected static char[][] FUNCTION_DECL_CATEGORIES = { FUNCTION_DECL, METHOD_DECL }; >+import org.eclipse.wst.jsdt.internal.core.util.QualificationHelpers; > > /** >- * Method entries are encoded as selector '/' Arity: >- * e.g. 'foo/0' >- */ >-public static char[] createIndexKey(char[] selector, int argCount) { >- char[] countChars = argCount < 10 >- ? COUNTS[argCount] >- : ("/" + String.valueOf(argCount)).toCharArray(); //$NON-NLS-1$ >- return CharOperation.concat(selector, countChars); >-} >- >-MethodPattern(int matchRule, boolean isFunction) { >- super(METHOD_PATTERN, matchRule); >- this.isFunction=isFunction; >-} >-public MethodPattern( >- boolean findDeclarations, >- boolean findReferences, >- boolean isFunction, >- char[] selector, >- char[] declaringQualification, >- char[] declaringSimpleName, >- char[] returnQualification, >- char[] returnSimpleName, >- char[][] parameterQualifications, >- char[][] parameterSimpleNames, >- IType declaringType, >- int matchRule) { >- >- this(matchRule,isFunction); >- >- this.findDeclarations = findDeclarations; >- this.findReferences = findReferences; >- >- this.selector = (isCaseSensitive() || isCamelCase()) ? selector : CharOperation.toLowerCase(selector); >- this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification); >- this.declaringSimpleName = isCaseSensitive() ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName); >- this.returnQualification = isCaseSensitive() ? returnQualification : CharOperation.toLowerCase(returnQualification); >- this.returnSimpleName = isCaseSensitive() ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName); >- if (parameterSimpleNames != null) { >- this.parameterCount = parameterSimpleNames.length; >- this.parameterQualifications = new char[this.parameterCount][]; >- this.parameterSimpleNames = new char[this.parameterCount][]; >- for (int i = 0; i < this.parameterCount; i++) { >- this.parameterQualifications[i] = isCaseSensitive() ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]); >- this.parameterSimpleNames[i] = isCaseSensitive() ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]); >- } >- } else { >- this.parameterCount = -1; >- } >- this.declaringType = declaringType; >- ((InternalSearchPattern)this).mustResolve = mustResolve(); >-} >-/* >- * Instanciate a method pattern with signatures for generics search >+ * <p>Pattern used when adding functions to an index or searching an index for functions.</p> > */ >-public MethodPattern( >- boolean findDeclarations, >- boolean findReferences, >- boolean isFunction, >- char[] selector, >- char[] declaringQualification, >- char[] declaringSimpleName, >- char[] returnQualification, >- char[] returnSimpleName, >- String returnSignature, >- char[][] parameterQualifications, >- char[][] parameterSimpleNames, >- String[] parameterSignatures, >- IFunction method, >- int matchRule) { >- >- this(findDeclarations, >- findReferences, >- isFunction, >- selector, >- declaringQualification, >- declaringSimpleName, >- returnQualification, >- returnSimpleName, >- parameterQualifications, >- parameterSimpleNames, >- method.getDeclaringType(), >- matchRule); >+public class MethodPattern extends JavaSearchPattern { > >- // Set flags >- try { >- this.varargs = (method.getFlags() & Flags.AccVarargs) != 0; >- } catch (JavaScriptModelException e) { >- // do nothing >- } >+ protected static final char[][] REF_CATEGORIES = { METHOD_REF }; >+ protected static final char[][] REF_AND_DECL_CATEGORIES = { METHOD_REF, METHOD_DECL }; >+ protected static final char[][] DECL_CATEGORIES = { METHOD_DECL }; >+ protected static final char[][] FUNCTION_REF_AND_DECL_CATEGORIES = { METHOD_REF, FUNCTION_DECL, METHOD_DECL }; >+ protected static final char[][] FUNCTION_DECL_CATEGORIES = { FUNCTION_DECL, METHOD_DECL }; >+ >+ /** >+ * <p><b>Required</b></p> >+ * >+ * <p>Name of the function</p> >+ */ >+ public char[] selector; >+ >+ /** >+ * <p><b>Required</b></p> >+ * >+ * <p>Number of specified parameters for this function. >+ * Must be equal to or greater then 0.</p> >+ */ >+ public int parameterCount; >+ >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Qualifications of the parameter types for this function.</p> >+ * <p>This should have the same length as {@link #parameterCount}, or >+ * <code>null</code> if {@link #parameterCount} is 0</p> >+ * >+ * <p><b>Note:</b> If this field is defined then the {@link #parameterSimpleNames} must >+ * also be defined.</p> >+ * >+ * @see #parameterSimpleNames >+ */ >+ public char[][] parameterQualifications; >+ >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Simple names of the parameter types for this function.</p> >+ * <p>This should have the same length as {@link #parameterCount}, or >+ * <code>null</code> if {@link #parameterCount} is 0</p> >+ * >+ * <p><b>Note:</b> If this field is defined then the {@link #parameterQualifications} >+ * filed can be defined, but does not have to be.</p> >+ * >+ * @see #parameterQualifications >+ */ >+ public char[][] parameterSimpleNames; >+ >+ /** >+ * <p><b>Required</b> if {@link #parameterCount} is greater then 0</p> >+ * >+ * <p>Names of the defined parameters for this function.</p> >+ * <p>This should have the same length as {@link #parameterCount}, or >+ * <code>null</code> if {@link #parameterCount} is 0</p> >+ */ >+ public char[][] parameterNames; >+ >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Qualification of the return type of this function.</p> >+ * >+ * <p><b>Note:</b> If this field is defined then the {@link #returnSimpleName} must >+ * also be defined.</p> >+ */ >+ public char[] returnQualification; > >- methodParameters = true; >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Simple name of the return type of this function.</p> >+ * >+ * <p><b>Note:</b> If this field is defined then the {@link #returnQualification} >+ * filed can be defined, but does not have to be.</p> >+ */ >+ public char[] returnSimpleName; > >- if (declaringType!=null) { >- // Store type signature and arguments for declaring type >- storeTypeSignaturesAndArguments(declaringType); >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Qualification of the declaring type containing this function.</p> >+ * >+ * <p><b>Note:</b> If this field is defined then the {@link #declaringSimpleName} must >+ * also be defined.</p> >+ * >+ * @see #declaringSimpleName >+ */ >+ public char[] declaringQualification; >+ >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Simple name of the declaring type containing this function.</p> >+ * >+ * <p><b>Note:</b> If this field is defined then the {@link #declaringQualification} >+ * can be defined, but does not have to be.</p> >+ * >+ * @see #declaringQualification >+ */ >+ public char[] declaringSimpleName; >+ >+ /** >+ * <p><b>Optional</b></p> >+ * >+ * <p>Any modifiers for this function.</p> >+ * >+ * @see ClassFileConstants >+ */ >+ public int modifiers; >+ >+ /** >+ * <p>When using this pattern to do a search <code>true</code> to >+ * find function declarations that match this pattern, <code>false</code> otherwise.</p> >+ */ >+ protected boolean findDeclarations; >+ >+ /** >+ * <p>When using this pattern to do a search <code>true</code> to >+ * find function references that match this pattern, <code>false</code> otherwise.</p> >+ */ >+ protected boolean findReferences; >+ >+ /** >+ * <p><code>true</code> if this pattern represents a function, >+ * <code>false</code> otherwise.</p> >+ * >+ * <p><b>NOTE:</b> this whole concept should be removed, a function is a function is a function.</p> >+ */ >+ protected boolean isFunction; >+ >+ /** >+ * <p>Internal constructor for creating plank patterns</p> >+ * >+ * @param matchRule match rule used when comparing this pattern to search results >+ * @param isFunction <code>true</code> if this pattern represents a function, >+ * <code>false</code> otherwise >+ */ >+ MethodPattern(int matchRule, boolean isFunction) { >+ super(METHOD_PATTERN, matchRule); >+ this.isFunction=isFunction; >+ } >+ >+ /** >+ * <p>Useful constructor when creating a pattern to search for index matches >+ * while doing content assist.</p> >+ * >+ * @param findDeclarations when using this pattern to do a search <code>true</code> to >+ * find function declarations that match this pattern, <code>false</code> otherwise. >+ * @param findReferences hen using this pattern to do a search <code>true</code> to >+ * find function references that match this pattern, <code>false</code> otherwise >+ * @param isFunction <code>true</code> if this pattern represents a function, >+ * <code>false</code> otherwise >+ * @param selector pattern for the name of the function >+ * @param selectorMatchRule match rule used when comparing this pattern to search results. >+ * This dictates what type of pattern is present, if any, in the specified <code>selector</code> >+ * >+ * @see SearchPattern >+ */ >+ public MethodPattern(boolean findDeclarations, >+ boolean findReferences, >+ boolean isFunction, >+ char[] selector, >+ int selectorMatchRule) { > >+ this(findDeclarations, findReferences, isFunction, selector, >+ null, null, null, null, null, null, >+ selectorMatchRule); > } >- // Store type signatures and arguments for return type >- if (returnSignature != null) { >- returnTypeSignatures = Util.splitTypeLevelsSignature(returnSignature); >- returnTypeArguments = Util.getAllTypeArguments(returnTypeSignatures); >+ >+ /** >+ * <p>Useful constructor for finding index matches based on content assist pattern.</p> >+ * >+ * @param findDeclarations when using this pattern to do a search <code>true</code> to >+ * find function declarations that match this pattern, <code>false</code> otherwise. >+ * @param findReferences hen using this pattern to do a search <code>true</code> to >+ * find function references that match this pattern, <code>false</code> otherwise >+ * @param selector pattern for the name of the function >+ * @param declaringType optional declaring type that the given selector must be >+ * defined on to be a valid match, or <code>null</code> to specify the function is not >+ * defined on a type >+ * @param selectorMatchRule match rule used when comparing this pattern to search results. >+ * This dictates what type of pattern is present, if any, in the specified <code>selector</code> >+ */ >+ public MethodPattern(boolean findDeclarations, boolean findReferences, >+ char[] selector, char[] declaringType, >+ int selectorMatchRule){ >+ >+ this(selectorMatchRule, true); >+ >+ this.findDeclarations = findDeclarations; >+ this.findReferences = findReferences; >+ this.selector = isCaseSensitive() ? selector : CharOperation.toLowerCase(selector); >+ this.parameterCount = -1; >+ >+ char[][] seperatedDeclaringType = QualificationHelpers.seperateFullyQualifedName(declaringType); >+ this.declaringQualification = isCaseSensitive() ? >+ seperatedDeclaringType[QualificationHelpers.QULIFIERS_INDEX] : CharOperation.toLowerCase(seperatedDeclaringType[QualificationHelpers.QULIFIERS_INDEX]); >+ this.declaringSimpleName = isCaseSensitive() ? >+ seperatedDeclaringType[QualificationHelpers.SIMPLE_NAMES_INDEX] : CharOperation.toLowerCase(seperatedDeclaringType[QualificationHelpers.SIMPLE_NAMES_INDEX]); > } >- >- // Store type signatures and arguments for method parameters type >- if (parameterSignatures != null) { >- int length = parameterSignatures.length; >- if (length > 0) { >- parametersTypeSignatures = new char[length][][]; >- parametersTypeArguments = new char[length][][][]; >- for (int i=0; i<length; i++) { >- parametersTypeSignatures[i] = Util.splitTypeLevelsSignature(parameterSignatures[i]); >- parametersTypeArguments[i] = Util.getAllTypeArguments(parametersTypeSignatures[i]); >+ >+ /** >+ * <p>Constructor to create a pattern that accepts all possible information about a function.</p> >+ * >+ * @param findDeclarations >+ * @param findReferences >+ * @param isFunction >+ * @param selector >+ * @param declaringQualification >+ * @param declaringSimpleName >+ * @param returnQualification >+ * @param returnSimpleName >+ * @param parameterQualifications >+ * @param parameterSimpleNames >+ * @param matchRule >+ */ >+ public MethodPattern( >+ boolean findDeclarations, >+ boolean findReferences, >+ boolean isFunction, >+ char[] selector, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, >+ char[] returnQualification, >+ char[] returnSimpleName, >+ char[] declaringQualification, >+ char[] declaringSimpleName, >+ int matchRule) { >+ >+ this(matchRule,isFunction); >+ >+ this.findDeclarations = findDeclarations; >+ this.findReferences = findReferences; >+ >+ this.selector = (isCaseSensitive() || isCamelCase()) ? selector : CharOperation.toLowerCase(selector); >+ this.declaringQualification = isCaseSensitive() ? declaringQualification : CharOperation.toLowerCase(declaringQualification); >+ this.declaringSimpleName = isCaseSensitive() ? declaringSimpleName : CharOperation.toLowerCase(declaringSimpleName); >+ this.returnQualification = isCaseSensitive() ? returnQualification : CharOperation.toLowerCase(returnQualification); >+ this.returnSimpleName = isCaseSensitive() ? returnSimpleName : CharOperation.toLowerCase(returnSimpleName); >+ if (parameterSimpleNames != null) { >+ this.parameterCount = parameterSimpleNames.length; >+ this.parameterQualifications = new char[this.parameterCount][]; >+ this.parameterSimpleNames = new char[this.parameterCount][]; >+ for (int i = 0; i < this.parameterCount; i++) { >+ this.parameterQualifications[i] = isCaseSensitive() ? parameterQualifications[i] : CharOperation.toLowerCase(parameterQualifications[i]); >+ this.parameterSimpleNames[i] = isCaseSensitive() ? parameterSimpleNames[i] : CharOperation.toLowerCase(parameterSimpleNames[i]); > } >+ } else { >+ this.parameterCount = -1; > } >+ >+ ((InternalSearchPattern)this).mustResolve = false; > } >- >- // Store type signatures and arguments for method >- methodArguments = extractMethodArguments(method); >- if (hasMethodArguments()) ((InternalSearchPattern)this).mustResolve = true; >-} >-/* >- * Instanciate a method pattern with signatures for generics search >- */ >-public MethodPattern( >- boolean findDeclarations, >- boolean findReferences, >- boolean isFunction, >- char[] selector, >- char[] declaringQualification, >- char[] declaringSimpleName, >- String declaringSignature, >- char[] returnQualification, >- char[] returnSimpleName, >- String returnSignature, >- char[][] parameterQualifications, >- char[][] parameterSimpleNames, >- String[] parameterSignatures, >- char[][] arguments, >- int matchRule) { >- >- this(findDeclarations, >- findReferences, >- isFunction, >- selector, >- declaringQualification, >- declaringSimpleName, >- returnQualification, >- returnSimpleName, >- parameterQualifications, >- parameterSimpleNames, >- null, >- matchRule); >- >- // Store type signature and arguments for declaring type >- if (declaringSignature != null) { >- typeSignatures = Util.splitTypeLevelsSignature(declaringSignature); >- setTypeArguments(Util.getAllTypeArguments(typeSignatures)); >+ >+ /** >+ * <p>Given an index key created by this class decodes that key into the >+ * various fields of this pattern.</p> >+ * >+ * @param key to decode into the fields of this pattern >+ * >+ * @see #createIndexKey(char[], int) >+ * @see #createIndexKey(char[], int, char[][], char[][], char[], char[], int) >+ * @see #createSearchIndexKey(char[], char[], char[], int) >+ * @see #createSearchIndexKey(char[], int, char[][], char[][], char[][], char[], char[], char[], char[], int) >+ */ >+ public void decodeIndexKey(char[] key) { >+ char[][] seperated = CharOperation.splitOn(SEPARATOR, key); >+ >+ //get the selector >+ this.selector = seperated[0]; >+ >+ //get the parameter count >+ this.parameterCount = Integer.parseInt(new String(seperated[1])); >+ >+ //get parameter types >+ char[][][] parameterTypes = QualificationHelpers.seperateFullyQualifiedNames(seperated[2], this.parameterCount); >+ this.parameterQualifications = parameterTypes[QualificationHelpers.QULIFIERS_INDEX]; >+ this.parameterSimpleNames = parameterTypes[QualificationHelpers.SIMPLE_NAMES_INDEX]; >+ >+ //get parameter names >+ char[][] parameterNames = CharOperation.splitOn(PARAMETER_SEPARATOR, seperated[3]); >+ if(parameterNames.length > 0) { >+ this.parameterNames = parameterNames; >+ } else { >+ this.parameterNames = null; >+ } >+ >+ //get the return type >+ char[][] returnType = QualificationHelpers.seperateFullyQualifedName(seperated[4]); >+ this.returnQualification = returnType[QualificationHelpers.QULIFIERS_INDEX]; >+ this.returnSimpleName = returnType[QualificationHelpers.SIMPLE_NAMES_INDEX]; >+ >+ //get the declaration type >+ char[][] declaringType = QualificationHelpers.seperateFullyQualifedName(seperated[5]); >+ this.declaringQualification = declaringType[QualificationHelpers.QULIFIERS_INDEX]; >+ this.declaringSimpleName = declaringType[QualificationHelpers.SIMPLE_NAMES_INDEX]; >+ >+ //get the modifiers >+ this.modifiers = seperated[6][0] + seperated[6][1]; > } >- >- // Store type signatures and arguments for return type >- if (returnSignature != null) { >- returnTypeSignatures = Util.splitTypeLevelsSignature(returnSignature); >- returnTypeArguments = Util.getAllTypeArguments(returnTypeSignatures); >+ >+ public SearchPattern getBlankPattern() { >+ return new MethodPattern(R_EXACT_MATCH | R_CASE_SENSITIVE,isFunction); >+ } >+ public char[][] getIndexCategories() { >+ if (this.findReferences) >+ return this.findDeclarations ? >+ (isFunction ? FUNCTION_REF_AND_DECL_CATEGORIES : REF_AND_DECL_CATEGORIES) >+ : REF_CATEGORIES; >+ if (this.findDeclarations) >+ return isFunction ? FUNCTION_DECL_CATEGORIES : DECL_CATEGORIES; >+ return CharOperation.NO_CHAR_CHAR; > } > >- // Store type signatures and arguments for method parameters type >- if (parameterSignatures != null) { >- int length = parameterSignatures.length; >- if (length > 0) { >- parametersTypeSignatures = new char[length][][]; >- parametersTypeArguments = new char[length][][][]; >- for (int i=0; i<length; i++) { >- parametersTypeSignatures[i] = Util.splitTypeLevelsSignature(parameterSignatures[i]); >- parametersTypeArguments[i] = Util.getAllTypeArguments(parametersTypeSignatures[i]); >+ boolean hasMethodParameters() { >+ return this.parameterCount > 0; >+ } >+ boolean isPolymorphicSearch() { >+ return this.findReferences; >+ } >+ >+ /** >+ * @see org.eclipse.wst.jsdt.core.search.SearchPattern#matchesDecodedKey(org.eclipse.wst.jsdt.core.search.SearchPattern) >+ */ >+ public boolean matchesDecodedKey(SearchPattern decodedPattern) { >+ boolean matches = false; >+ if(decodedPattern instanceof MethodPattern) { >+ MethodPattern pattern = (MethodPattern) decodedPattern; >+ >+ matches = matchesName(this.selector, pattern.selector) >+ && (this.parameterCount == pattern.parameterCount || this.parameterCount == -1) >+ && matchesName(this.returnQualification, pattern.returnQualification) >+ && matchesName(this.returnSimpleName, pattern.returnSimpleName) >+ && matchesName(this.declaringQualification, pattern.declaringQualification) >+ && matchesName(this.declaringSimpleName, pattern.declaringSimpleName); >+ >+ if(matches) { >+ for(int i = 0; i < this.parameterCount && matches; ++i) { >+ matches = matches >+ && matchesName(this.parameterQualifications[i], pattern.parameterQualifications[i]) >+ && matchesName(this.parameterSimpleNames[i], pattern.parameterSimpleNames[i]); >+ } > } > } >+ >+ return matches; > } >- >- // Store type signatures and arguments for method >- methodArguments = arguments; >- if (hasMethodArguments()) ((InternalSearchPattern)this).mustResolve = true; >-} >-public void decodeIndexKey(char[] key) { >- int last = key.length - 1; >- this.parameterCount = 0; >- this.selector = null; >- int power = 1; >- for (int i=last; i>=0; i--) { >- if (key[i] == SEPARATOR) { >- System.arraycopy(key, 0, this.selector = new char[i], 0, i); >- break; >+ >+ /** >+ * @see org.eclipse.wst.jsdt.internal.core.search.matching.InternalSearchPattern#queryIn(org.eclipse.wst.jsdt.internal.core.index.Index) >+ */ >+ EntryResult[] queryIn(Index index) throws IOException { >+ char[] key = this.selector; // can be null >+ int matchRule = getMatchRule(); >+ >+ int matchRuleToUse = matchRule; >+ switch(getMatchMode()) { >+ case R_EXACT_MATCH : >+ key = createSearchIndexKey(this.selector, this.parameterCount, >+ this.parameterQualifications, this.parameterSimpleNames, >+ this.parameterNames, this.returnQualification, this.returnSimpleName, >+ this.declaringQualification, this.declaringSimpleName, this.modifiers); >+ break; >+ case R_PREFIX_MATCH : >+ char[] selector = CharOperation.concat(this.selector, ONE_STAR); >+ >+ key = createSearchIndexKey(selector, >+ this.declaringQualification, this.declaringSimpleName, >+ this.modifiers); >+ >+ //the prefix match refers to the selector, but to do the actual match need to use a pattern >+ matchRuleToUse = R_PATTERN_MATCH; >+ break; >+ case R_PATTERN_MATCH : >+ key = createSearchIndexKey(this.selector, >+ this.declaringQualification, this.declaringSimpleName, >+ this.modifiers); >+ break; >+ case R_REGEXP_MATCH : >+ // TODO implement regular expression match >+ Logger.log(Logger.WARNING, "Regular expression matching is not yet implimented for MethodPattern"); >+ break; > } >- if (i == last) { >- this.parameterCount = key[i] - '0'; >+ >+ return index.query(getIndexCategories(), key, matchRuleToUse); // match rule is irrelevant when the key is null >+ } >+ >+ /** >+ * @see org.eclipse.wst.jsdt.internal.core.search.matching.JavaSearchPattern#print(java.lang.StringBuffer) >+ */ >+ protected StringBuffer print(StringBuffer output) { >+ if (this.findDeclarations) { >+ output.append(this.findReferences >+ ? "MethodCombinedPattern: " //$NON-NLS-1$ >+ : "MethodDeclarationPattern: "); //$NON-NLS-1$ >+ } else { >+ output.append("MethodReferencePattern: "); //$NON-NLS-1$ >+ } >+ if (declaringQualification != null) >+ output.append(declaringQualification).append('.'); >+ if (declaringSimpleName != null) >+ output.append(declaringSimpleName).append('.'); >+ else if (declaringQualification != null) >+ output.append("*."); //$NON-NLS-1$ >+ >+ if (selector != null) >+ output.append(selector); >+ else >+ output.append("*"); //$NON-NLS-1$ >+ output.append('('); >+ if (parameterSimpleNames == null) { >+ output.append("..."); //$NON-NLS-1$ > } else { >- power *= 10; >- this.parameterCount += power * (key[i] - '0'); >+ for (int i = 0, max = parameterSimpleNames.length; i < max; i++) { >+ if (i > 0) output.append(", "); //$NON-NLS-1$ >+ if (parameterQualifications[i] != null) output.append(parameterQualifications[i]).append('.'); >+ if (parameterSimpleNames[i] == null) output.append('*'); else output.append(parameterSimpleNames[i]); >+ } > } >+ output.append(')'); >+ if (returnQualification != null) >+ output.append(" --> ").append(returnQualification).append('.'); //$NON-NLS-1$ >+ else if (returnSimpleName != null) >+ output.append(" --> "); //$NON-NLS-1$ >+ if (returnSimpleName != null) >+ output.append(returnSimpleName); >+ else if (returnQualification != null) >+ output.append("*"); //$NON-NLS-1$ >+ return super.print(output); > } >-} >-public SearchPattern getBlankPattern() { >- return new MethodPattern(R_EXACT_MATCH | R_CASE_SENSITIVE,isFunction); >-} >-public char[][] getIndexCategories() { >- if (this.findReferences) >- return this.findDeclarations ? >- (isFunction ? FUNCTION_REF_AND_DECL_CATEGORIES : REF_AND_DECL_CATEGORIES) >- : REF_CATEGORIES; >- if (this.findDeclarations) >- return isFunction ? FUNCTION_DECL_CATEGORIES : DECL_CATEGORIES; >- return CharOperation.NO_CHAR_CHAR; >-} >-boolean hasMethodArguments() { >- return methodArguments != null && methodArguments.length > 0; >-} >-boolean hasMethodParameters() { >- return methodParameters; >-} >-boolean isPolymorphicSearch() { >- return this.findReferences; >-} >-public boolean matchesDecodedKey(SearchPattern decodedPattern) { >- MethodPattern pattern = (MethodPattern) decodedPattern; >- >- return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || this.varargs) >- && matchesName(this.selector, pattern.selector); >-} >-/** >- * Returns whether a method declaration or message send must be resolved to >- * find out if this method pattern matches it. >- */ >-protected boolean mustResolve() { >- // declaring type >- // If declaring type is specified - even with simple name - always resolves >- if (declaringSimpleName != null || declaringQualification != null) return true; >- >- // return type >- // If return type is specified - even with simple name - always resolves >- if (returnSimpleName != null || returnQualification != null) return true; >- >- // parameter types >- if (parameterSimpleNames != null) >- for (int i = 0, max = parameterSimpleNames.length; i < max; i++) >- if (parameterQualifications[i] != null) return true; >- return false; >-} >-EntryResult[] queryIn(Index index) throws IOException { >- char[] key = this.selector; // can be null >- int matchRule = getMatchRule(); >- >- switch(getMatchMode()) { >- case R_EXACT_MATCH : >- if (this.isCamelCase) break; >- if (this.selector != null && this.parameterCount >= 0 && !this.varargs) >- key = createIndexKey(this.selector, this.parameterCount); >- else { // do a prefix query with the selector >- matchRule &= ~R_EXACT_MATCH; >- matchRule |= R_PREFIX_MATCH; >- } >- break; >- case R_PREFIX_MATCH : >- // do a prefix query with the selector >- break; >- case R_PATTERN_MATCH : >- if (this.parameterCount >= 0 && !this.varargs) >- key = createIndexKey(this.selector == null ? ONE_STAR : this.selector, this.parameterCount); >- else if (this.selector != null && this.selector[this.selector.length - 1] != '*') >- key = CharOperation.concat(this.selector, ONE_STAR, SEPARATOR); >- // else do a pattern query with just the selector >- break; >- case R_REGEXP_MATCH : >- // TODO (frederic) implement regular expression match >- break; >+ >+ /** >+ * <p>Create an index key from a selector and a parameter count.</p> >+ * >+ * <p><b>Note</b> Currently used to index function references, but the >+ * validity of this use is questionable.</p> >+ * >+ * @param selector >+ * @param parameterCount >+ * >+ * @return a function index key created from a selector and a parameter count >+ */ >+ public static char[] createIndexKey(char[] selector, int parameterCount) { >+ return createIndexKey(selector, parameterCount, null, null, null, null, 0); > } >- >- return index.query(getIndexCategories(), key, matchRule); // match rule is irrelevant when the key is null >-} >-protected StringBuffer print(StringBuffer output) { >- if (this.findDeclarations) { >- output.append(this.findReferences >- ? "MethodCombinedPattern: " //$NON-NLS-1$ >- : "MethodDeclarationPattern: "); //$NON-NLS-1$ >- } else { >- output.append("MethodReferencePattern: "); //$NON-NLS-1$ >- } >- if (declaringQualification != null) >- output.append(declaringQualification).append('.'); >- if (declaringSimpleName != null) >- output.append(declaringSimpleName).append('.'); >- else if (declaringQualification != null) >- output.append("*."); //$NON-NLS-1$ >- >- if (selector != null) >- output.append(selector); >- else >- output.append("*"); //$NON-NLS-1$ >- output.append('('); >- if (parameterSimpleNames == null) { >- output.append("..."); //$NON-NLS-1$ >- } else { >- for (int i = 0, max = parameterSimpleNames.length; i < max; i++) { >- if (i > 0) output.append(", "); //$NON-NLS-1$ >- if (parameterQualifications[i] != null) output.append(parameterQualifications[i]).append('.'); >- if (parameterSimpleNames[i] == null) output.append('*'); else output.append(parameterSimpleNames[i]); >+ >+ /** >+ * <p>Creates an index key based on the given function definition information.</p> >+ * >+ * <p><b>Key Syntax</b>: >+ * <code>selector/parameterCount/parameterFullTypeNames/paramaterNames/returnFulLTypeName/declaringFullTypeName</code></p> >+ * >+ * <p> >+ * <b>Examples:</b><ul> >+ * <li><code>myFunction/0////</code> - function with no parameters and no return type</li> >+ * <li><code>myFunction/0///String/</code> - function with no parameters with a return type</li> >+ * <li><code>myFunction/0////foo.bar.Type</code> - function on a type with no parameters and no return type</li> >+ * <li><code>myFunction/0///String/foo.bar.Type</code> - function on a type with no parameters with a return type </li> >+ * <li><code>myFunction/2//param1,param2//</code> - function with no parameter types, with parameter names with no return type</li> >+ * <li><code>myFunction/2//param1,param2/String/</code> - function with no parameter types, with parameter names with a return type</li> >+ * <li><code>myFunction/2//param1,param2//foo.bar.Type</code> - function on a type with no parameter types, with parameter names with no return type</li> >+ * <li><code>myFunction/2//param1,param2/String/foo.bar.Type</code> - function on a type with no parameter types, with parameter names with a return type</li> >+ * <li><code>myFunction/2/String,Number/param1,param2//</code> - function with parameter types and names with no return type</li> >+ * <li><code>myFunction/2/String,Number/param1,param2/String/</code> - function with parameter types and names with a return type</li> >+ * <li><code>myFunction/2/String,Number/param1,param2//foo.bar.Type</code> - function on a type with parameter types and names with no return type</li> >+ * <li><code>myFunction/2/String,Number/param1,param2/String/foo.bar.Type</code> - function on a type with parameter types and names with a return type</li> >+ * <li><code>myFunction/2/,Number/param1,param2//</code> - function where only one of the parameters has a type</li> >+ * <li><code>myFunction/2/,Number/param1,param2/String/</code> - function where only one of the parameters has a type with a return type</li> >+ * <li><code>myFunction/2/,Number/param1,param2//foo.bar.Type</code> - function on a type where only one of the parameters has a type</li> >+ * <li><code>myFunction/2/,Number/param1,param2/String/foo.bar.Type</code> - function on a type where only one of the parameters has a type with a return type</li> >+ * </ul></p> >+ * >+ * @param selector >+ * @param parameterCount >+ * @param declaringFullTypeName >+ * @param returnFullTypeName >+ * @param parameterFullTypeNames >+ * @param parameterNames >+ * @param modifiers >+ * >+ * @see #decodeIndexKey(char[]) >+ * >+ * @return a key that can be put in an index or used to search an index for functions >+ */ >+ public static char[] createIndexKey(char[] selector, int parameterCount, >+ char[][] parameterFullTypeNames, >+ char[][] parameterNames, >+ char[] declaringFullTypeName, >+ char[] returnFullTypeName, >+ int modifiers) { >+ >+ char[] indexKey = null; >+ >+ if(selector != null && selector.length > 0) { >+ char[] paramaterCountChars = null; >+ char[] parameterTypesChars = CharOperation.NO_CHAR; >+ char[] parameterNamesChars = CharOperation.NO_CHAR; >+ >+ >+ //get param types >+ if (parameterFullTypeNames != null) { >+ parameterTypesChars = CharOperation.concatWith(parameterFullTypeNames, PARAMETER_SEPARATOR, false); >+ } >+ >+ //get param names >+ if (parameterNames != null) { >+ parameterNamesChars = CharOperation.concatWith(parameterNames, PARAMETER_SEPARATOR); >+ } >+ >+ //use pre-made char array for arg counts less then 10, else build a new one >+ if(parameterCount >= 0) { >+ paramaterCountChars = parameterCount < 10 ? >+ COUNTS[parameterCount] : (SEPARATOR + String.valueOf(parameterCount)).toCharArray(); >+ } else { >+ paramaterCountChars = CharOperation.concat(new char[] {SEPARATOR}, ONE_STAR); >+ } >+ >+ >+ //get lengths >+ int parameterTypesLength = (parameterTypesChars == null ? 0 : parameterTypesChars.length); >+ int parameterNamesLength = (parameterNamesChars == null ? 0 : parameterNamesChars.length); >+ int returnTypeLength = (returnFullTypeName == null ? 0 : returnFullTypeName.length); >+ int delaringTypeLength = declaringFullTypeName == null ? 0 : declaringFullTypeName.length; >+ >+ int resultLength = selector.length + paramaterCountChars.length >+ + 1 + parameterTypesLength >+ + 1 + parameterNamesLength >+ + 1 + returnTypeLength >+ + 1 + delaringTypeLength >+ + 3; //modifiers >+ >+ //create result char array >+ indexKey = new char[resultLength]; >+ >+ //add type name to result >+ int pos = 0; >+ System.arraycopy(selector, 0, indexKey, pos, selector.length); >+ pos += selector.length; >+ >+ //add param count to result >+ if (paramaterCountChars.length > 0) { >+ System.arraycopy(paramaterCountChars, 0, indexKey, pos, paramaterCountChars.length); >+ pos += paramaterCountChars.length; >+ } >+ >+ //add param types >+ indexKey[pos++] = SEPARATOR; >+ if (parameterTypesLength > 0) { >+ System.arraycopy(parameterTypesChars, 0, indexKey, pos, parameterTypesLength); >+ pos += parameterTypesLength; >+ } >+ >+ //add param names >+ indexKey[pos++] = SEPARATOR; >+ if (parameterNamesLength > 0) { >+ System.arraycopy(parameterNamesChars, 0, indexKey, pos, parameterNamesLength); >+ pos += parameterNamesLength; >+ } >+ >+ //add return type >+ indexKey[pos++] = SEPARATOR; >+ if(returnTypeLength > 0) { >+ System.arraycopy(returnFullTypeName, 0, indexKey, pos, returnTypeLength); >+ pos += returnTypeLength; >+ } >+ >+ //add declaring type >+ indexKey[pos++] = SEPARATOR; >+ if(delaringTypeLength > 0) { >+ System.arraycopy(declaringFullTypeName, 0, indexKey, pos, delaringTypeLength); >+ pos += delaringTypeLength; >+ } >+ >+ //add modifiers >+ indexKey[pos++] = SEPARATOR; >+ indexKey[pos++] = (char) modifiers; >+ indexKey[pos++] = (char) (modifiers>>16); > } >+ >+ return indexKey; >+ } >+ >+ /** >+ * <p>Create an index key for search the index for any function that matches the given selector >+ * pattern, on the optionally defined declaring type, with the given modifiers.</p> >+ * >+ * @param selectorPattern >+ * @param declarationType >+ * @param modifiers >+ * >+ * @return >+ */ >+ private static char[] createSearchIndexKey(char[] selectorPattern, >+ char[] declaringQualification, char[] declaringSimpleName, int modifiers) { >+ >+ char[] declaringFullTypeName = null; >+ if(declaringSimpleName != null) { >+ declaringFullTypeName = QualificationHelpers.createFullyQualifiedName(declaringQualification, declaringSimpleName); >+ } >+ >+ return createIndexKey(selectorPattern, -1, >+ ONE_STAR_CHAR, >+ ONE_STAR_CHAR, >+ declaringFullTypeName, >+ ONE_STAR, >+ modifiers); >+ } >+ >+ /** >+ * <p>Used to create an index key to search for a specific function.</p> >+ * >+ * @param selector >+ * @param parameterCount >+ * @param parameterQualifications >+ * @param parameterSimpleNames >+ * @param parameterNames >+ * @param returnQualification >+ * @param returnSimpleName >+ * @param declaringQualification >+ * @param declaringSimpleName >+ * @param modifiers >+ * @return >+ */ >+ private static char[] createSearchIndexKey(char[] selector, int parameterCount, >+ char[][] parameterQualifications, >+ char[][] parameterSimpleNames, >+ char[][] parameterNames, >+ char[] returnQualification, >+ char[] returnSimpleName, >+ char[] declaringQualification, >+ char[] declaringSimpleName, >+ int modifiers) { >+ >+ //create fully qualified type names >+ char[] declaringFullTypeName = QualificationHelpers.createFullyQualifiedName(declaringQualification, declaringSimpleName); >+ char[] returnFullTypeName = QualificationHelpers.createFullyQualifiedName(returnQualification, returnSimpleName); >+ char[][] parameterFullTypeNames = QualificationHelpers.createFullyQualifiedNames(parameterQualifications, parameterSimpleNames); >+ >+ return createIndexKey(selector, parameterCount, parameterFullTypeNames, >+ parameterNames, declaringFullTypeName, returnFullTypeName, modifiers); > } >- output.append(')'); >- if (returnQualification != null) >- output.append(" --> ").append(returnQualification).append('.'); //$NON-NLS-1$ >- else if (returnSimpleName != null) >- output.append(" --> "); //$NON-NLS-1$ >- if (returnSimpleName != null) >- output.append(returnSimpleName); >- else if (returnQualification != null) >- output.append("*"); //$NON-NLS-1$ >- return super.print(output); >-} > } >Index: src/org/eclipse/wst/jsdt/internal/core/util/QualificationHelpers.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/internal/core/util/QualificationHelpers.java >diff -N src/org/eclipse/wst/jsdt/internal/core/util/QualificationHelpers.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/jsdt/internal/core/util/QualificationHelpers.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,230 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.jsdt.internal.core.util; >+ >+import org.eclipse.wst.jsdt.core.Signature; >+import org.eclipse.wst.jsdt.core.compiler.CharOperation; >+import org.eclipse.wst.jsdt.internal.core.search.indexing.IIndexConstants; >+ >+/** >+ * <p>Methods for helping with qualified type names, both to separate them into >+ * qualifier and simple name, as well as recombining qualifier with simple name.</p> >+ */ >+public class QualificationHelpers { >+ >+ /** >+ * <p>The index in the array containing the qualifier of a fully qualified name >+ * separated by a method in this class.</p> >+ * >+ * @see #seperateFullyQualifedName(char[]) >+ * @see #seperateFullyQualifedTypeNames(char[]) >+ */ >+ public static final int QULIFIERS_INDEX = 0; >+ >+ /** >+ * <p>The index in the array containing the simple name of a fully qualified name >+ * separated by a method in this class.</p> >+ * >+ * @see #seperateFullyQualifedName(char[]) >+ * @see #seperateFullyQualifedTypeNames(char[]) >+ */ >+ public static final int SIMPLE_NAMES_INDEX = 1; >+ >+ /** >+ * <p>Given a qualification and a simple name creates a fully qualified name.</p> >+ * >+ * @param qualification the qualification, or <code>null</code> if no qualification >+ * @param simpleName the simple name, can not be <code>null</code> >+ * >+ * @return fully qualified name created from the given <code>simpleName</code> and >+ * the optional <code>qualification</code> >+ */ >+ public static char[] createFullyQualifiedName(char[] qualification, char[] simpleName) { >+ char[] fullTypeName = null; >+ if(simpleName != null && simpleName.length > 0) { >+ if(qualification != null && qualification.length > 0) { >+ fullTypeName = CharOperation.concat(qualification, simpleName, IIndexConstants.DOT); >+ } else { >+ fullTypeName = simpleName; >+ } >+ } >+ >+ return fullTypeName; >+ } >+ >+ /** >+ * <p>Given a list of qualifications and a list of simple names creates a single list of >+ * fully qualified names created by matching one qualification and one simple name from >+ * their respective lists in order.</p> >+ * >+ * @param qualifications to match with the given <code>simpleNames</code>, this can be >+ * <code>null</code> if there are not qualifications, or an array of the same size as >+ * <code>simpleNames</code> where any one of the indices maybe <code>null</code> to signify >+ * there is no qualifier for that specific simple name. >+ * @param simpleNames to match with the given <code>qualifications</code>, this array >+ * can <b>not</b> be <code>null</code> and no indices in the array can be <code>null</code> either >+ * >+ * @return an array of fully qualified names created from the given <code>simpleNames</code> >+ * and the optional <code>qualifications</code> >+ */ >+ public static char[][] createFullyQualifiedNames(char[][] qualifications, char[][] simpleNames) { >+ char[][] fullTypeNames = null; >+ >+ if(simpleNames != null) { >+ fullTypeNames = new char[simpleNames.length][]; >+ for(int i = 0; i < fullTypeNames.length; ++i) { >+ if(qualifications != null && qualifications.length > i) { >+ fullTypeNames[i] = createFullyQualifiedName(qualifications[i], simpleNames[i]); >+ } else { >+ fullTypeNames[i] = simpleNames[i]; >+ } >+ } >+ } >+ >+ return fullTypeNames; >+ } >+ >+ /** >+ * <p>Separates a fully qualified name into its qualifier and its simple name</p> >+ * >+ * @param fullyQualifiedName fully qualified type name to separate into its qualifier and simple name >+ * >+ * @return a multidimensional array with one dimension for the qualifier and one for the simple name >+ * >+ * @see #QULIFIERS_INDEX >+ * @see #SIMPLE_NAMES_INDEX >+ */ >+ public static char[][] seperateFullyQualifedName(char[] fullyQualifiedName) { >+ char[][] seperatedTypeName = new char[2][]; >+ >+ if(fullyQualifiedName != null && fullyQualifiedName.length > 0) { >+ int lastIndexOfDot = CharOperation.lastIndexOf(IIndexConstants.DOT, fullyQualifiedName); >+ if(lastIndexOfDot != -1) { >+ seperatedTypeName[QULIFIERS_INDEX] = CharOperation.subarray(fullyQualifiedName, 0, lastIndexOfDot); >+ seperatedTypeName[SIMPLE_NAMES_INDEX] = CharOperation.subarray(fullyQualifiedName, lastIndexOfDot+1, -1); >+ } else { >+ seperatedTypeName[QULIFIERS_INDEX] = null; >+ seperatedTypeName[SIMPLE_NAMES_INDEX] = fullyQualifiedName; >+ } >+ } >+ >+ return seperatedTypeName; >+ } >+ >+ /** >+ * <p>Separates an array of fully qualified names into their qualifiers and their simple names</p> >+ * >+ * @param fullyQualifiedNames fully qualified type names to separate into their qualifiers and their simple names >+ * @param minLength the minimum length of the result, padding will be with <code>null</code> >+ * >+ * @return resulting array consists of three indices. The first is either {@link #QULIFIERS_INDEX} or >+ * {@link #SIMPLE_NAMES_INDEX}, the second is then a list of either the qualifiers or the simple names, >+ * depending on the first index, the last index is the char[] "string" qualifier or simple name. >+ * >+ * @see #QULIFIERS_INDEX >+ * @see #SIMPLE_NAMES_INDEX >+ */ >+ public static char[][][] seperateFullyQualifiednames(String[] fullyQualifiedNames, int minLength) { >+ return seperateFullyQualifiedNames(stringArrayToCharArray(fullyQualifiedNames), minLength); >+ } >+ >+ /** >+ * <p>Separates a list of fully qualified names separated by {@link IIndexConstants#PARAMETER_SEPARATOR} >+ * into their qualifiers and their simple names</p> >+ * >+ * @param fullyQualifiedNames a list of fully qualified type names separated by {@link IIndexConstants#PARAMETER_SEPARATOR} >+ * to separate into their qualifiers and their simple names >+ * @param minLength the minimum length of the result, padding will be with <code>null</code> >+ * >+ * @return resulting array consists of three indices. The first is either {@link #QULIFIERS_INDEX} or >+ * {@link #SIMPLE_NAMES_INDEX}, the second is then a list of either the qualifiers or the simple names, >+ * depending on the first index, the last index is the char[] "string" qualifier or simple name. >+ * >+ * @see #QULIFIERS_INDEX >+ * @see #SIMPLE_NAMES_INDEX >+ */ >+ public static char[][][] seperateFullyQualifiedNames(char[] fullyQualifiedNames, int minLength) { >+ char[][] names = CharOperation.splitOn(IIndexConstants.PARAMETER_SEPARATOR, fullyQualifiedNames); >+ return seperateFullyQualifiedNames(names, minLength); >+ } >+ >+ /** >+ * <p>Separates an array of fully qualified names into their qualifiers and their simple names</p> >+ * >+ * @param fullyQualifiedNames fully qualified type names to separate into their qualifiers and their simple names >+ * @param minLength the minimum length of the result, padding will be with <code>null</code> >+ * >+ * @return resulting array consists of three indices. The first is either {@link #QULIFIERS_INDEX} or >+ * {@link #SIMPLE_NAMES_INDEX}, the second is then a list of either the qualifiers or the simple names, >+ * depending on the first index, the last index is the char[] "string" qualifier or simple name. >+ * >+ * @see #QULIFIERS_INDEX >+ * @see #SIMPLE_NAMES_INDEX >+ */ >+ public static char[][][] seperateFullyQualifiedNames(char[][] fullyQualifiedNames, int minLength) { >+ /* >+ * First index is 0 or 1 for the list of qualifiers qualifier and then the list of simple names respectively >+ * Second index is a list of the qualifiers and simple names >+ * Third index is the actual 'string' qualifier or simple name >+ */ >+ char[][][] seperatedTypeNames = new char[2][][]; >+ >+ if(fullyQualifiedNames.length > 0) { >+ int length = minLength > fullyQualifiedNames.length ? minLength : fullyQualifiedNames.length; >+ seperatedTypeNames[QULIFIERS_INDEX] = new char[length][]; >+ seperatedTypeNames[SIMPLE_NAMES_INDEX] = new char[length][]; >+ >+ for(int i = 0; i < fullyQualifiedNames.length; ++i) { >+ char[][] seperatedTypeName = seperateFullyQualifedName(fullyQualifiedNames[i]); >+ seperatedTypeNames[QULIFIERS_INDEX][i] = seperatedTypeName[QULIFIERS_INDEX]; >+ seperatedTypeNames[SIMPLE_NAMES_INDEX][i] = seperatedTypeName[SIMPLE_NAMES_INDEX]; >+ >+ //in case the qualifier is a signature, nothing happens if it is not >+ if(seperatedTypeNames[QULIFIERS_INDEX][i] != null) { >+ seperatedTypeNames[QULIFIERS_INDEX][i] = Signature.toCharArray(seperatedTypeNames[QULIFIERS_INDEX][i]); >+ } >+ >+ //in case the simple name is a signature, nothing happens if it is not >+ if(seperatedTypeNames[SIMPLE_NAMES_INDEX][i] != null) { >+ seperatedTypeNames[SIMPLE_NAMES_INDEX][i] = Signature.toCharArray(seperatedTypeNames[SIMPLE_NAMES_INDEX][i]); >+ } >+ } >+ >+ } else if (minLength > 0) { >+ seperatedTypeNames[QULIFIERS_INDEX] = new char[minLength][]; >+ seperatedTypeNames[SIMPLE_NAMES_INDEX] = new char[minLength][]; >+ } else { >+ seperatedTypeNames[QULIFIERS_INDEX] = null; >+ seperatedTypeNames[SIMPLE_NAMES_INDEX] = null; >+ } >+ >+ return seperatedTypeNames; >+ } >+ >+ /** >+ * <p>Transform a {@link String} array into a <code>char</code> array.</p> >+ * >+ * @param array of {@link String}s to transform into an array of <code>char</code>s >+ * >+ * @return array of {@link String}s built from the given array of <code>char</code>s >+ */ >+ public static char[][] stringArrayToCharArray(String[] array) { >+ char[][] results = null; >+ if(array != null) { >+ results = new char[array.length][]; >+ for(int i = 0; i < array.length; ++i) { >+ results[i] = array[i].toCharArray(); >+ } >+ } >+ >+ return results; >+ } >+} >#P org.eclipse.wst.jsdt.core.tests.compiler >Index: src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java,v >retrieving revision 1.8.2.1 >diff -u -r1.8.2.1 JSDTCompilerTests.java >--- src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java 2 Jul 2010 20:34:13 -0000 1.8.2.1 >+++ src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java 19 Jul 2011 19:46:23 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.wst.jsdt.core.tests.compiler.regression.UtilTest; > import org.eclipse.wst.jsdt.core.tests.compiler.util.ExclusionTests; > import org.eclipse.wst.jsdt.core.tests.interpret.BasicInterpretTest; >+import org.eclipse.wst.jsdt.core.tests.search.SearchTests; > > /** > * Run all compiler regression tests >@@ -61,90 +62,16 @@ > // interpret tests > standardTests.add(BasicInterpretTest.class); > >- >- >- >-// standardTests.addAll(JavadocTest.allTestClasses); > >-// standardTests.add(BasicErrorTests.class); >- >- // // add all javadoc tests >-// for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) { >-// standardTests.add(JavadocTest.ALL_CLASSES.get(i)); >-// } >-// > TestSuite all = new TestSuite("JSDT 'Compiler' Tests"); > all.addTest(ExclusionTests.suite()); > >- >-// int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); >-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { >-// ArrayList tests_1_3 = (ArrayList)standardTests.clone(); >-// tests_1_3.add(Compliance_1_3.class); >-// tests_1_3.add(JavadocTest_1_3.class); >-// // Reset forgotten subsets tests >-// TestCase.TESTS_PREFIX = null; >-// TestCase.TESTS_NAMES = null; >-// TestCase.TESTS_NUMBERS= null; >-// TestCase.TESTS_RANGE = null; >-// TestCase.RUN_ONLY_ID = null; >-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_3, tests_1_3)); >-// } >-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { >-// ArrayList tests_1_4 = (ArrayList)standardTests.clone(); >-// tests_1_4.add(AssertionTest.class); >-// tests_1_4.add(Compliance_1_4.class); >-// tests_1_4.add(ClassFileReaderTest_1_4.class); >-// tests_1_4.add(JavadocTest_1_4.class); >-// // Reset forgotten subsets tests >-// TestCase.TESTS_PREFIX = null; >-// TestCase.TESTS_NAMES = null; >-// TestCase.TESTS_NUMBERS= null; >-// TestCase.TESTS_RANGE = null; >-// TestCase.RUN_ONLY_ID = null; >-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_4, tests_1_4)); >-// } >-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { >-// ArrayList tests_1_5 = (ArrayList)standardTests.clone(); >-// tests_1_5.addAll(RunComparableTests.ALL_CLASSES); >-// tests_1_5.add(AssertionTest.class); >-// tests_1_5.add(ClassFileReaderTest_1_5.class); >-// tests_1_5.add(GenericTypeSignatureTest.class); >-// tests_1_5.add(InternalHexFloatTest.class); >-// tests_1_5.add(JavadocTest_1_5.class); >-// tests_1_5.add(BatchCompilerTest.class); >-// tests_1_5.add(ExternalizeStringLiterals15Test.class); >-// // Reset forgotten subsets tests >-// TestCase.TESTS_PREFIX = null; >-// TestCase.TESTS_NAMES = null; >-// TestCase.TESTS_NUMBERS= null; >-// TestCase.TESTS_RANGE = null; >-// TestCase.RUN_ONLY_ID = null; >-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_5, tests_1_5)); >-// } >-// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { >-// ArrayList tests_1_6 = (ArrayList)standardTests.clone(); >-// tests_1_6.addAll(RunComparableTests.ALL_CLASSES); >-// tests_1_6.add(AssertionTest.class); >-// tests_1_6.add(ClassFileReaderTest_1_5.class); >-// tests_1_6.add(GenericTypeSignatureTest.class); >-// tests_1_6.add(InternalHexFloatTest.class); >-// tests_1_6.add(JavadocTest_1_5.class); >-// tests_1_6.add(BatchCompilerTest.class); >-// tests_1_6.add(ExternalizeStringLiterals15Test.class); >-// tests_1_6.add(StackMapAttributeTest.class); >-// // Reset forgotten subsets tests >-// TestCase.TESTS_PREFIX = null; >-// TestCase.TESTS_NAMES = null; >-// TestCase.TESTS_NUMBERS= null; >-// TestCase.TESTS_RANGE = null; >-// TestCase.RUN_ONLY_ID = null; >-// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_6, tests_1_6)); >-// } > for (Iterator iter = standardTests.iterator(); iter.hasNext();) { > Class test = (Class) iter.next(); > all.addTestSuite(test); > } >+ >+ all.addTest(SearchTests.suite()); > return all; > } > } >Index: src/org/eclipse/wst/jsdt/core/tests/search/SearchTests.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/core/tests/search/SearchTests.java >diff -N src/org/eclipse/wst/jsdt/core/tests/search/SearchTests.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/jsdt/core/tests/search/SearchTests.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,43 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.jsdt.core.tests.search; >+ >+import junit.framework.Test; >+import junit.framework.TestSuite; >+ >+/** >+ * <p>Test suite for all JSDT Search Tests.<p> >+ */ >+public class SearchTests extends TestSuite { >+ /** >+ * <p>Default constructor</p> >+ */ >+ public SearchTests() { >+ this("JavaScript Search Tests"); >+ } >+ >+ /** >+ * <p>Constructor with specified test name.</p> >+ * >+ * @param testName of this test suite >+ */ >+ public SearchTests(String testName) { >+ super(testName); >+ } >+ >+ public static Test suite() { >+ TestSuite all = new TestSuite("JavaScript Search Tests"); >+ >+ all.addTestSuite(TestMethodPattern.class); >+ >+ return all; >+ } >+} >Index: src/org/eclipse/wst/jsdt/core/tests/search/TestMethodPattern.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/core/tests/search/TestMethodPattern.java >diff -N src/org/eclipse/wst/jsdt/core/tests/search/TestMethodPattern.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/jsdt/core/tests/search/TestMethodPattern.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,426 @@ >+/** >+ * >+ */ >+package org.eclipse.wst.jsdt.core.tests.search; >+ >+import org.eclipse.wst.jsdt.core.compiler.CharOperation; >+import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; >+import org.eclipse.wst.jsdt.internal.core.search.indexing.IIndexConstants; >+import org.eclipse.wst.jsdt.internal.core.search.matching.MethodPattern; >+ >+import junit.framework.TestCase; >+ >+/** >+ * <p>Tests for MethodPattern.</p> >+ * >+ * @see MethodPattern >+ */ >+public class TestMethodPattern extends TestCase { >+ >+ public void testCreateIndexKey_0() { >+ runCreateIndexKeyTest("myFunction/0/////", "myFunction".toCharArray(), 0, null, null, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_1() { >+ runCreateIndexKeyTest("myFunction/1/////", "myFunction".toCharArray(), 1, null, null, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_2() { >+ runCreateIndexKeyTest("myFunction/0///String//", >+ "myFunction".toCharArray(), 0, null, null, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_3() { >+ runCreateIndexKeyTest("myFunction/0////foo.bar.Type/", >+ "myFunction".toCharArray(), 0, null, null, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_4() { >+ runCreateIndexKeyTest("myFunction/0///String/foo.bar.Type/", >+ "myFunction".toCharArray(), 0, null, null, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_5() { >+ runCreateIndexKeyTest("myFunction/2//param1,param2///", >+ "myFunction".toCharArray(), 2, null, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_6() { >+ runCreateIndexKeyTest("myFunction/2//param1,param2/String//", >+ "myFunction".toCharArray(), 2, null, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_7() { >+ runCreateIndexKeyTest("myFunction/2//param1,param2//foo.bar.Type/", >+ "myFunction".toCharArray(), 2, null, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_8() { >+ runCreateIndexKeyTest("myFunction/2//param1,param2/String/foo.bar.Type/", >+ "myFunction".toCharArray(), 2, null, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_9() { >+ runCreateIndexKeyTest("myFunction/2/String,Number/param1,param2///", >+ "myFunction".toCharArray(), 2, new char[][] { "String".toCharArray(), "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_10() { >+ runCreateIndexKeyTest("myFunction/2/String,Number/param1,param2/String//", >+ "myFunction".toCharArray(), 2, new char[][] { "String".toCharArray(), "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_11() { >+ runCreateIndexKeyTest("myFunction/2/String,Number/param1,param2//foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] { "String".toCharArray(), "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_12() { >+ runCreateIndexKeyTest("myFunction/2/String,Number/param1,param2/String/foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] { "String".toCharArray(), "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_13() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2///", >+ "myFunction".toCharArray(), 2, new char[][] { null, "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_14() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2/String//", >+ "myFunction".toCharArray(), 2, new char[][] { null, "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_15() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2//foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] { null, "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_16() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2/String/foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] { null, "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_17() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2///", >+ "myFunction".toCharArray(), 2, new char[][] { new char[0], "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_18() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2/String//", >+ "myFunction".toCharArray(), 2, new char[][] { new char[0], "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_19() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2//foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] { new char[0], "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_20() { >+ runCreateIndexKeyTest("myFunction/2/,Number/param1,param2/String/foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] { new char[0], "Number".toCharArray()}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_21() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2///", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), null}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_22() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2/String//", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), null}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_23() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2//foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), null}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_24() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2/String/foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), null}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_25() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2///", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), new char[0]}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, null, 0); >+ } >+ >+ public void testCreateIndexKey_26() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2/String//", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), new char[0]}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, null, "String".toCharArray(), 0); >+ } >+ >+ public void testCreateIndexKey_27() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2//foo.bar.Type/", >+ "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), new char[0]}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), null, ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_28() { >+ runCreateIndexKeyTest("myFunction/2/String,/param1,param2/String/foo.bar.Type/", "myFunction".toCharArray(), 2, new char[][] {"String".toCharArray(), new char[0]}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ } >+ >+ public void testCreateIndexKey_29() { >+ char[] keyChars = MethodPattern.createIndexKey("".toCharArray(), 2, new char[][] {"String".toCharArray(), new char[0]}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ >+ String key = null; >+ if(keyChars != null) { >+ key = new String(keyChars); >+ } >+ >+ assertNull("If selector is empty the key should be null.\nWAS:\n" + key, key); >+ } >+ >+ public void testCreateIndexKey_30() { >+ char[] keyChars = MethodPattern.createIndexKey(null, 2, new char[][] {"String".toCharArray(), new char[0]}, new char[][] { "param1".toCharArray(), "param2".toCharArray()}, "foo.bar.Type".toCharArray(), "String".toCharArray(), ClassFileConstants.AccStatic); >+ >+ String key = null; >+ if(keyChars != null) { >+ key = new String(keyChars); >+ } >+ >+ assertNull("If selector is empty the key should be null.\nWAS:\n" + key, key); >+ } >+ >+ public void testDecodeIndexKey_0() { >+ runDecodeIndexKeyTest("myFunction/0////", "myFunction", 0, null, null, null,null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_2() { >+ runDecodeIndexKeyTest("myFunction/0///String/", "myFunction", 0, null, null, null,null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_3() { >+ runDecodeIndexKeyTest("myFunction/0////foo.bar.Type", "myFunction", 0, null, null, null,null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_4() { >+ runDecodeIndexKeyTest("myFunction/0///String/foo.bar.Type", "myFunction", 0, null, null, null,null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_5() { >+ runDecodeIndexKeyTest("myFunction/2//param1,param2//", "myFunction", 2, new String[2], new String[2], new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_6() { >+ runDecodeIndexKeyTest("myFunction/2//param1,param2/String/", "myFunction", 2, new String[2], new String[2], new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_7() { >+ runDecodeIndexKeyTest("myFunction/2//param1,param2//foo.bar.Type", "myFunction", 2, new String[2], new String[2], new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_8() { >+ runDecodeIndexKeyTest("myFunction/2//param1,param2/String/foo.bar.Type", "myFunction", 2, new String[2], new String[2], new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_9() { >+ runDecodeIndexKeyTest("myFunction/2/String,Number/param1,param2//", "myFunction", 2, new String[]{null, null}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_10() { >+ runDecodeIndexKeyTest("myFunction/2/String,Number/param1,param2/String/", "myFunction", 2, new String[]{null, null}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_11() { >+ runDecodeIndexKeyTest("myFunction/2/String,Number/param1,param2//foo.bar.Type", "myFunction", 2, new String[]{null, null}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_12() { >+ runDecodeIndexKeyTest("myFunction/2/String,Number/param1,param2/String/foo.bar.Type", "myFunction", 2, new String[]{null, null}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_13() { >+ runDecodeIndexKeyTest("myFunction/2/,Number/param1,param2//", "myFunction", 2, new String[]{null, null}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_14() { >+ runDecodeIndexKeyTest("myFunction/2/,Number/param1,param2/String/", "myFunction", 2, new String[]{null, null}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_15() { >+ runDecodeIndexKeyTest("myFunction/2/,Number/param1,param2//foo.bar.Type", "myFunction", 2, new String[]{null, null}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_16() { >+ runDecodeIndexKeyTest("myFunction/2/,Number/param1,param2/String/foo.bar.Type", "myFunction", 2, new String[]{null, null}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_17() { >+ runDecodeIndexKeyTest("myFunction/2/String,/param1,param2//", "myFunction", 2, new String[]{null, null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_18() { >+ runDecodeIndexKeyTest("myFunction/2/String,/param1,param2/String/", "myFunction", 2, new String[]{null, null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_19() { >+ runDecodeIndexKeyTest("myFunction/2/String,/param1,param2//foo.bar.Type", "myFunction", 2, new String[]{null, null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_20() { >+ runDecodeIndexKeyTest("myFunction/2/String,/param1,param2/String/foo.bar.Type", "myFunction", 2, new String[]{null, null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_21() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,neto.crazy.Number/param1,param2//", "myFunction", 2, new String[]{"bar.foo", "neto.crazy"}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_22() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,neto.crazy.Number/param1,param2/String/", "myFunction", 2, new String[]{"bar.foo", "neto.crazy"}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_23() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,neto.crazy.Number/param1,param2//foo.bar.Type", "myFunction", 2, new String[]{"bar.foo", "neto.crazy"}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_24() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,neto.crazy.Number/param1,param2/String/foo.bar.Type", "myFunction", 2, new String[]{"bar.foo", "neto.crazy"}, new String[]{"String", "Number"}, new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_25() { >+ runDecodeIndexKeyTest("myFunction/2/,neto.crazy.Number/param1,param2//", "myFunction", 2, new String[]{null, "neto.crazy"}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_26() { >+ runDecodeIndexKeyTest("myFunction/2/,neto.crazy.Number/param1,param2/String/", "myFunction", 2, new String[]{null, "neto.crazy"}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_27() { >+ runDecodeIndexKeyTest("myFunction/2/,neto.crazy.Number/param1,param2//foo.bar.Type", "myFunction", 2, new String[]{null, "neto.crazy"}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_28() { >+ runDecodeIndexKeyTest("myFunction/2/,neto.crazy.Number/param1,param2/String/foo.bar.Type", "myFunction", 2, new String[]{null, "neto.crazy"}, new String[]{null, "Number"}, new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_29() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,/param1,param2//", "myFunction", 2, new String[]{"bar.foo", null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, null, null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_30() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,/param1,param2/String/", "myFunction", 2, new String[]{"bar.foo", null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, "String", null, null, 0); >+ } >+ >+ public void testDecodeIndexKey_31() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,/param1,param2//foo.bar.Type", "myFunction", 2, new String[]{"bar.foo", null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, null, "foo.bar", "Type", 0); >+ } >+ >+ public void testDecodeIndexKey_32() { >+ runDecodeIndexKeyTest("myFunction/2/bar.foo.String,/param1,param2/String/foo.bar.Type", "myFunction", 2, new String[]{"bar.foo", null}, new String[]{"String", null}, new String[] {"param1", "param2"},null, "String", "foo.bar", "Type", 0); >+ } >+ >+ /** >+ * <p>Runs the asserts for a single create index key test.</p> >+ * >+ * @param expected >+ * @param selector >+ * @param parameterCount >+ * @param parameterFullTypeNames >+ * @param parameterNames >+ * @param declaringFullTypeName >+ * @param returnFullTypeName >+ * @param modifiers >+ */ >+ private static void runCreateIndexKeyTest(String expected, >+ char[] selector, >+ int parameterCount, >+ char[][] parameterFullTypeNames, >+ char[][] parameterNames, >+ char[] declaringFullTypeName, >+ char[] returnFullTypeName, >+ int modifiers) { >+ >+ char[] indexKey = MethodPattern.createIndexKey(selector, parameterCount, parameterFullTypeNames, parameterNames, declaringFullTypeName, returnFullTypeName, modifiers); >+ >+ String expectedWithModifiers = expected + (char) modifiers + (char) (modifiers>>16); >+ >+ assertNotNull("The created index key should not be null.\nEXPECTED:\n" + expectedWithModifiers, indexKey); >+ >+ assertTrue("The expected index key does not match the generated index key.\nWAS:\n" + new String(indexKey) + "\nEXPECTED:\n" + expected, >+ CharOperation.equals(indexKey, expectedWithModifiers.toCharArray())); >+ } >+ >+ /** >+ * <p>Runs a single decode index key test</p> >+ * >+ * @param key >+ * @param selector >+ * @param parameterCount >+ * @param parameterQualifications >+ * @param parameterSimpleNames >+ * @param parameterNames >+ * @param returnQualification >+ * @param returnSimpleName >+ * @param declaringQualification >+ * @param declaringSimpleName >+ * @param modifiers >+ */ >+ private static void runDecodeIndexKeyTest(String key, >+ String selector, >+ int parameterCount, >+ String[] parameterQualifications, >+ String[] parameterSimpleNames, >+ String[] parameterNames, >+ String returnQualification, >+ String returnSimpleName, >+ String declaringQualification, >+ String declaringSimpleName, >+ int modifiers) { >+ >+ char[] keyWithModifiers = new char[key.length() + 3]; >+ System.arraycopy(key.toCharArray(), 0, keyWithModifiers, 0, key.length()); >+ keyWithModifiers[keyWithModifiers.length-3] = '/'; >+ keyWithModifiers[keyWithModifiers.length-2] = (char) modifiers; >+ keyWithModifiers[keyWithModifiers.length-1] = (char) (modifiers>>16); >+ >+ MethodPattern pattern = new MethodPattern(false, false, false, null, 0); >+ pattern = (MethodPattern)pattern.getBlankPattern(); >+ pattern.decodeIndexKey(keyWithModifiers); >+ >+ assertEquals("Expected selector does not equal decoded selector.", selector, pattern.selector); >+ assertEquals("Expected parameter count does not equal decoded parameter count.", parameterCount, pattern.parameterCount); >+ assertEquals("Expected parameter qualifications does not equal decoded parameter qualifications.", parameterQualifications, pattern.parameterQualifications); >+ assertEquals("Expected parameter simple names does not equal decoded parameter simple names.", parameterSimpleNames, pattern.parameterSimpleNames); >+ assertEquals("Expected parameter names does not equal decoded parameter names.", parameterNames, pattern.parameterNames); >+ assertEquals("Expected return qualification does not equal decoded return wualification.", returnQualification, pattern.returnQualification); >+ assertEquals("Expected return simple name does not equal decoded return simple name.", returnSimpleName, pattern.returnSimpleName); >+ assertEquals("Expected declaring qualification does not equal decoded declaring qualification.", declaringQualification, pattern.declaringQualification); >+ assertEquals("Expected declaring simple name does not equal decoded declaring simple name.", declaringSimpleName, pattern.declaringSimpleName); >+ } >+ >+ private static void assertEquals(String message, String expected, char[] chars) { >+ String actual = null; >+ if(chars != null) { >+ actual = new String(chars); >+ } >+ >+ assertEquals(message, expected, actual); >+ } >+ >+ private static void assertEquals(String message, String[] expected, char[][] actual) { >+ >+ String expectedColappsed = null; >+ String actualColappsed = null; >+ if(actual != null) { >+ char[] actualColappsedChars = CharOperation.concatWith(actual, IIndexConstants.PARAMETER_SEPARATOR, false); >+ if(actualColappsedChars != null) { >+ actualColappsed = new String(actualColappsedChars); >+ } >+ } >+ >+ if(expected != null) { >+ expectedColappsed = ""; >+ for(int i = 0; i < expected.length; ++i) { >+ if(i > 0) { >+ expectedColappsed += ","; >+ } >+ >+ if(expected[i] != null) { >+ expectedColappsed += expected[i]; >+ } >+ } >+ } >+ >+ assertEquals(message, expectedColappsed, actualColappsed); >+ } >+} >#P org.eclipse.wst.jsdt.core.tests.model >Index: .settings/org.eclipse.core.resources.prefs >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs,v >retrieving revision 1.2 >diff -u -r1.2 org.eclipse.core.resources.prefs >--- .settings/org.eclipse.core.resources.prefs 1 Feb 2008 20:09:09 -0000 1.2 >+++ .settings/org.eclipse.core.resources.prefs 19 Jul 2011 19:46:23 -0000 >@@ -1,4 +1,5 @@ >-#Mon Jan 28 15:47:49 CST 2008 >+#Thu Jul 14 08:12:53 EDT 2011 > eclipse.preferences.version=1 >+encoding//src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java=US-ASCII > encoding/<project>=ISO-8859-1 > instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true >Index: src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java >diff -N src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java >--- src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java 1 Jul 2011 22:12:15 -0000 1.12.2.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,2416 +0,0 @@ >-/******************************************************************************* >- * 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 >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.wst.jsdt.core.tests.model; >- >-import java.io.File; >-import java.io.FileOutputStream; >-import java.io.IOException; >-import java.util.HashMap; >-import java.util.Map; >-import java.util.StringTokenizer; >- >-import junit.framework.ComparisonFailure; >-import junit.framework.Test; >- >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IWorkspaceRunnable; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IProgressMonitor; >-import org.eclipse.core.runtime.Path; >-import org.eclipse.wst.jsdt.core.IAccessRule; >-import org.eclipse.wst.jsdt.core.IIncludePathAttribute; >-import org.eclipse.wst.jsdt.core.IIncludePathEntry; >-import org.eclipse.wst.jsdt.core.IJavaScriptProject; >-import org.eclipse.wst.jsdt.core.IJavaScriptUnit; >-import org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer; >-import org.eclipse.wst.jsdt.core.JavaScriptCore; >-import org.eclipse.wst.jsdt.internal.codeassist.RelevanceConstants; >- >-public class CompletionTests2 extends ModifyingResourceTests implements RelevanceConstants { >- >- public static final String DEFUALT_JSDTSCOPE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >- "<classpath>\n" + >- " <classpathentry kind=\"src\" path=\"\"/>\n" + >- " <classpathentry kind=\"con\" path=\"org.eclipse.wst.jsdt.launching.JRE_CONTAINER\"/>\n"+ >- " <classpathentry kind=\"output\" path=\"\"/>\n"+ >- "</classpath>"; >- /* >- .project = DEFAULT_PROJECT_LEFT + project name + DEFAULT_PROJECT_RIGHT; >- */ >- public static final String DEFAULT_PROJECT_LEFT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >- "<projectDescription>\n" + >- " <name>"; >- >- >- public static final String DEFAULT_PROJECT_RIGHT ="</name>\n" + >- " <comment></comment>\n" + >- " <projects>\n" + >- " </projects>\n"+ >- " <buildSpec>\n"+ >- " <buildCommand>\n"+ >- " <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>\n"+ >- " <arguments>\n"+ >- " </arguments>\n"+ >- " </buildCommand>\n"+ >- " </buildSpec>\n"+ >- " <natures>\n"+ >- " <nature>org.eclipse.wst.jsdt.core.jsNature</nature>\n"+ >- " </natures>\n" + >- "</projectDescription>"; >- >- >- >- >- >- public static class CompletionContainerInitializer implements ContainerInitializer.ITestInitializer { >- >- public static class DefaultContainer implements IJsGlobalScopeContainer { >- char[][] libPaths; >- boolean[] areExported; >- String[] forbiddenReferences; >- public DefaultContainer(char[][] libPaths, boolean[] areExported, String[] forbiddenReferences) { >- this.libPaths = libPaths; >- this.areExported = areExported; >- this.forbiddenReferences = forbiddenReferences; >- } >- /** >- * @deprecated Use {@link #getIncludepathEntries()} instead >- */ >- public IIncludePathEntry[] getClasspathEntries() { >- return getIncludepathEntries(); >- } >- public IIncludePathEntry[] getIncludepathEntries() { >- int length = this.libPaths.length; >- IIncludePathEntry[] entries = new IIncludePathEntry[length]; >- for (int j = 0; j < length; j++) { >- IPath path = new Path(new String(this.libPaths[j])); >- boolean isExported = this.areExported[j]; >- >- IAccessRule[] accessRules; >- if(forbiddenReferences != null && forbiddenReferences[j]!= null && forbiddenReferences[j].length() != 0) { >- StringTokenizer tokenizer = new StringTokenizer(forbiddenReferences[j], ";"); >- int count = tokenizer.countTokens(); >- accessRules = new IAccessRule[count]; >- String token = null; >- for (int i = 0; i < count; i++) { >- token = tokenizer.nextToken(); >- accessRules[i] = JavaScriptCore.newAccessRule(new Path(token), IAccessRule.K_NON_ACCESSIBLE); >- } >- } else { >- accessRules = new IAccessRule[0]; >- } >- if (path.segmentCount() == 1) { >- entries[j] = JavaScriptCore.newProjectEntry(path, accessRules, true, new IIncludePathAttribute[0], isExported); >- } else { >- entries[j] = JavaScriptCore.newLibraryEntry(path, null, null, accessRules, new IIncludePathAttribute[0], isExported); >- } >- } >- return entries; >- } >- public String getDescription() { >- return "Test container"; >- } >- public int getKind() { >- return IJsGlobalScopeContainer.K_APPLICATION; >- } >- public IPath getPath() { >- return new Path("org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"); >- } >- /* (non-Javadoc) >- * @see org.eclipse.wst.jsdt.core.IJsGlobalScopeContainer#resolvedLibraryImport(java.lang.String) >- */ >- public String[] resolvedLibraryImport(String a) { >- return new String[] {a}; >- } >- } >- >- Map containerValues; >- CoreException exception; >- >- public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported) { >- this(projectName, libPaths, areExported, null); >- } >- public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported, String[] forbiddenRefrences) { >- containerValues = new HashMap(); >- >- int libPathsLength = libPaths.length; >- char[][] charLibPaths = new char[libPathsLength][]; >- for (int i = 0; i < libPathsLength; i++) { >- charLibPaths[i] = libPaths[i].toCharArray(); >- } >- containerValues.put( >- projectName, >- newContainer(charLibPaths, areExported, forbiddenRefrences) >- ); >- } >- protected DefaultContainer newContainer(final char[][] libPaths, final boolean[] areExperted, final String[] forbiddenRefrences) { >- return new DefaultContainer(libPaths, areExperted, forbiddenRefrences); >- } >- public boolean allowFailureContainer() { >- return true; >- } >- public void initialize(IPath containerPath, IJavaScriptProject project) throws CoreException { >- if (containerValues == null) return; >- try { >- JavaScriptCore.setJsGlobalScopeContainer( >- containerPath, >- new IJavaScriptProject[] {project}, >- new IJsGlobalScopeContainer[] {(IJsGlobalScopeContainer)containerValues.get(project.getElementName())}, >- null); >- } catch (CoreException e) { >- this.exception = e; >- throw e; >- } >- } >- } >-public CompletionTests2(String name) { >- super(name); >-} >-public void setUpSuite() throws Exception { >- super.setUpSuite(); >- >- setUpJavaProject("Completion"); >-} >-public void tearDownSuite() throws Exception { >- deleteProject("Completion"); >- >- super.tearDownSuite(); >-} >- >-protected static void assertResults(String expected, String actual) { >- try { >- assertEquals(expected, actual); >- } catch(ComparisonFailure c) { >- System.out.println(actual); >- System.out.println(); >- throw c; >- } >-} >-static { >-// TESTS_NAMES = new String[] { "testBug96950" }; >-} >-public static Test suite() { >- return buildModelTestSuite(CompletionTests2.class); >-} >- >-File createFile(File parent, String name, String content) throws IOException { >- File file = new File(parent, name); >- FileOutputStream out = new FileOutputStream(file); >- out.write(content.getBytes()); >- out.close(); >- return file; >-} >-File createDirectory(File parent, String name) { >- File dir = new File(parent, name); >- dir.mkdirs(); >- return dir; >-} >-/** >- * Test for bug 29832 >- */ >-public void testBug29832() throws Exception { >- try { >- // create variable >-// JavaScriptCore.setClasspathVariables( >-// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-// null); >- >- // create P1 >- // IFile f = getFile("/Completion/lib.jar"); >- IFile f = getFile("/Completion/ZZZ.js"); >- >- >- IJavaScriptProject p = this.createJavaProject( >- "P1", >- new String[]{"/"}, >- new String[]{}); >- IFile libFile = this.createFile("/P1/ZZZ.js", f.getContents()); >- this.addLibraryEntry(p, libFile.getLocation().toString(), true); >- >- // create P2 >- this.createJavaProject( >- "P2", >- new String[]{"/"}, >- new String[]{}, >- new String[]{"/P1"}); >- this.createFile( >- "/P2/X.js", >- "function testZZZClass {\n"+ >- " var z = new ZZZ();\n"+ >- " z;\n" + >- "}"); >- >- waitUntilIndexesReady(); >- >- // do completion >- CompletionTestsRequestor requestor = new CompletionTestsRequestor(); >- IJavaScriptUnit cu= getCompilationUnit("P2", "", "", "X.js"); >- >- String str = cu.getSource(); >- String completeBehind = "z"; >- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >- cu.codeComplete(cursorLocation, requestor); >- >-// assertEquals( >-// "element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED), >-// requestor.getResults()); >- assertEquals( >- "element:ZZZ completion:ZZZ relevance:" +(R_DEFAULT+R_RESOLVED+R_INTERESTING+R_NON_RESTRICTED) + "\n"+ >- "element:ZZZ_FUNCTION completion:ZZZ_FUNCTION() relevance:11\n" + >- "element:ZZZ_FUNCTION completion:ZZZ_FUNCTION() relevance:11\n" + >- "element:z completion:z relevance:"+ (R_DEFAULT+R_RESOLVED+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED), >- requestor.getResults()); >- >- // delete P1 >- p.getProject().delete(true, false, null); >- >- // create P1 >- File dest = getWorkspaceRoot().getLocation().toFile(); >- File pro = this.createDirectory(dest, "P1"); >- File proSet = this.createDirectory(pro,".settings"); >- >- this.createFile(proSet, ".jsdtscope", DEFUALT_JSDTSCOPE); >- >- >-// "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >-// "<classpath>\n" + >-// " <classpathentry kind=\"src\" path=\"\"/>\n" + >-// " <classpathentry kind=\"var\" path=\"JCL_LIB\" sourcepath=\"JCL_SRC\" rootpath=\"JCL_SRCROOT\"/>\n" + >-// " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >-// "</classpath>"); >- >- this.createFile(pro, ".project", DEFAULT_PROJECT_LEFT + "org.eclipse.wst.jsdt.core" + DEFAULT_PROJECT_RIGHT); >-// "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >-// "<projectDescription>\n" + >-// " <name>org.eclipse.wst.jsdt.core</name>\n" + >-// " <comment></comment>\n" + >-// " <projects>\n" + >-// " </projects>\n" + >-// " <buildSpec>\n" + >-// " <buildCommand>\n" + >-// " <name>org.eclipse.wst.jsdt.core.javabuilder</name>\n" + >-// " <arguments>\n" + >-// " </arguments>\n" + >-// " </buildCommand>\n" + >-// " </buildSpec>\n" + >-// " <natures>\n" + >-// " <nature>org.eclipse.wst.jsdt.core.javanature</nature>\n" + >-// " </natures>\n" + >-// "</projectDescription>"); >- >- //File src = this.createDirectory(pro, "src"); >- >- //File pz = this.createDirectory(src, "pz"); >- >- this.createFile(pro,"ZZZ.js","function testZZZClass {\n"+ >- " var z = new ZZZ();\n"+ >- " z;\n" + >- "}"); >- >- final IProject project = getWorkspaceRoot().getProject("P1"); >- IWorkspaceRunnable populate = new IWorkspaceRunnable() { >- public void run(IProgressMonitor monitor) throws CoreException { >- project.create(null); >- project.open(null); >- } >- }; >- getWorkspace().run(populate, null); >- JavaScriptCore.create(project); >- >- waitUntilIndexesReady(); >- >- // do completion >- requestor = new CompletionTestsRequestor(); >- cu.codeComplete(cursorLocation, requestor); >- >- assertEquals( >- "element:z completion:z relevance:"+ (R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n" + >- "element:z completion:z relevance:"+(R_DEFAULT+R_RESOLVED+R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED), >- requestor.getResults()); >- } finally { >- this.deleteProject("P1"); >- this.deleteProject("P2"); >- } >-} >-/** >- * Test for bug 33560 >- */ >-public void testBug33560() throws Exception { >- try { >- // create variable >-// JavaScriptCore.setClasspathVariables( >-// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-// null); >- >- // create P1 >- //IFile f = getFile("/Completion/lib.jar"); >- IFile f = getFile("/Completion/ZZZ.js"); >- IJavaScriptProject p = this.createJavaProject( >- "P1", >- new String[]{"/"}, >- new String[]{});; >- IFile libFile = this.createFile("/P1/ZZZ.js", f.getContents()); >- this.addLibraryEntry(p, libFile.getLocation().toString(), true); >- >- // create P2 >- this.createJavaProject( >- "P2", >- new String[]{"/"}, >- new String[]{}, >- new String[]{"/P1"}); >- >- // create P3 >- this.createJavaProject( >- "P3", >- new String[]{"/"}, >- new String[]{}, >- new String[]{"/P1"}); >- this.createFile( >- "/P3/X.js", >- "function testZZZClass {\n"+ >- " var z = new ZZZ();\n"+ >- " z;\n" + >- "}"); >- >- waitUntilIndexesReady(); >- >- // do completion >- CompletionTestsRequestor requestor = new CompletionTestsRequestor(); >- IJavaScriptUnit cu= getCompilationUnit("P3", "", "", "X.js"); >- >- String str = cu.getSource(); >- String completeBehind = "z"; >- int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >- cu.codeComplete(cursorLocation, requestor); >- assertEquals( >- "element:ZZZ completion:ZZZ relevance:" +(R_DEFAULT+R_RESOLVED+R_INTERESTING+R_NON_RESTRICTED ) + "\n"+ >- "element:ZZZ_FUNCTION completion:ZZZ_FUNCTION() relevance:11\n" + >- "element:ZZZ_FUNCTION completion:ZZZ_FUNCTION() relevance:11\n" + >- "element:z completion:z relevance:"+ (R_DEFAULT+R_RESOLVED+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED), >- requestor.getResults()); >- >- >- // delete P1 >- p.getProject().delete(true, false, null); >- >- // create P1 >- File dest = getWorkspaceRoot().getLocation().toFile(); >- File pro = this.createDirectory(dest, "P1"); >- File proSet = this.createDirectory(pro,".settings"); >- >- this.createFile(proSet, ".jsdtscope", DEFUALT_JSDTSCOPE); >-// this.createFile(pro, ".classpath", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >-// "<classpath>\n" + >-// " <classpathentry kind=\"src\" path=\"src\"/>\n" + >-// " <classpathentry kind=\"var\" path=\"JCL_LIB\" sourcepath=\"JCL_SRC\" rootpath=\"JCL_SRCROOT\"/>\n" + >-// " <classpathentry kind=\"output\" path=\"bin\"/>\n" + >-// "</classpath>"); >- this.createFile(pro, ".project", DEFAULT_PROJECT_LEFT + "org.eclipse.wst.jsdt.core" + DEFAULT_PROJECT_RIGHT); >-// this.createFile(pro, ".project", >-// "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >-// "<projectDescription>\n" + >-// " <name>org.eclipse.wst.jsdt.core</name>\n" + >-// " <comment></comment>\n" + >-// " <projects>\n" + >-// " </projects>\n" + >-// " <buildSpec>\n" + >-// " <buildCommand>\n" + >-// " <name>org.eclipse.wst.jsdt.core.javabuilder</name>\n" + >-// " <arguments>\n" + >-// " </arguments>\n" + >-// " </buildCommand>\n" + >-// " </buildSpec>\n" + >-// " <natures>\n" + >-// " <nature>org.eclipse.wst.jsdt.core.javanature</nature>\n" + >-// " </natures>\n" + >-// "</projectDescription>"); >-// >- File src = this.createDirectory(pro, "src"); >- >- File pz = this.createDirectory(src, "pz"); >- >- this.createFile(pro,"ZZZ.js","function testZZZClass {\n"+ >- " var z = new ZZZ();\n"+ >- " z;\n" + >- "}"); >- >- final IProject project = getWorkspaceRoot().getProject("P1"); >- IWorkspaceRunnable populate = new IWorkspaceRunnable() { >- public void run(IProgressMonitor monitor) throws CoreException { >- project.create(null); >- project.open(null); >- } >- }; >- getWorkspace().run(populate, null); >- JavaScriptCore.create(project); >- >- waitUntilIndexesReady(); >- >- // do completion >- requestor = new CompletionTestsRequestor(); >- cu.codeComplete(cursorLocation, requestor); >- >- assertEquals( >- "element:z completion:z relevance:"+ (R_DEFAULT+R_INTERESTING+R_CASE+R_EXACT_NAME+R_UNQUALIFIED+R_NON_RESTRICTED) + "\n" + >- "element:z completion:z relevance:"+(R_DEFAULT+R_RESOLVED+R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED), >- requestor.getResults()); >- } finally { >- this.deleteProject("P1"); >- this.deleteProject("P2"); >- this.deleteProject("P3"); >- } >-} >-/* >- * >- * This tests a project which includes functions and methods marked as "not exported" from another project. This is N/A for JS. >- */ >- >-//public void testBug79288() throws Exception { >-// try { >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// new String[]{"/P1"}, >-// "bin"); >-// >-// this.createFolder("/P2/src/b"); >-// this.createFile( >-// "/P2/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// new String[]{"/P2"}, >-// "bin"); >-// >-// this.createFile( >-// "/P3/src/YY.js", >-// "public class YY {\n"+ >-// " vois foo(){\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P3", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// } >-//} >- >- >- >- >-//public void testBug91772() throws Exception { >-// try { >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// // create P2 >-// ContainerInitializer.setInitializer(new CompletionContainerInitializer("P2", new String[] {"/P1"}, new boolean[] {true})); >-// String[] classLib = new String[]{"JCL_LIB"}; >-// int classLibLength = classLib.length; >-// String[] lib = new String[classLibLength + 1]; >-// System.arraycopy(classLib, 0, lib, 0, classLibLength); >-// lib[classLibLength] = "org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"; >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// lib, >-// "bin"); >-// >-// this.createFolder("/P2/src/b"); >-// this.createFile( >-// "/P2/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// new String[]{"/P2"}, >-// "bin"); >-// >-// this.createFile( >-// "/P3/src/YY.js", >-// "public class YY {\n"+ >-// " vois foo(){\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P3", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// >-// >-// // TODO the following code is not the correct way to remove the container >-// // Cleanup caches >-// JavaModelManager manager = JavaModelManager.getJavaModelManager(); >-// manager.containers = new HashMap(5); >-// manager.variables = new HashMap(5); >-// } >-//} >-//public void testBug93891() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// ContainerInitializer.setInitializer(new CompletionContainerInitializer("P2", new String[] {"/P1"}, new boolean[] {true}, new String[]{"a/*"})); >-// String[] classLib = new String[]{"JCL_LIB"}; >-// int classLibLength = classLib.length; >-// String[] lib = new String[classLibLength + 1]; >-// System.arraycopy(classLib, 0, lib, 0, classLibLength); >-// lib[classLibLength] = "org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"; >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// lib, >-// "bin"); >-// >-// this.createFolder("/P2/src/b"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// >-// // TODO the following code is not the correct way to remove the container >-// // Cleanup caches >-// JavaModelManager manager = JavaModelManager.getJavaModelManager(); >-// manager.containers = new HashMap(5); >-// manager.variables = new HashMap(5); >-// >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction1() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.IGNORE); >-// options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.IGNORE); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// new String[]{"/P1"}, >-// "bin"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-// >-//public void testAccessRestriction2() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.IGNORE); >-// options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.IGNORE); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction3() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction4() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.IGNORE); >-// options.put(JavaScriptCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaScriptCore.IGNORE); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction5() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction6() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/c"); >-// this.createFile( >-// "/P1/src/c/XX3.js", >-// "package c;\n"+ >-// "public class XX3 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P2"}, >-// new String[][]{{}}, >-// new String[][]{{"b/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFile( >-// "/P3/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P3", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX3[TYPE_REF]{c.XX3, c, Lc.XX3;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction7() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1", "/P3"}, >-// new String[][]{{}, {}}, >-// new String[][]{{"a/*"}, {}}, >-// new boolean[]{false, false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction8() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P3", "/P1"}, >-// new String[][]{{}, {}}, >-// new String[][]{{}, {"a/*"}}, >-// new boolean[]{false, false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction9() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/p11"); >-// this.createFile( >-// "/P1/src/p11/XX11.js", >-// "package p11;\n"+ >-// "public class XX11 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/p12"); >-// this.createFile( >-// "/P1/src/p12/XX12.js", >-// "package p12;\n"+ >-// "public class XX12 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1", "/P3"}, >-// new String[][]{{}, {}}, >-// new String[][]{{"p11/*"}, {"p31/*"}}, >-// new boolean[]{true, true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P2/src/p21"); >-// this.createFile( >-// "/P2/src/p21/XX21.js", >-// "package p21;\n"+ >-// "public class XX21 {\n"+ >-// "}"); >-// >-// this.createFolder("/P2/src/p22"); >-// this.createFile( >-// "/P2/src/p22/XX22.js", >-// "package p22;\n"+ >-// "public class XX22 {\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"p12/*"}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P3/src/p31"); >-// this.createFile( >-// "/P3/src/p31/XX31.js", >-// "package p31;\n"+ >-// "public class XX31 {\n"+ >-// "}"); >-// >-// this.createFolder("/P3/src/p32"); >-// this.createFile( >-// "/P3/src/p32/XX32.js", >-// "package p32;\n"+ >-// "public class XX32 {\n"+ >-// "}"); >-// >-// // create PX >-// this.createJavaProject( >-// "PX", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P2"}, >-// null, >-// null, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFile( >-// "/PX/src/X.js", >-// "public class X {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// this.deleteProject("PX"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction10() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/p11"); >-// this.createFile( >-// "/P1/src/p11/XX11.js", >-// "package p11;\n"+ >-// "public class XX11 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/p12"); >-// this.createFile( >-// "/P1/src/p12/XX12.js", >-// "package p12;\n"+ >-// "public class XX12 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1", "/P3"}, >-// new String[][]{{}, {}}, >-// new String[][]{{"p11/*"}, {"p31/*"}}, >-// new boolean[]{true, true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P2/src/p21"); >-// this.createFile( >-// "/P2/src/p21/XX21.js", >-// "package p21;\n"+ >-// "public class XX21 {\n"+ >-// "}"); >-// >-// this.createFolder("/P2/src/p22"); >-// this.createFile( >-// "/P2/src/p22/XX22.js", >-// "package p22;\n"+ >-// "public class XX22 {\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"p12/*"}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P3/src/p31"); >-// this.createFile( >-// "/P3/src/p31/XX31.js", >-// "package p31;\n"+ >-// "public class XX31 {\n"+ >-// "}"); >-// >-// this.createFolder("/P3/src/p32"); >-// this.createFile( >-// "/P3/src/p32/XX32.js", >-// "package p32;\n"+ >-// "public class XX32 {\n"+ >-// "}"); >-// >-// // create PX >-// this.createJavaProject( >-// "PX", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P2"}, >-// null, >-// null, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFile( >-// "/PX/src/X.js", >-// "public class X {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX11[TYPE_REF]{p11.XX11, p11, Lp11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + >-// "XX31[TYPE_REF]{p31.XX31, p31, Lp31.XX31;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + >-// "XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// this.deleteProject("PX"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction11() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/x/y/z/p11"); >-// this.createFile( >-// "/P1/src/x/y/z/p11/XX11.js", >-// "package x.y.z.p11;\n"+ >-// "public class XX11 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/x/y/z/p12"); >-// this.createFile( >-// "/P1/src/x/y/z/p12/XX12.js", >-// "package x.y.z.p12;\n"+ >-// "public class XX12 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P3", "/P1"}, >-// new String[][]{{}, {}}, >-// new String[][]{{"x/y/z/p31/*"}, {"x/y/z/p11/*"}}, >-// new boolean[]{true, true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P2/src/x/y/z/p21"); >-// this.createFile( >-// "/P2/src/x/y/z/p21/XX21.js", >-// "package x.y.z.p21;\n"+ >-// "public class XX21 {\n"+ >-// "}"); >-// >-// this.createFolder("/P2/src/x/y/z/p22"); >-// this.createFile( >-// "/P2/src/x/y/z/p22/XX22.js", >-// "package x.y.z.p22;\n"+ >-// "public class XX22 {\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"x/y/z/p12/*"}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P3/src/x/y/z/p31"); >-// this.createFile( >-// "/P3/src/x/y/z/p31/XX31.js", >-// "package x.y.z.p31;\n"+ >-// "public class XX31 {\n"+ >-// "}"); >-// >-// this.createFolder("/P3/src/x/y/z/p32"); >-// this.createFile( >-// "/P3/src/x/y/z/p32/XX32.js", >-// "package x.y.z.p32;\n"+ >-// "public class XX32 {\n"+ >-// "}"); >-// >-// // create PX >-// this.createJavaProject( >-// "PX", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P2"}, >-// null, >-// null, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFile( >-// "/PX/src/X.js", >-// "public class X {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX11[TYPE_REF]{x.y.z.p11.XX11, x.y.z.p11, Lx.y.z.p11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX21[TYPE_REF]{x.y.z.p21.XX21, x.y.z.p21, Lx.y.z.p21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX22[TYPE_REF]{x.y.z.p22.XX22, x.y.z.p22, Lx.y.z.p22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX32[TYPE_REF]{x.y.z.p32.XX32, x.y.z.p32, Lx.y.z.p32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// this.deleteProject("PX"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction12() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/p11"); >-// this.createFile( >-// "/P1/src/p11/XX11.js", >-// "package p11;\n"+ >-// "public class XX11 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/p12"); >-// this.createFile( >-// "/P1/src/p12/XX12.js", >-// "package p12;\n"+ >-// "public class XX12 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P3", "/P1"}, >-// new String[][]{{}, {}}, >-// new String[][]{{"p31/*"}, {"p11/*"}}, >-// new boolean[]{true, true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P2/src/p21"); >-// this.createFile( >-// "/P2/src/p21/XX21.js", >-// "package p21;\n"+ >-// "public class XX21 {\n"+ >-// "}"); >-// >-// this.createFolder("/P2/src/p22"); >-// this.createFile( >-// "/P2/src/p22/XX22.js", >-// "package p22;\n"+ >-// "public class XX22 {\n"+ >-// "}"); >-// >-// // create P3 >-// this.createJavaProject( >-// "P3", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"p12/*"}}, >-// new boolean[]{true}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFolder("/P3/src/p31"); >-// this.createFile( >-// "/P3/src/p31/XX31.js", >-// "package p31;\n"+ >-// "public class XX31 {\n"+ >-// "}"); >-// >-// this.createFolder("/P3/src/p32"); >-// this.createFile( >-// "/P3/src/p32/XX32.js", >-// "package p32;\n"+ >-// "public class XX32 {\n"+ >-// "}"); >-// >-// // create PX >-// this.createJavaProject( >-// "PX", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P2"}, >-// null, >-// null, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// >-// this.createFile( >-// "/PX/src/X.js", >-// "public class X {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("PX", "src", "", "X.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + >-// "XX31[TYPE_REF]{p31.XX31, p31, Lp31.XX31;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" + >-// "XX11[TYPE_REF]{p11.XX11, p11, Lp11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + >-// "XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// this.deleteProject("P3"); >-// this.deleteProject("PX"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction13() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.WARNING); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestriction14() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.WARNING); >-// options.put(JavaScriptCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// options.put(JavaScriptCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaScriptCore.ENABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// "}"); >-// >-// this.createFolder("/P1/src/b"); >-// this.createFile( >-// "/P1/src/b/XX2.js", >-// "package b;\n"+ >-// "public class XX2 {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " XX\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "XX"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testAccessRestrictionX() throws Exception { >-// Hashtable oldOptions = JavaScriptCore.getOptions(); >-// try { >-// Hashtable options = new Hashtable(oldOptions); >-// options.put(JavaScriptCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaScriptCore.ERROR); >-// options.put(JavaScriptCore.CODEASSIST_RESTRICTIONS_CHECK, JavaScriptCore.DISABLED); >-// JavaScriptCore.setOptions(options); >-// >-// // create variable >-// JavaScriptCore.setClasspathVariables( >-// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// >-// this.createFolder("/P1/src/a"); >-// this.createFile( >-// "/P1/src/a/XX1.js", >-// "package a;\n"+ >-// "public class XX1 {\n"+ >-// " public void foo() {\n"+ >-// " }\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"a/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/YY.js", >-// "public class YY {\n"+ >-// " void foo() {\n"+ >-// " a.XX1 x;\n"+ >-// " x.fo\n"+ >-// " }\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "YY.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "x.fo"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "foo[FUNCTION_REF]{foo(), La.XX1;, ()V, foo, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// JavaScriptCore.setOptions(oldOptions); >-// } >-//} >-//public void testBug96950() throws Exception { >-// try { >-// // create variable >-//// JavaScriptCore.setClasspathVariables( >-//// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"}, >-//// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()}, >-//// null); >-// >-// // create P1 >-// this.createJavaProject( >-// "P1", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// "bin"); >-// this.createFile( >-// "/P1/src/Taratata.js", >-// "public class Taratata {\n"+ >-// "}"); >-// >-// // create P2 >-// this.createJavaProject( >-// "P2", >-// new String[]{"src"}, >-// new String[]{"JCL_LIB"}, >-// null, >-// null, >-// new String[]{"/P1"}, >-// new String[][]{{}}, >-// new String[][]{{"**/*"}}, >-// new boolean[]{false}, >-// "bin", >-// null, >-// null, >-// null, >-// "1.4"); >-// this.createFile( >-// "/P2/src/BreakRules.js", >-// "public class BreakRules {\n"+ >-// " Tara\n"+ >-// "}"); >-// >-// waitUntilIndexesReady(); >-// >-// // do completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit cu= getCompilationUnit("P2", "src", "", "BreakRules.js"); >-// >-// String str = cu.getSource(); >-// String completeBehind = "Tara"; >-// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >-// cu.codeComplete(cursorLocation, requestor); >-// >-// assertResults( >-// "Tara[POTENTIAL_METHOD_DECLARATION]{Tara, LBreakRules;, ()V, Tara, "+(R_DEFAULT + R_INTERESTING + R_NON_RESTRICTED) + "}", >-// requestor.getResults()); >-// } finally { >-// this.deleteProject("P1"); >-// this.deleteProject("P2"); >-// } >-//} >-/** >- * @bug 162621: [model][delta] Validation errors do not clear after replacing jar file >- * @test Ensures that changing an internal jar and refreshing takes the change into account >- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=162621" >- */ >-//public void testChangeInternalJar() throws CoreException, IOException { >-// >-// >-// IJavaScriptProject p = this.createJavaProject( >-// "P1", >-// new String[]{"/"}, >-// new String[]{}, >-// ""); >-// >-// >-// >-// >-// try { >-// // Create jar file with a class with 2 methods doXXX >-// String[] pathAndContents = new String[] { >-// "pack/Util.js", >-// "package pack;\n" + >-// "public class Util {\n" + >-// " public void doit2A(int x, int y) { }\n" + >-// " public void doit2B(int x) { }\n" + >-// "}\n" >-// }; >-// addLibrary(jarName, "b162621_src.zip", pathAndContents, JavaScriptCore.VERSION_1_4); >-// >-// // Wait a little bit to be sure file system is aware of zip file creation >-// try { >-// Thread.sleep(1000); >-// } >-// catch (InterruptedException ie) { >-// // skip >-// } >-// >-// // Create compilation unit in which completion occurs >-// String path = "/Completion/src/test/Test.js"; >-// String source = "package test;\n" + >-// "import pack.*;\n" + >-// "public class Test {\n" + >-// " public void foo() {\n" + >-// " Util test = new Util();\n" + >-// " test.doit2A(1, 2);\n" + >-// " }\n" + >-// "}\n"; >-// createFolder("/Completion/src/test"); >-// createFile(path, source); >-// >-// // first completion >-// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); >-// IJavaScriptUnit unit = getCompilationUnit(path); >-// String completeBehind = "test.do"; >-// int cursorLocation = source.lastIndexOf(completeBehind) + completeBehind.length(); >-// unit.codeComplete(cursorLocation, requestor); >-// assertResults( >-// "doit2A[FUNCTION_REF]{doit2A, Lpack.Util;, (II)V, doit2A, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + >-// "doit2B[FUNCTION_REF]{doit2B, Lpack.Util;, (I)V, doit2B, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", >-// requestor.getResults()); >-// >-// // change class file to add a third doXXX method and refresh >-// String projectLocation = this.currentProject.getProject().getLocation().toOSString(); >-// String jarPath = projectLocation + File.separator + jarName; >-// org.eclipse.wst.jsdt.core.tests.util.Util.createJar(new String[] { >-// "pack/Util.js", >-// "package pack;\n" + >-// "public class Util {\n" + >-// " public void doit2A(int x, int y) { }\n" + >-// " public void doit2B(int x) { }\n" + >-// " public void doit2C(int x) { }\n" + >-// "}\n" >-// }, jarPath, "1.4"); >-// this.currentProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); >-// >-// try { >-// Thread.sleep(1000); >-// } >-// catch (InterruptedException ie) { >-// // skip >-// } >-// >-// // second completion >-// requestor = new CompletionTestsRequestor2(); >-// unit.codeComplete(cursorLocation, requestor); >-// assertResults( >-// "doit2A[FUNCTION_REF]{doit2A, Lpack.Util;, (II)V, doit2A, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + >-// "doit2B[FUNCTION_REF]{doit2B, Lpack.Util;, (I)V, doit2B, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}\n" + >-// "doit2C[FUNCTION_REF]{doit2C, Lpack.Util;, (I)V, doit2C, "+(R_DEFAULT + R_CASE + R_INTERESTING + R_NON_RESTRICTED + R_NON_STATIC) + "}", >-// requestor.getResults()); >-// } finally { >-// removeLibraryEntry(this.currentProject, new Path(jarName)); >-// deleteFile(new File(jarName)); >-// } >-//} >-} >Index: src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java,v >retrieving revision 1.9 >diff -u -r1.9 JSDTModelTests.java >--- src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java 14 Jul 2009 13:47:25 -0000 1.9 >+++ src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java 19 Jul 2011 19:46:23 -0000 >@@ -47,147 +47,12 @@ > // Binding key tests > BindingKeyTests.class, > >-// // creation of method >-// CreateMembersTests.class, >-// >-// // Java Naming convention tests >-// JavaConventionTests.class, >-// >-// // Project & Root API unit tests >-// JavaProjectTests.class, >-// >-// // Compilation unit tests >-// CompilationUnitTests.class, >-// >-// // Source attachment tests >-// AttachSourceTests.class, >-// >-// // Attached javadoc tests >-// AttachedJavadocTests.class, >-// >-// // Java search tests >-// RunJavaSearchTests.class, >-// >-// // Working copy tests >+ // Working copy tests > WorkingCopyTests.class, >-// WorkingCopyNotInClasspathTests.class, >-// HierarchyOnWorkingCopiesTests.class, >-// >-// // test IJavaScriptModel >-// JavaModelTests.class, >-// >-// // tests to check the encoding >-// EncodingTests.class, >-// >-// // test class name with special names like names containing '$' >-// ClassNameTests.class, >-// >+ > // IBuffer tests > BufferTests.class, >-// >-// // Name lookup tests >-// NameLookupTests2.class, >-// >-// // Classpath and output location tests >-// ClasspathTests.class, >-// >-// // Delta tests >-// JavaElementDeltaTests.class, >-// ExternalJarDeltaTests.class, >-// >-// // Java element existence tests >-// ExistenceTests.class, >-// >-// // Support for "open on" feature tests >-// ResolveTests.class, >-// ResolveTests_1_5.class, >-// SelectionJavadocModelTests.class, >-// >-// // Support for completion tests >- RunCompletionModelTests.class, >-// >-// // Prefix and suffix tests >-// NamingConventionTests.class, >-// >-// // Code correction tests >-// CodeCorrectionTests.class, >-// >-// // Options tests >-// OptionTests.class, >-// >-// // Type hierarchy tests >-// TypeHierarchyTests.class, >-// TypeHierarchyNotificationTests.class, >-// TypeHierarchySerializationTests.class, >-// >-// // Resolve type tests >-// TypeResolveTests.class, >-// >-// // Reconciler tests >-// ReconcilerTests.class, >-// ReconcilerStatementsRecoveryTests.class, >-// >-// // Copy and move operation tests >-// CopyMoveElementsTests.class, >-// CopyMoveResourcesTests.class, >-// >-// // Rename tests >-// RenameTests.class, >-// >-// // Exclusion patterns tests >-// ExclusionPatternsTests.class, >-// >-// // Inclusion patterns tests >-// InclusionPatternsTests.class, >-// >-// // Access restrictions tests >-// AccessRestrictionsTests.class, >-// >-// // Signature tests >-// SignatureTests.class, >-// >-// // Variable initializers and container initializers tests >-// ClasspathInitializerTests.class, >-// >-// // Java Model Factory tests >-// FactoryTests.class, >-// >-// // Java Element persistence tests >-// MementoTests.class, >-// >-// // Java Element sorting tests >-// SortCompilationUnitElementsTests.class, >-// >-// // Package fragment root manipulation tests >-// RootManipulationsTests.class, >-// >-// // Owverflowing cache tests >-// OverflowingCacheTests.class, >-// >-// // Working copy owner tests >-// WorkingCopyOwnerTests.class, >-// >-// // Delete Java element tests >-// DeleteTests.class, >-// >-// // Local element tests >-// LocalElementTests.class, >-// >-// // Get source tests >-// GetSourceTests.class, >-// >-// // Create packages tests >-// CreatePackageTests.class, >-// >-// // Create compilation units tests >-// CreateCompilationUnitTests.class, >-// >-// // Create search participant tests >-// SearchParticipantTests.class, >-// >-// // Class file tests >-// ClassFileTests.class, >-// >+ > // Java-like extensions tests > JavaScriptLikeExtensionsTests.class, > >Index: src/org/eclipse/wst/jsdt/core/tests/model/RunCompletionModelTests.java >=================================================================== >RCS file: src/org/eclipse/wst/jsdt/core/tests/model/RunCompletionModelTests.java >diff -N src/org/eclipse/wst/jsdt/core/tests/model/RunCompletionModelTests.java >--- src/org/eclipse/wst/jsdt/core/tests/model/RunCompletionModelTests.java 26 Jun 2009 20:29:52 -0000 1.9 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,100 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2000, 2008 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 >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.wst.jsdt.core.tests.model; >- >-import java.lang.reflect.*; >-import java.util.ArrayList; >-import java.util.List; >- >-import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase; >- >-import junit.framework.Test; >-import junit.framework.TestSuite; >- >-public class RunCompletionModelTests extends junit.framework.TestCase { >- >- protected static final boolean ONLY_JAVADOC = "true".equals(System.getProperty("onlyJavadoc", "false")); >- >- public final static List COMPLETION_SUITES = new ArrayList(); >- static { >- if (!ONLY_JAVADOC) { >- if(false) COMPLETION_SUITES.add(CompletionTests.class); >- COMPLETION_SUITES.add(CompletionTests2.class); >- if(false) COMPLETION_SUITES.add(CompletionContextTests.class); >- if(false) COMPLETION_SUITES.add(CompletionWithMissingTypesTests.class); >- if(false) COMPLETION_SUITES.add(CompletionWithMissingTypesTests2.class); >- if(false) COMPLETION_SUITES.add(SnippetCompletionContextTests.class); >- } >- if(false) COMPLETION_SUITES.add(JavadocTypeCompletionModelTest.class); >- if(false) COMPLETION_SUITES.add(JavadocFieldCompletionModelTest.class); >- if(false) COMPLETION_SUITES.add(JavadocMethodCompletionModelTest.class); >- if(false) COMPLETION_SUITES.add(JavadocPackageCompletionModelTest.class); >- if(false) COMPLETION_SUITES.add(JavadocTextCompletionModelTest.class); >- if(false) COMPLETION_SUITES.add(JavadocBugsCompletionModelTest.class); >- if(false) COMPLETION_SUITES.add(JavadocCompletionContextTests.class); >- } >- >- public static Class[] getTestClasses() { >-// int size = COMPLETION_SUITES.size(); >-// if (!ONLY_JAVADOC) { >-// Class[] testClasses = new Class[size+1]; >-// COMPLETION_SUITES.toArray(testClasses); >-// testClasses[size] = CompletionTests2.class; >-// testClasses[size+1] = CompletionWithMissingTypesTests2.class; >-// if(false) testClasses[size+2] = SnippetCompletionTests.class; >-// if(false) testClasses[size+3] = SnippetCompletionTests_1_5.class; >-// return testClasses; >-// } >-// Class[] testClasses = new Class[size]; >- return (Class[])COMPLETION_SUITES.toArray(new Class[COMPLETION_SUITES.size()]); >- //return testClasses; >- } >- >- public RunCompletionModelTests(String name) { >- super(name); >- } >- >- public static Test suite() { >- TestSuite ts = new TestSuite(RunCompletionModelTests.class.getName()); >- >- // Store test classes with same "Completion"project >- AbstractJavaModelCompletionTests.COMPLETION_SUITES = new ArrayList(COMPLETION_SUITES); >- >- // Get all classes >- Class[] allClasses = getTestClasses(); >- >- // Reset forgotten subsets of tests >- TestCase.TESTS_PREFIX = null; >- TestCase.TESTS_NAMES = null; >- TestCase.TESTS_NUMBERS = null; >- TestCase.TESTS_RANGE = null; >- TestCase.RUN_ONLY_ID = null; >- >- // Add all tests suite of tests >- for (int i = 0, length = allClasses.length; i < length; i++) { >- Class testClass = allClasses[i]; >- >- // call the suite() method and add the resulting suite to the suite >- try { >- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$ >- Test suite = (Test) suiteMethod.invoke(null, new Object[0]); >- ts.addTest(suite); >- } catch (IllegalAccessException e) { >- e.printStackTrace(); >- } catch (InvocationTargetException e) { >- e.getTargetException().printStackTrace(); >- } catch (NoSuchMethodException e) { >- e.printStackTrace(); >- } >- } >- return ts; >- } >-} >#P org.eclipse.wst.jsdt.ui >Index: src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaMethodCompletionProposal.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaMethodCompletionProposal.java,v >retrieving revision 1.4.18.2 >diff -u -r1.4.18.2 JavaMethodCompletionProposal.java >--- src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaMethodCompletionProposal.java 19 Jul 2011 13:47:53 -0000 1.4.18.2 >+++ src/org/eclipse/wst/jsdt/internal/ui/text/java/JavaMethodCompletionProposal.java 19 Jul 2011 19:46:24 -0000 >@@ -198,8 +198,13 @@ > parameterCount= Signature.getParameterCount(fProposal.getSignature()) % 10; // we don't care about insane methods with >9 parameters > } else { > char[][] params = this.fProposal.getParamaterNames(); >- parameterList = CharOperation.concatWith(params, ','); >- parameterCount = params.length % 10; // we don't care about insane methods with >9 parameters >+ if(params != null) { >+ parameterList = CharOperation.concatWith(params, ','); >+ parameterCount = params.length % 10; // we don't care about insane methods with >9 parameters >+ } else { >+ parameterList = new char[0]; >+ parameterCount = 0; >+ } > } > > StringBuffer buf= new StringBuffer(name.length + 2 + parameterList.length); >Index: src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalLabelProvider.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/plugins/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalLabelProvider.java,v >retrieving revision 1.24.2.1 >diff -u -r1.24.2.1 CompletionProposalLabelProvider.java >--- src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalLabelProvider.java 1 Jul 2011 22:12:12 -0000 1.24.2.1 >+++ src/org/eclipse/wst/jsdt/ui/text/java/CompletionProposalLabelProvider.java 19 Jul 2011 19:46:24 -0000 >@@ -203,7 +203,7 @@ > buffer.append(','); > buffer.append(' '); > } >- if (parameterTypes[i].length > 0 & !Arrays.equals(Signature.ANY, parameterTypes[i])) { >+ if (parameterTypes[i] != null && parameterTypes[i].length > 0 && !Arrays.equals(Signature.ANY, parameterTypes[i])) { > buffer.append(parameterTypes[i]); > buffer.append(' '); > } >@@ -249,10 +249,8 @@ > > // return type > if (!methodProposal.isConstructor()) { >- // TODO remove SignatureUtil.fix83600 call when bugs are fixed >- char[] returnType= createTypeDisplayName(Signature.getReturnType(methodProposal.getSignature())); >- if (!Arrays.equals(Signature.ANY,returnType)) >- { >+ char[] returnType= methodProposal.getReturnType(); >+ if (returnType != null && returnType.length > 0 && !Arrays.equals(Signature.ANY,returnType)) { > nameBuffer.append(" "); //$NON-NLS-1$ > //@GINO: Anonymous UI Label > org.eclipse.wst.jsdt.internal.core.util.Util.insertTypeLabel( returnType, nameBuffer ); >@@ -260,11 +258,11 @@ > } > > // declaring type >- nameBuffer.append(" - "); //$NON-NLS-1$ > String declaringType= extractDeclaringTypeFQN(methodProposal); >- >- //@GINO: Anonymous UI Label >- org.eclipse.wst.jsdt.internal.core.util.Util.insertTypeLabel( declaringType, nameBuffer ); >+ if(declaringType != null) { >+ nameBuffer.append(" - "); //$NON-NLS-1$ >+ org.eclipse.wst.jsdt.internal.core.util.Util.insertTypeLabel( declaringType, nameBuffer ); >+ } > > return nameBuffer.toString(); > } >@@ -338,19 +336,21 @@ > private String extractDeclaringTypeFQN(CompletionProposal methodProposal) { > char[] declaringTypeSignature= methodProposal.getDeclarationSignature(); > char[] compUnit = methodProposal.getDeclarationTypeName(); >- IJavaScriptProject project = methodProposal.getJavaProject(); >- JsGlobalScopeContainerInitializer init = JSDScopeUtil.findLibraryInitializer(new Path(new String(compUnit)),project); >- if(init!=null) { >- String description = init.getDescription(new Path(new String(compUnit)),project); >- if( description!=null) return "[" + description + "]"; //$NON-NLS-1$ //$NON-NLS-2$ >- >+ if(compUnit != null) { >+ IJavaScriptProject project = methodProposal.getJavaProject(); >+ JsGlobalScopeContainerInitializer init = JSDScopeUtil.findLibraryInitializer(new Path(new String(compUnit)),project); >+ if(init!=null) { >+ String description = init.getDescription(new Path(new String(compUnit)),project); >+ if( description!=null) return "[" + description + "]"; //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ } >+ >+ String qualifedName = null; >+ if(declaringTypeSignature != null ) { >+ qualifedName = SignatureUtil.stripSignatureToFQN(String.valueOf(declaringTypeSignature)); > } > >- // special methods may not have a declaring type: methods defined on arrays etc. >- // TODO remove when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=84690 gets fixed >- if (declaringTypeSignature == null) >- return "java.lang.Object"; //$NON-NLS-1$ >- return SignatureUtil.stripSignatureToFQN(String.valueOf(declaringTypeSignature)); >+ return qualifedName; > } > > /** >#P org.eclipse.wst.jsdt.ui.tests >Index: src/org/eclipse/wst/jsdt/ui/tests/contentassist/ContentAssistTests.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jsdt/tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/contentassist/ContentAssistTests.java,v >retrieving revision 1.1.2.1 >diff -u -r1.1.2.1 ContentAssistTests.java >--- src/org/eclipse/wst/jsdt/ui/tests/contentassist/ContentAssistTests.java 1 Jul 2011 22:12:09 -0000 1.1.2.1 >+++ src/org/eclipse/wst/jsdt/ui/tests/contentassist/ContentAssistTests.java 19 Jul 2011 19:46:25 -0000 >@@ -103,29 +103,66 @@ > return new ContentAssistTestsSetup(ts); > } > >+ public void testFindFunctions_OtherFile_BeforeOpen_ExpressionStarted_0() throws Exception { >+ String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)", >+ "funcFive(Number paramOne, String paramTwo) String", "funcSix(paramOne, String paramTwo) Number", >+ "funcSeven(String paramOne, paramTwo) Number", "funcEight(paramOne) String", "funcNine(paramOne) Number"}}; >+ runProposalTest("test0_1.js", 0, 1, expectedProposals); >+ } >+ >+ public void testFindFunctions_OtherFile_BeforeOpen_ExpressionStarted_1() throws Exception { >+ String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)", >+ "funcFive(Number paramOne, String paramTwo) String", "funcSix(paramOne, String paramTwo) Number", >+ "funcSeven(String paramOne, paramTwo) Number", "funcEight(paramOne) String", "funcNine(paramOne) Number"}}; >+ runProposalTest("test0_1.js", 2, 4, expectedProposals); >+ } >+ >+ public void testFindFunctions_OtherFile_BeforeOpen_ExpressionStarted_2() throws Exception { >+ String[][] expectedProposals = new String[][] {{"funcTwo()", "funcThree(paramOne)"}}; >+ runProposalTest("test0_1.js", 4, 5, expectedProposals); >+ } >+ > public void testFindFunctions_ThisFile_EmptyLine() throws Exception { > String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)"}}; >- runProposalTest("test1.js", 16, 0, expectedProposals); >+ runProposalTest("test0_0.js", 55, 0, expectedProposals); > } > > public void testFindFunctions_ThisFile_ExpressionStarted_0() throws Exception { >- String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)"}}; >- runProposalTest("test1.js", 18, 3, expectedProposals); >+ String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)", >+ "funcFive(Number paramOne, String paramTwo) String", "funcSix(paramOne, String paramTwo) Number", >+ "funcSeven(String paramOne, paramTwo) Number"}}; >+ runProposalTest("test0_0.js", 57, 1, expectedProposals); > } > > public void testFindFunctions_ThisFile_ExpressionStarted_1() throws Exception { >+ String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)", >+ "funcFive(Number paramOne, String paramTwo) String", "funcSix(paramOne, String paramTwo) Number", >+ "funcSeven(String paramOne, paramTwo) Number"}}; >+ runProposalTest("test0_0.js", 59, 4, expectedProposals); >+ } >+ >+ public void testFindFunctions_ThisFile_ExpressionStarted_2() throws Exception { > String[][] expectedProposals = new String[][] {{"funcTwo()", "funcThree(paramOne)"}}; >- runProposalTest("test1.js", 20, 5, expectedProposals); >+ runProposalTest("test0_0.js", 61, 5, expectedProposals); > } > >- public void testFindFunctions_OtherFile_ExpressionStarted_0() throws Exception { >- String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)"}}; >- runProposalTest("test2.js", 0, 1, expectedProposals); >+ public void testFindFunctions_OtherFile_AftereOpen_ExpressionStarted_0() throws Exception { >+ String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)", >+ "funcFive(Number paramOne, String paramTwo) String", "funcSix(paramOne, String paramTwo) Number", >+ "funcSeven(String paramOne, paramTwo) Number", "funcEight(paramOne) String", "funcNine(paramOne) Number"}}; >+ runProposalTest("test0_1.js", 0, 1, expectedProposals); > } > >- public void testFindFunctions_OtherFile_ExpressionStarted_1() throws Exception { >+ public void testFindFunctions_OtherFile_AfterOpen_ExpressionStarted_1() throws Exception { >+ String[][] expectedProposals = new String[][] {{"funcOne()", "funcTwo()", "funcThree(paramOne)", "funcFour(paramOne, paramTwo)", >+ "funcFive(Number paramOne, String paramTwo) String", "funcSix(paramOne, String paramTwo) Number", >+ "funcSeven(String paramOne, paramTwo) Number", "funcEight(paramOne) String", "funcNine(paramOne) Number"}}; >+ runProposalTest("test0_1.js", 2, 4, expectedProposals); >+ } >+ >+ public void testFindFunctions_OtherFile_AfterOpen_ExpressionStarted_2() throws Exception { > String[][] expectedProposals = new String[][] {{"funcTwo()", "funcThree(paramOne)"}}; >- runProposalTest("test2.js", 2, 5, expectedProposals); >+ runProposalTest("test0_1.js", 4, 5, expectedProposals); > } > > public void testFindAnonymousTypeField_0() throws Exception { >@@ -148,79 +185,119 @@ > runProposalTest("test8_1.js", 8, 13, expectedProposals); > } > >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_0() throws Exception { >+ String[][] expectedProposals = new String[][] {{"Awesome(param1, param2)"}}; >+ runProposalTest("test2_1.js", 0, 6, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_1() throws Exception { >+ String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >+ runProposalTest("test2_1.js", 2, 6, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_2() throws Exception { >+ String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)"}}; >+ runProposalTest("test2_1.js", 4, 9, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_3() throws Exception { >+ String[][] expectedProposals = new String[][] {{"bar.foo.Class3(param1, param2, param3, param4)"}}; >+ runProposalTest("test2_1.js", 6, 10, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_4() throws Exception { >+ String[][] expectedProposals = new String[][] {{"bar.foo.Class3(param1, param2, param3, param4)"}}; >+ runProposalTest("test2_1.js", 8, 13, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_5() throws Exception { >+ String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >+ runProposalTest("test2_1.js", 10, 5, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_ExpressionStarted_6() throws Exception { >+ String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >+ runProposalTest("test2_1.js", 12, 9, expectedProposals); >+ } >+ > public void testFindConstructors_ThisFile_JustNew() throws Exception { > String[][] expectedProposals = new String[][] {{"Awesome(param1, param2)", "bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test3.js", 17, 4, expectedProposals); >+ runProposalTest("test2_0.js", 17, 4, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_0() throws Exception { > String[][] expectedProposals = new String[][] {{"Awesome(param1, param2)"}}; >- runProposalTest("test3.js", 19, 6, expectedProposals); >+ runProposalTest("test2_0.js", 19, 6, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_1() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test3.js", 21, 6, expectedProposals); >+ runProposalTest("test2_0.js", 21, 6, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_2() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)"}}; >- runProposalTest("test3.js", 23, 9, expectedProposals); >+ runProposalTest("test2_0.js", 23, 9, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_3() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test3.js", 25, 10, expectedProposals); >+ runProposalTest("test2_0.js", 25, 10, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_4() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test3.js", 27, 13, expectedProposals); >+ runProposalTest("test2_0.js", 27, 13, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_5() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test3.js", 29, 5, expectedProposals); >+ runProposalTest("test2_0.js", 29, 5, expectedProposals); > } > > public void testFindConstructors_ThisFile_ExpressionStarted_6() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test3.js", 31, 9, expectedProposals); >+ runProposalTest("test2_0.js", 31, 9, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ExpressionStarted_0() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ExpressionStarted_0() throws Exception { > String[][] expectedProposals = new String[][] {{"Awesome(param1, param2)"}}; >- runProposalTest("test4.js", 0, 6, expectedProposals); >+ runProposalTest("test2_1.js", 0, 6, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ExpressionStarted_1() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ExpressionStarted_1() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test4.js", 2, 6, expectedProposals); >+ runProposalTest("test2_1.js", 2, 6, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ExpressionStarted_2() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ExpressionStarted_2() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)"}}; >- runProposalTest("test4.js", 4, 9, expectedProposals); >+ runProposalTest("test2_1.js", 4, 9, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ExpressionStarted_3() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ExpressionStarted_3() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test4.js", 6, 10, expectedProposals); >+ runProposalTest("test2_1.js", 6, 10, expectedProposals); > } > > public void testFindConstructors_OtherFile_ExpressionStarted_4() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test4.js", 8, 13, expectedProposals); >+ runProposalTest("test2_1.js", 8, 13, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ExpressionStarted_5() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ExpressionStarted_5() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test4.js", 10, 5, expectedProposals); >+ runProposalTest("test2_1.js", 10, 5, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ExpressionStarted_6() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ExpressionStarted_6() throws Exception { > String[][] expectedProposals = new String[][] {{"bar.Class1(a, b)", "bar.Class2(c, d, e)", "bar.foo.Class3(param1, param2, param3, param4)"}}; >- runProposalTest("test4.js", 12, 9, expectedProposals); >+ runProposalTest("test2_1.js", 12, 9, expectedProposals); >+ } >+ >+ public void testFindConstructors_OtherFile_BeforeOpen_VarDeclaration_ExpressionStarted_0() throws Exception { >+ String[][] expectedProposals = new String[][] {{"MyClass1(a)", "MyClass2()"}}; >+ runProposalTest("test6.js", 0, 8, expectedProposals); > } > > public void testFindConstructors_ThisFile_VarDeclaration_ExpressionStarted_0() throws Exception { >@@ -228,7 +305,7 @@ > runProposalTest("test5.js", 7, 8, expectedProposals); > } > >- public void testFindConstructors_OtherFile_VarDeclaration_ExpressionStarted_0() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_VarDeclaration_ExpressionStarted_0() throws Exception { > String[][] expectedProposals = new String[][] {{"MyClass1(a)", "MyClass2()"}}; > runProposalTest("test6.js", 0, 8, expectedProposals); > } >@@ -243,16 +320,26 @@ > runProposalTest("test7.js", 10, 11, expectedProposals); > } > >+ public void testFindConstructors_OtherFile_BeforeOpen_ArrayReferenceDeclaration_ExpressionStarted_0() throws Exception { >+ String[][] expectedProposals = new String[][] {{"test.Foo(x, y, z)"}}; >+ runProposalTest("test9_1.js", 0, 7, expectedProposals); >+ } >+ > public void testFindConstructors_ThisFile_ArrayReferenceDeclaration_ExpressionStarted_0() throws Exception { > String[][] expectedProposals = new String[][] {{"test.Foo(x, y, z)"}}; > runProposalTest("test9_0.js", 7, 7, expectedProposals); > } > >- public void testFindConstructors_OtherFile_ArrayReferenceDeclaration_ExpressionStarted_0() throws Exception { >+ public void testFindConstructors_OtherFile_AfterOpen_ArrayReferenceDeclaration_ExpressionStarted_0() throws Exception { > String[][] expectedProposals = new String[][] {{"test.Foo(x, y, z)"}}; > runProposalTest("test9_1.js", 0, 7, expectedProposals); > } > >+ public void testFindFunctionOnType_OtherFile_ExpressionStarted_0() throws Exception { >+ String[][] expectedProposals = new String[][] {{"myFunc1(Number param1)", "foo"}}; >+ runProposalTest("test10_1.js", 1, 4, expectedProposals); >+ } >+ > /** > * <p>Run a proposal test by opening the given file and invoking content assist for > * each expected proposal count at the given line number and line character
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 352160
:
199703
|
199704
|
199712
|
199775
|
199862
|
199943