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 56841 Details for
Bug 152123
[1.5][assist] Code assist for references that require static imports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Better complementary fix
bug152123_import_010.txt (text/plain), 119.06 KB, created by
David Audel
on 2007-01-12 12:40:48 EST
(
hide
)
Description:
Better complementary fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-01-12 12:40:48 EST
Size:
119.06 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/core/CompletionRequestor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestor.java,v >retrieving revision 1.12 >diff -u -r1.12 CompletionRequestor.java >--- model/org/eclipse/jdt/core/CompletionRequestor.java 8 Dec 2006 15:05:32 -0000 1.12 >+++ model/org/eclipse/jdt/core/CompletionRequestor.java 12 Jan 2007 17:29:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2005 IBM Corporation and others. >+ * Copyright (c) 2004, 2007 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 >@@ -20,7 +20,7 @@ > * </p> > * <p> > * The code assist engine normally invokes methods on completion >- * requestors in the following sequence: >+ * requestor in the following sequence: > * <pre> > * requestor.beginReporting(); > * requestor.acceptContext(context); >@@ -158,7 +158,7 @@ > * Sets whether a proposal of a given kind with a required proposal > * of the given kind is allowed. > * >- * Currenlty only a subset of kinds support required proposals. To see what combinations >+ * Currently only a subset of kinds support required proposals. To see what combinations > * are supported you must look at {@link CompletionProposal#getRequiredProposals()} > * documentation. > * >@@ -196,7 +196,7 @@ > } > > /** >- * Returns the favorites references which are used to compute some completion proposals. >+ * Returns the favorite references which are used to compute some completion proposals. > * <p> > * A favorite reference is a qualified reference as it can be seen in an import statement.<br> > * e.g. <code>{"java.util.Arrays"}</code><br> >@@ -205,8 +205,12 @@ > * It can be a reference to a static method or field (as in a static import)<br> > * e.g. <code>{"java.util.Arrays.equals"}</code> > * </p> >- * >- * @return favorites imports >+ * <p> >+ * Currently only on demand type references (<code>"java.util.Arrays.*"</code>), >+ * references to a static method or a static field are used to compute completion proposals. >+ * Other kind of reference could be used in the future. >+ * </p> >+ * @return favorite imports > * > * @since 3.3 > */ >@@ -215,7 +219,7 @@ > } > > /** >- * Set the favorites references which will be used to compute some completion proposals. >+ * Set the favorite references which will be used to compute some completion proposals. > * A favorite reference is a qualified reference as it can be seen in an import statement.<br> > * > * @param favoriteImports >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.558 >diff -u -r1.558 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 27 Nov 2006 20:58:17 -0000 1.558 >+++ model/org/eclipse/jdt/core/JavaCore.java 12 Jan 2007 17:29:17 -0000 >@@ -935,7 +935,12 @@ > * @since 3.1 > */ > public static final String CODEASSIST_DISCOURAGED_REFERENCE_CHECK= PLUGIN_ID + ".codeComplete.discouragedReferenceCheck"; //$NON-NLS-1$ >- >+ /** >+ * Possible configurable option ID. >+ * @see #getDefaultOptions() >+ * @since 3.3 >+ */ >+ public static final String CODEASSIST_SUGGEST_STATIC_IMPORTS= PLUGIN_ID + ".codeComplete.suggestStaticImports"; //$NON-NLS-1$ > /** > * Possible configurable option ID. > * @see #getDefaultOptions() >@@ -2603,6 +2608,13 @@ > * - option id: "org.eclipse.jdt.core.codeComplete.camelCaseMatch" > * - possible values: { "enabled", "disabled" } > * - default: "enabled" >+ * >+ * CODEASSIST / Activate Suggestion of Static Import >+ * When enabled, completion proposals can contain static import >+ * pattern. >+ * - option id: "org.eclipse.jdt.core.codeComplete.suggestStaticImport" >+ * - possible values: { "enabled", "disabled" } >+ * - default: "enabled" > * </pre> > */ > public static Hashtable getDefaultOptions(){ >Index: model/org/eclipse/jdt/core/CompletionProposal.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionProposal.java,v >retrieving revision 1.36 >diff -u -r1.36 CompletionProposal.java >--- model/org/eclipse/jdt/core/CompletionProposal.java 16 Oct 2006 17:21:09 -0000 1.36 >+++ model/org/eclipse/jdt/core/CompletionProposal.java 12 Jan 2007 17:29:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2004, 2006 IBM Corporation and others. >+ * Copyright (c) 2004, 2007 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 >@@ -631,6 +631,101 @@ > public static final int JAVADOC_INLINE_TAG = 20; > > /** >+ * Completion is an import of reference to a static field. >+ * <p> >+ * The following additional context information is available >+ * for this kind of completion proposal at little extra cost: >+ * <ul> >+ * <li>{@link #getDeclarationSignature()} - >+ * the type signature of the type that declares the field that is imported >+ * </li> >+ * <li>{@link #getFlags()} - >+ * the modifiers flags (including ACC_ENUM) of the field that is imported >+ * </li> >+ * <li>{@link #getName()} - >+ * the simple name of the field that is imported >+ * </li> >+ * <li>{@link #getSignature()} - >+ * the type signature of the field's type (as opposed to the >+ * signature of the type in which the referenced field >+ * is declared) >+ * </li> >+ * <li>{@link #getAdditionalFlags()} - >+ * the completion flags (including ComletionFlags.StaticImport) >+ * of the proposed import >+ * </li> >+ * </ul> >+ * </p> >+ * >+ * @see #getKind() >+ * >+ * @since 3.3 >+ */ >+ public static final int FIELD_IMPORT = 21; >+ >+ /** >+ * Completion is an import of reference to a static method. >+ * <p> >+ * The following additional context information is available >+ * for this kind of completion proposal at little extra cost: >+ * <ul> >+ * <li>{@link #getDeclarationSignature()} - >+ * the type signature of the type that declares the method that is imported >+ * </li> >+ * <li>{@link #getFlags()} - >+ * the modifiers flags of the method that is imported >+ * </li> >+ * <li>{@link #getName()} - >+ * the simple name of the method that is imported >+ * </li> >+ * <li>{@link #getSignature()} - >+ * the method signature of the method that is imported >+ * </li> >+ * <li>{@link #getAdditionalFlags()} - >+ * the completion flags (including ComletionFlags.StaticImport) >+ * of the proposed import >+ * </li> >+ * </ul> >+ * </p> >+ * >+ * @see #getKind() >+ * >+ * @since 3.3 >+ */ >+ public static final int METHOD_IMPORT = 22; >+ >+ /** >+ * Completion is an import of reference to a type. >+ * Only reference to reference types are allowed. >+ * <p> >+ * The following additional context information is available >+ * for this kind of completion proposal at little extra cost: >+ * <ul> >+ * <li>{@link #getDeclarationSignature()} - >+ * the dot-based package name of the package that contains >+ * the type that is imported >+ * </li> >+ * <li>{@link #getSignature()} - >+ * the type signature of the type that is imported >+ * </li> >+ * <li>{@link #getFlags()} - >+ * the modifiers flags (including Flags.AccInterface, AccEnum, >+ * and AccAnnotation) of the type that is imported >+ * </li> >+ * <li>{@link #getAdditionalFlags()} - >+ * the completion flags (including ComletionFlags.StaticImport) >+ * of the proposed import >+ * </li> >+ * </ul> >+ * </p> >+ * >+ * @see #getKind() >+ * >+ * @since 3.3 >+ */ >+ public static final int TYPE_IMPORT = 23; >+ >+ /** > * First valid completion kind. > * > * @since 3.1 >@@ -642,7 +737,7 @@ > * > * @since 3.1 > */ >- protected static final int LAST_KIND = JAVADOC_INLINE_TAG; >+ protected static final int LAST_KIND = TYPE_IMPORT; > > /** > * Kind of completion request. >@@ -732,7 +827,7 @@ > > /** > * Array of required completion proposals, or <code>null</code> if none. >- * The proposal can not be applied if the required prooposals aren't applied. >+ * The proposal can not be applied if the required proposals aren't applied. > * Defaults to <code>null</code>. > */ > private CompletionProposal[] requiredProposals; >@@ -745,6 +840,13 @@ > private int flags = Flags.AccDefault; > > /** >+ * Completion flags relevant in the context, or >+ * <code>CompletionFlags.Default</code> if none. >+ * Defaults to <code>CompletionFlags.Default</code>. >+ */ >+ private int additionalFlags = CompletionFlags.Default; >+ >+ /** > * Parameter names (for method completions), or > * <code>null</code> if none. Lazily computed. > * Defaults to <code>null</code>. >@@ -804,6 +906,56 @@ > } > > /** >+ * Returns the completion flags relevant in the context, or >+ * <code>CompletionFlags.Default</code> if none. >+ * <p> >+ * This field is available for the following kinds of >+ * completion proposals: >+ * <ul> >+ * <li><code>FIELD_IMPORT</code> - completion flags >+ * of the attribute that is referenced. Completion flags for >+ * this proposal kind can only include <code>CompletionFlags.StaticImport</code></li> >+ * <li><code>METHOD_IMPORT</code> - completion flags >+ * of the attribute that is referenced. Completion flags for >+ * this proposal kind can only include <code>CompletionFlags.StaticImport</code></li> >+ * <li><code>TYPE_IMPORT</code> - completion flags >+ * of the attribute that is referenced. Completion flags for >+ * this proposal kind can only include <code>CompletionFlags.StaticImport</code></li> >+ * </ul> >+ * For other kinds of completion proposals, this method returns >+ * <code>CompletionFlags.Default</code>. >+ * </p> >+ * >+ * @return the completion flags, or >+ * <code>CompletionFlags.Default</code> if none >+ * @see CompletionFlags >+ * >+ * @since 3.3 >+ */ >+ public int getAdditionalFlags() { >+ return this.additionalFlags; >+ } >+ >+ /** >+ * Sets the completion flags relevant in the context. >+ * <p> >+ * If not set, defaults to none. >+ * </p> >+ * <p> >+ * The completion engine creates instances of this class and sets >+ * its properties; this method is not intended to be used by other clients. >+ * </p> >+ * >+ * @param additionalFlags the completion flags, or >+ * <code>CompletionFlags.Default</code> if none >+ * >+ * @since 3.3 >+ */ >+ public void setAdditionalFlags(int additionalFlags) { >+ this.additionalFlags = additionalFlags; >+ } >+ >+ /** > * Returns the kind of completion being proposed. > * <p> > * The set of different kinds of completion proposals is >@@ -1057,16 +1209,22 @@ > * of the annotation that declares the attribute that is referenced</li> > * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - type signature > * of the type that is being subclassed or implemented</li> >- * <li><code>FIELD_REF</code> - type signature >+ * <li><code>FIELD_IMPORT</code> - type signature >+ * of the type that declares the field that is imported</li> >+ * <li><code>FIELD_REF</code> - type signature > * of the type that declares the field that is referenced</li> >- * <li><code>METHOD_REF</code> - type signature >+ * <li><code>METHOD_IMPORT</code> - type signature >+ * of the type that declares the method that is imported</li> >+ * <li><code>METHOD_REF</code> - type signature > * of the type that declares the method that is referenced</li> > * <li><code>METHOD_DECLARATION</code> - type signature > * of the type that declares the method that is being > * implemented or overridden</li> > * <li><code>PACKAGE_REF</code> - dot-based package > * name of the package that is referenced</li> >- * <li><code>TYPE_REF</code> - dot-based package >+ * <li><code>TYPE_IMPORT</code> - dot-based package >+ * name of the package containing the type that is imported</li> >+ * <li><code>TYPE_REF</code> - dot-based package > * name of the package containing the type that is referenced</li> > * <li><code>POTENTIAL_METHOD_DECLARATION</code> - type signature > * of the type that declares the method that is being created</li> >@@ -1156,11 +1314,13 @@ > * completion proposals: > * <ul> > * <li><code>ANNOTATION_ATTRIBUT_REF</code> - the name of the attribute</li> >- * <li><code>FIELD_REF</code> - the name of the field</li> >+ * <li><code>FIELD_IMPORT</code> - the name of the field</li> >+ * <li><code>FIELD_REF</code> - the name of the field</li> > * <li><code>KEYWORD</code> - the keyword</li> > * <li><code>LABEL_REF</code> - the name of the label</li> > * <li><code>LOCAL_VARIABLE_REF</code> - the name of the local variable</li> >- * <li><code>METHOD_REF</code> - the name of the method (the type simple name for constructor)</li> >+ * <li><code>METHOD_IMPORT</code> - the name of the method</li> >+ * <li><code>METHOD_REF</code> - the name of the method (the type simple name for constructor)</li> > * <li><code>METHOD_DECLARATION</code> - the name of the method (the type simple name for constructor)</li> > * <li><code>VARIABLE_DECLARATION</code> - the name of the variable</li> > * <li><code>POTENTIAL_METHOD_DECLARATION</code> - the name of the method</li> >@@ -1208,14 +1368,20 @@ > * of the referenced attribute's type</li> > * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - method signature > * of the constructor that is being invoked</li> >- * <li><code>FIELD_REF</code> - the type signature >+ * <li><code>FIELD_IMPORT</code> - the type signature >+ * of the referenced field's type</li> >+ * <li><code>FIELD_REF</code> - the type signature > * of the referenced field's type</li> > * <li><code>LOCAL_VARIABLE_REF</code> - the type signature > * of the referenced local variable's type</li> >- * <li><code>METHOD_REF</code> - method signature >+ * <li><code>METHOD_IMPORT</code> - method signature >+ * of the method that is imported</li> >+ * <li><code>METHOD_REF</code> - method signature > * of the method that is referenced</li> > * <li><code>METHOD_DECLARATION</code> - method signature > * of the method that is being implemented or overridden</li> >+ * <li><code>TYPE_IMPORT</code> - type signature >+ * of the type that is imported</li> > * <li><code>TYPE_REF</code> - type signature > * of the type that is referenced</li> > * <li><code>VARIABLE_DECLARATION</code> - the type signature >@@ -1306,10 +1472,10 @@ > // * 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 instanciation ("new X(){}") if it is an anonymous type</li> >+// * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li> > // * <li><code>METHOD_REF</code> - the dot-based type name > // * of the type that declares the method that is referenced >-// * or an anonymous type instanciation ("new X(){}") if it is an anonymous type</li> >+// * or an anonymous type instantiation ("new X(){}") if it is an anonymous type</li> > // * <li><code>METHOD_DECLARATION</code> - the dot-based type name > // * of the type that declares the method that is being > // * implemented or overridden</li> >@@ -1437,7 +1603,7 @@ > // } > // > // /** >-// * Returns the parameter type names without teh package fragment of >+// * Returns the parameter type names without the package fragment of > // * the method relevant in the context, or <code>null</code> if none. > // * <p> > // * This field is available for the following kinds of >@@ -1512,23 +1678,33 @@ > * of the attribute that is referenced; > * <li><code>ANONYMOUS_CLASS_DECLARATION</code> - modifier flags > * of the constructor that is referenced</li> >- * <li><code>FIELD_REF</code> - modifier flags >+ * <li><code>FIELD_IMPORT</code> - modifier flags >+ * of the field that is imported.</li> >+ * <li><code>FIELD_REF</code> - modifier flags > * of the field that is referenced; > * <code>Flags.AccEnum</code> can be used to recognize > * references to enum constants > * </li> > * <li><code>KEYWORD</code> - modifier flag >- * corrresponding to the modifier keyword</li> >+ * corresponding to the modifier keyword</li> > * <li><code>LOCAL_VARIABLE_REF</code> - modifier flags > * of the local variable that is referenced</li> >+ * <li><code>METHOD_IMPORT</code> - modifier flags >+ * of the method that is imported; >+ * </li> > * <li><code>METHOD_REF</code> - modifier flags > * of the method that is referenced; > * <code>Flags.AccAnnotation</code> can be used to recognize > * references to annotation type members > * </li> >- * <li><code>METHOD_DECLARATION</code> - modifier flags >+ * <li><code>METHOD_DECLARATION</code> - modifier flags > * for the method that is being implemented or overridden</li> >- * <li><code>TYPE_REF</code> - modifier flags >+ * <li><code>TYPE_IMPORT</code> - modifier flags >+ * of the type that is imported; <code>Flags.AccInterface</code> >+ * can be used to recognize references to interfaces, >+ * <code>Flags.AccEnum</code> enum types, >+ * and <code>Flags.AccAnnotation</code> annotation types</li> >+ * <li><code>TYPE_REF</code> - modifier flags > * of the type that is referenced; <code>Flags.AccInterface</code> > * can be used to recognize references to interfaces, > * <code>Flags.AccEnum</code> enum types, >@@ -1571,7 +1747,7 @@ > /** > * Returns the required completion proposals. > * The proposal can be apply only if these required completion proposals are also applied. >- * If the required proposal aren't applied the completion could create complations problems. >+ * If the required proposal aren't applied the completion could create completion problems. > * > * <p> > * This field is available for the following kinds of >@@ -1580,11 +1756,15 @@ > * <li><code>FIELD_REF</code> - The allowed required proposals for this kind are: > * <ul> > * <li><code>TYPE_REF</code></li> >+ * <li><code>TYPE_IMPORT</code></li> >+ * <li><code>FIELD_IMPORT</code></li> > * </ul> > * </li> > * <li><code>METHOD_REF</code> - The allowed required proposals for this kind are: > * <ul> > * <li><code>TYPE_REF</code></li> >+ * <li><code>TYPE_IMPORT</code></li> >+ * <li><code>METHOD_IMPORT</code></li> > * </ul> > * </li> > * </ul> >@@ -1837,6 +2017,15 @@ > case CompletionProposal.JAVADOC_VALUE_REF : > buffer.append("JAVADOC_VALUE_REF"); //$NON-NLS-1$ > break; >+ case CompletionProposal.FIELD_IMPORT : >+ buffer.append("FIELD_IMPORT"); //$NON-NLS-1$ >+ break; >+ case CompletionProposal.METHOD_IMPORT : >+ buffer.append("METHOD_IMPORT"); //$NON-NLS-1$ >+ break; >+ case CompletionProposal.TYPE_IMPORT : >+ buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ >+ break; > default : > buffer.append("PROPOSAL"); //$NON-NLS-1$ > break; >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.349 >diff -u -r1.349 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 11 Jan 2007 15:30:24 -0000 1.349 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 12 Jan 2007 17:29:19 -0000 >@@ -1583,6 +1583,7 @@ > defaultOptionsMap.put(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaCore.ENABLED); > defaultOptionsMap.put(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaCore.DISABLED); > defaultOptionsMap.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED); >+ defaultOptionsMap.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); > > // Time out for parameter names > defaultOptionsMap.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$ >Index: model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java,v >retrieving revision 1.37 >diff -u -r1.37 JavaCorePreferenceInitializer.java >--- model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java 25 Apr 2006 18:25:27 -0000 1.37 >+++ model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java 12 Jan 2007 17:29:18 -0000 >@@ -86,6 +86,7 @@ > defaultOptionsMap.put(JavaCore.CODEASSIST_FORBIDDEN_REFERENCE_CHECK, JavaCore.ENABLED); > defaultOptionsMap.put(JavaCore.CODEASSIST_DISCOURAGED_REFERENCE_CHECK, JavaCore.DISABLED); > defaultOptionsMap.put(JavaCore.CODEASSIST_CAMEL_CASE_MATCH, JavaCore.ENABLED); >+ defaultOptionsMap.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); > > // Time out for parameter names > defaultOptionsMap.put(JavaCore.TIMEOUT_FOR_PARAMETER_NAME_FROM_ATTACHED_JAVADOC, "50"); //$NON-NLS-1$ >Index: codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistOptions.java,v >retrieving revision 1.25 >diff -u -r1.25 AssistOptions.java >--- codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistOptions.java 28 Mar 2006 20:30:02 -0000 1.25 >+++ codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistOptions.java 12 Jan 2007 17:29:16 -0000 >@@ -46,6 +46,8 @@ > "org.eclipse.jdt.core.codeComplete.discouragedReferenceCheck"; //$NON-NLS-1$ > public static final String OPTION_CamelCaseMatch = > "org.eclipse.jdt.core.codeComplete.camelCaseMatch"; //$NON-NLS-1$ >+ public static final String OPTION_SuggestStaticImports = >+ "org.eclipse.jdt.core.codeComplete.suggestStaticImports"; //$NON-NLS-1$ > > public static final String ENABLED = "enabled"; //$NON-NLS-1$ > public static final String DISABLED = "disabled"; //$NON-NLS-1$ >@@ -56,6 +58,7 @@ > public boolean checkDiscouragedReference = false; > public boolean forceImplicitQualification = false; > public boolean camelCaseMatch = true; >+ public boolean suggestStaticImport = true; > public char[][] fieldPrefixes = null; > public char[][] staticFieldPrefixes = null; > public char[][] localPrefixes = null; >@@ -206,6 +209,13 @@ > this.checkDeprecation = false; > } > } >+ if ((optionValue = optionsMap.get(OPTION_SuggestStaticImports)) != null) { >+ if (ENABLED.equals(optionValue)) { >+ this.suggestStaticImport = true; >+ } else if (DISABLED.equals(optionValue)) { >+ this.suggestStaticImport = false; >+ } >+ } > } > > private char[][] splitAndTrimOn(char divider, char[] arrayToSplit) { >Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v >retrieving revision 1.313 >diff -u -r1.313 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 8 Dec 2006 15:05:32 -0000 1.313 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 12 Jan 2007 17:29:16 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 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,6 +15,7 @@ > import java.util.Map; > > import org.eclipse.jdt.core.CompletionContext; >+import org.eclipse.jdt.core.CompletionFlags; > import org.eclipse.jdt.core.CompletionProposal; > import org.eclipse.jdt.core.CompletionRequestor; > import org.eclipse.jdt.core.Flags; >@@ -214,6 +215,11 @@ > > private final static char[] VARARGS = "...".toCharArray(); //$NON-NLS-1$ > >+ private final static char[] IMPORT = "import".toCharArray(); //$NON-NLS-1$ >+ private final static char[] STATIC = "static".toCharArray(); //$NON-NLS-1$ >+ private final static char[] ON_DEMAND = ".*".toCharArray(); //$NON-NLS-1$ >+ private final static char[] IMPORT_END = ";\n".toCharArray(); //$NON-NLS-1$ >+ > private final static int SUPERTYPE = 1; > private final static int SUBTYPE = 2; > >@@ -3360,8 +3366,6 @@ > > fieldsFound.add(new Object[]{field, receiverType}); > >- char[] completion = CharOperation.concat(typeName, field.name, '.'); >- > int relevance = computeBaseRelevance(); > relevance += computeRelevanceForInterestingProposal(field); > if (fieldName != null) relevance += computeRelevanceForCaseMatching(fieldName, field.name); >@@ -3369,24 +3373,92 @@ > relevance += computeRelevanceForStatic(true, true); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); > >+ CompilationUnitDeclaration cu = this.unitScope.referenceContext; >+ int importStart = cu.types[0].declarationSourceStart; >+ int importEnd = importStart; >+ > this.noProposal = false; > >- if (!this.isIgnored(CompletionProposal.FIELD_REF)) { >- CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition); >- proposal.setDeclarationSignature(getSignature(field.declaringClass)); >- 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.setName(field.name); >- proposal.setCompletion(completion); >- proposal.setFlags(field.modifiers); >- proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >- proposal.setRelevance(relevance); >- this.requestor.accept(proposal); >- if(DEBUG) { >- this.printDebug(proposal); >+ if (this.compilerOptions.complianceLevel < ClassFileConstants.JDK1_5 || >+ !this.options.suggestStaticImport) { >+ if (!this.isIgnored(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_IMPORT)) { >+ char[] completion = CharOperation.concat(receiverType.sourceName, field.name, '.'); >+ >+ CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition); >+ proposal.setDeclarationSignature(getSignature(field.declaringClass)); >+ 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.setName(field.name); >+ proposal.setCompletion(completion); >+ proposal.setFlags(field.modifiers); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ >+ char[] typeImportCompletion = createImportCharArray(typeName, false, false); >+ >+ CompletionProposal typeImportProposal = this.createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition); >+ typeImportProposal.nameLookup = this.nameEnvironment.nameLookup; >+ typeImportProposal.completionEngine = this; >+ char[] packageName = receiverType.qualifiedPackageName(); >+ typeImportProposal.setDeclarationSignature(packageName); >+ typeImportProposal.setSignature(getSignature(receiverType)); >+ typeImportProposal.setPackageName(packageName); >+ typeImportProposal.setTypeName(receiverType.qualifiedSourceName()); >+ typeImportProposal.setCompletion(typeImportCompletion); >+ typeImportProposal.setFlags(receiverType.modifiers); >+ typeImportProposal.setAdditionalFlags(CompletionFlags.Default); >+ typeImportProposal.setReplaceRange(importStart - this.offset, importEnd - this.offset); >+ typeImportProposal.setRelevance(relevance); >+ >+ proposal.setRequiredProposals(new CompletionProposal[]{typeImportProposal}); >+ >+ this.requestor.accept(proposal); >+ if(DEBUG) { >+ this.printDebug(proposal); >+ } >+ } >+ } else { >+ if (!this.isIgnored(CompletionProposal.FIELD_REF, CompletionProposal.FIELD_IMPORT)) { >+ char[] completion = field.name; >+ >+ CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition); >+ proposal.setDeclarationSignature(getSignature(field.declaringClass)); >+ 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.setName(field.name); >+ proposal.setCompletion(completion); >+ proposal.setFlags(field.modifiers); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ >+ char[] fieldImportCompletion = createImportCharArray(CharOperation.concat(typeName, field.name, '.'), true, false); >+ >+ CompletionProposal fieldImportProposal = this.createProposal(CompletionProposal.FIELD_IMPORT, this.actualCompletionPosition); >+ fieldImportProposal.setDeclarationSignature(getSignature(field.declaringClass)); >+ 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.setName(field.name); >+ fieldImportProposal.setCompletion(fieldImportCompletion); >+ fieldImportProposal.setFlags(field.modifiers); >+ fieldImportProposal.setAdditionalFlags(CompletionFlags.StaticImport); >+ fieldImportProposal.setReplaceRange(importStart - this.offset, importEnd - this.offset); >+ fieldImportProposal.setRelevance(relevance); >+ >+ proposal.setRequiredProposals(new CompletionProposal[]{fieldImportProposal}); >+ >+ this.requestor.accept(proposal); >+ if(DEBUG) { >+ this.printDebug(proposal); >+ } > } > } > } >@@ -4681,6 +4753,32 @@ > MethodBinding otherMethod = (MethodBinding) other[0]; > > if (method == otherMethod) continue next; >+ >+ if (CharOperation.equals(method.selector, otherMethod.selector, true)) { >+ if (lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)) { >+ continue next; >+ } >+ } >+ } >+ >+ boolean proposeStaticImport = !(this.compilerOptions.complianceLevel < ClassFileConstants.JDK1_5) && >+ this.options.suggestStaticImport; >+ >+ boolean isAlreadyImported = false; >+ if (!proposeStaticImport) { >+ if(!this.importCachesInitialized) { >+ this.initializeImportCaches(); >+ } >+ for (int j = 0; j < this.importCacheCount; j++) { >+ char[][] importName = this.importsCache[j]; >+ if(CharOperation.equals(receiverType.sourceName, importName[0])) { >+ if (!CharOperation.equals(typeName, importName[1])) { >+ continue next; >+ } else { >+ isAlreadyImported = true; >+ } >+ } >+ } > } > > methodsFound.add(new Object[]{method, receiverType}); >@@ -4718,8 +4816,6 @@ > completion = CharOperation.concat(method.selector, new char[] { '(', ')' }); > } > >- completion = CharOperation.concat(typeName, completion, '.'); >- > int relevance = computeBaseRelevance(); > relevance += computeRelevanceForInterestingProposal(); > if (methodName != null) relevance += computeRelevanceForCaseMatching(methodName, method.selector); >@@ -4728,32 +4824,138 @@ > relevance += computeRelevanceForQualification(true); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); > >+ CompilationUnitDeclaration cu = this.unitScope.referenceContext; >+ int importStart = cu.types[0].declarationSourceStart; >+ int importEnd = importStart; > > this.noProposal = false; >- // Standard proposal >- if(!this.isIgnored(CompletionProposal.METHOD_REF)) { >- CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); >- proposal.setDeclarationSignature(getSignature(method.declaringClass)); >- proposal.setSignature(getSignature(method)); >- MethodBinding original = method.original(); >- if(original != method) { >- proposal.setOriginalSignature(getSignature(original)); >- } >- proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); >- proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); >- proposal.setParameterPackageNames(parameterPackageNames); >- proposal.setParameterTypeNames(parameterTypeNames); >- proposal.setPackageName(method.returnType.qualifiedPackageName()); >- proposal.setTypeName(method.returnType.qualifiedSourceName()); >- proposal.setName(method.selector); >- proposal.setCompletion(completion); >- proposal.setFlags(method.modifiers); >- proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >- proposal.setRelevance(relevance); >- if(parameterNames != null) proposal.setParameterNames(parameterNames); >- this.requestor.accept(proposal); >- if(DEBUG) { >- this.printDebug(proposal); >+ >+ if (!proposeStaticImport) { >+ if (isAlreadyImported) { >+ if (!isIgnored(CompletionProposal.METHOD_REF)) { >+ completion = CharOperation.concat(receiverType.sourceName, completion, '.'); >+ >+ CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); >+ proposal.setDeclarationSignature(getSignature(method.declaringClass)); >+ proposal.setSignature(getSignature(method)); >+ MethodBinding original = method.original(); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } >+ proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); >+ proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); >+ proposal.setParameterPackageNames(parameterPackageNames); >+ proposal.setParameterTypeNames(parameterTypeNames); >+ proposal.setPackageName(method.returnType.qualifiedPackageName()); >+ proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setName(method.selector); >+ proposal.setCompletion(completion); >+ proposal.setFlags(method.modifiers); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ if(parameterNames != null) proposal.setParameterNames(parameterNames); >+ >+ this.requestor.accept(proposal); >+ if(DEBUG) { >+ this.printDebug(proposal); >+ } >+ } >+ } else if (!this.isIgnored(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_IMPORT)) { >+ completion = CharOperation.concat(receiverType.sourceName, completion, '.'); >+ >+ CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); >+ proposal.setDeclarationSignature(getSignature(method.declaringClass)); >+ proposal.setSignature(getSignature(method)); >+ MethodBinding original = method.original(); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } >+ proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); >+ proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); >+ proposal.setParameterPackageNames(parameterPackageNames); >+ proposal.setParameterTypeNames(parameterTypeNames); >+ proposal.setPackageName(method.returnType.qualifiedPackageName()); >+ proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setName(method.selector); >+ proposal.setCompletion(completion); >+ proposal.setFlags(method.modifiers); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ if(parameterNames != null) proposal.setParameterNames(parameterNames); >+ >+ char[] typeImportCompletion = createImportCharArray(typeName, false, false); >+ >+ CompletionProposal typeImportProposal = this.createProposal(CompletionProposal.TYPE_IMPORT, this.actualCompletionPosition); >+ typeImportProposal.nameLookup = this.nameEnvironment.nameLookup; >+ typeImportProposal.completionEngine = this; >+ char[] packageName = receiverType.qualifiedPackageName(); >+ typeImportProposal.setDeclarationSignature(packageName); >+ typeImportProposal.setSignature(getSignature(receiverType)); >+ typeImportProposal.setPackageName(packageName); >+ typeImportProposal.setTypeName(receiverType.qualifiedSourceName()); >+ typeImportProposal.setCompletion(typeImportCompletion); >+ typeImportProposal.setFlags(receiverType.modifiers); >+ typeImportProposal.setAdditionalFlags(CompletionFlags.Default); >+ typeImportProposal.setReplaceRange(importStart - this.offset, importEnd - this.offset); >+ typeImportProposal.setRelevance(relevance); >+ >+ proposal.setRequiredProposals(new CompletionProposal[]{typeImportProposal}); >+ >+ this.requestor.accept(proposal); >+ if(DEBUG) { >+ this.printDebug(proposal); >+ } >+ } >+ } else { >+ if (!this.isIgnored(CompletionProposal.METHOD_REF, CompletionProposal.METHOD_IMPORT)) { >+ CompletionProposal proposal = this.createProposal(CompletionProposal.METHOD_REF, this.actualCompletionPosition); >+ proposal.setDeclarationSignature(getSignature(method.declaringClass)); >+ proposal.setSignature(getSignature(method)); >+ MethodBinding original = method.original(); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } >+ proposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); >+ proposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); >+ proposal.setParameterPackageNames(parameterPackageNames); >+ proposal.setParameterTypeNames(parameterTypeNames); >+ proposal.setPackageName(method.returnType.qualifiedPackageName()); >+ proposal.setTypeName(method.returnType.qualifiedSourceName()); >+ proposal.setName(method.selector); >+ proposal.setCompletion(completion); >+ proposal.setFlags(method.modifiers); >+ proposal.setReplaceRange(this.startPosition - this.offset, this.endPosition - this.offset); >+ proposal.setRelevance(relevance); >+ if(parameterNames != null) proposal.setParameterNames(parameterNames); >+ >+ char[] methodImportCompletion = createImportCharArray(CharOperation.concat(typeName, method.selector, '.'), true, false); >+ >+ CompletionProposal methodImportProposal = this.createProposal(CompletionProposal.METHOD_IMPORT, this.actualCompletionPosition); >+ methodImportProposal.setDeclarationSignature(getSignature(method.declaringClass)); >+ methodImportProposal.setSignature(getSignature(method)); >+ if(original != method) { >+ proposal.setOriginalSignature(getSignature(original)); >+ } >+ methodImportProposal.setDeclarationPackageName(method.declaringClass.qualifiedPackageName()); >+ methodImportProposal.setDeclarationTypeName(method.declaringClass.qualifiedSourceName()); >+ methodImportProposal.setParameterPackageNames(parameterPackageNames); >+ methodImportProposal.setParameterTypeNames(parameterTypeNames); >+ methodImportProposal.setPackageName(method.returnType.qualifiedPackageName()); >+ methodImportProposal.setTypeName(method.returnType.qualifiedSourceName()); >+ methodImportProposal.setName(method.selector); >+ methodImportProposal.setCompletion(methodImportCompletion); >+ methodImportProposal.setFlags(method.modifiers); >+ methodImportProposal.setAdditionalFlags(CompletionFlags.StaticImport); >+ methodImportProposal.setReplaceRange(importStart - this.offset, importEnd - this.offset); >+ methodImportProposal.setRelevance(relevance); >+ if(parameterNames != null) methodImportProposal.setParameterNames(parameterNames); >+ >+ proposal.setRequiredProposals(new CompletionProposal[]{methodImportProposal}); >+ >+ this.requestor.accept(proposal); >+ if(DEBUG) { >+ this.printDebug(proposal); >+ } > } > } > >@@ -5326,6 +5528,17 @@ > createType(type, completion); > } > } >+ private char[] createImportCharArray(char[] importedElement, boolean isStatic, boolean onDemand) { >+ char[] result = IMPORT; >+ if (isStatic) { >+ result = CharOperation.concat(result, STATIC, ' '); >+ } >+ result = CharOperation.concat(result, importedElement, ' '); >+ if (onDemand) { >+ result = CharOperation.concat(result, ON_DEMAND); >+ } >+ return CharOperation.concat(result, IMPORT_END); >+ } > private void createMethod(MethodBinding method, char[][] parameterPackageNames, char[][] parameterTypeNames, char[][] parameterNames, StringBuffer completion) { > //// Modifiers > // flush uninteresting modifiers >@@ -5404,6 +5617,11 @@ > return this.requestor.isIgnored(kind); > } > >+ private boolean isIgnored(int kind, int requiredProposalKind) { >+ return this.requestor.isIgnored(kind) || >+ !this.requestor.isAllowingRequiredProposals(kind, requiredProposalKind); >+ } >+ > private void findMethods( > char[] selector, > TypeBinding[] typeArgTypes, >@@ -6845,7 +7063,7 @@ > } > } > >- boolean isStatic = this.compilerOptions.sourceLevel > ClassFileConstants.JDK1_4; >+ boolean isStatic = true; > > ImportReference importReference = > new ImportReference( >@@ -6860,14 +7078,8 @@ > continue next; > } > >- if (onDemand) { >- if (importReference.isStatic() && importBinding instanceof PackageBinding) { >- importReference.modifiers = importReference.modifiers & ~ClassFileConstants.AccStatic; >- } >- } else { >- if (importBinding instanceof PackageBinding) { >- continue next; >- } >+ if (importBinding instanceof PackageBinding) { >+ continue next; > } > > resolvedImports[count++] = >@@ -7878,6 +8090,15 @@ > case CompletionProposal.ANNOTATION_ATTRIBUTE_REF : > buffer.append("ANNOTATION_ATTRIBUT_REF"); //$NON-NLS-1$ > break; >+ case CompletionProposal.FIELD_IMPORT : >+ buffer.append("FIELD_IMPORT"); //$NON-NLS-1$ >+ break; >+ case CompletionProposal.METHOD_IMPORT : >+ buffer.append("METHOD_IMPORT"); //$NON-NLS-1$ >+ break; >+ case CompletionProposal.TYPE_IMPORT : >+ buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ >+ break; > default : > buffer.append("PROPOSAL"); //$NON-NLS-1$ > break; >Index: model/org/eclipse/jdt/core/CompletionFlags.java >=================================================================== >RCS file: model/org/eclipse/jdt/core/CompletionFlags.java >diff -N model/org/eclipse/jdt/core/CompletionFlags.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ model/org/eclipse/jdt/core/CompletionFlags.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,51 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 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.jdt.core; >+ >+/** >+ * Utility class for decoding additional flags in completion proposal. >+ * <p> >+ * This class provides static methods only; it is not intended to be >+ * instantiated or subclassed by clients. >+ * </p> >+ * >+ * @see CompletionProposal#getAdditionalFlags() >+ * >+ * @since 3.3 >+ */ >+public final class CompletionFlags { >+ /** >+ * Constant representing the absence of any flag >+ */ >+ public static final int Default = 0x0000; >+ >+ /** >+ * Constant representing a static import >+ */ >+ public static final int StaticImport = 0x0001; >+ >+ /** >+ * Not instantiable. >+ */ >+ private CompletionFlags() { >+ // Not instantiable >+ } >+ >+ /** >+ * Returns whether the given integer includes the {@link #StaticImport} flag. >+ * >+ * @param flags the flags >+ * @return <code>true</code> if the {@link #StaticImport} flag is included >+ */ >+ public static boolean isStaticImport(int flags) { >+ return (flags & StaticImport) != 0; >+ } >+} >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java,v >retrieving revision 1.19 >diff -u -r1.19 CompletionTestsRequestor2.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java 16 Oct 2006 17:20:51 -0000 1.19 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTestsRequestor2.java 12 Jan 2007 17:29:32 -0000 >@@ -71,8 +71,8 @@ > } > > public void allowAllRequiredProposals() { >- for (int i = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; i <= CompletionProposal.JAVADOC_INLINE_TAG; i++) { >- for (int j = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; j <= CompletionProposal.JAVADOC_INLINE_TAG; j++) { >+ for (int i = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; i <= CompletionProposal.TYPE_IMPORT; i++) { >+ for (int j = CompletionProposal.ANONYMOUS_CLASS_DECLARATION; j <= CompletionProposal.TYPE_IMPORT; j++) { > this.setAllowsRequiredProposals(i, j, true); > } > } >@@ -289,6 +289,15 @@ > case CompletionProposal.JAVADOC_VALUE_REF : > buffer.append("JAVADOC_VALUE_REF"); //$NON-NLS-1$ > break; >+ case CompletionProposal.FIELD_IMPORT : >+ buffer.append("FIELD_IMPORT"); //$NON-NLS-1$ >+ break; >+ case CompletionProposal.METHOD_IMPORT : >+ buffer.append("METHOD_IMPORT"); //$NON-NLS-1$ >+ break; >+ case CompletionProposal.TYPE_IMPORT : >+ buffer.append("TYPE_IMPORT"); //$NON-NLS-1$ >+ break; > default : > buffer.append("PROPOSAL"); //$NON-NLS-1$ > break; >@@ -412,6 +421,7 @@ > case CompletionProposal.ANONYMOUS_CLASS_DECLARATION : > return new String(Signature.getSignatureSimpleName(proposal.getDeclarationSignature())); > case CompletionProposal.TYPE_REF : >+ case CompletionProposal.TYPE_IMPORT : > case CompletionProposal.JAVADOC_TYPE_REF : > return new String(Signature.getSignatureSimpleName(proposal.getSignature())); > case CompletionProposal.FIELD_REF : >@@ -430,6 +440,8 @@ > case CompletionProposal.JAVADOC_METHOD_REF : > case CompletionProposal.JAVADOC_PARAM_REF : > case CompletionProposal.JAVADOC_VALUE_REF : >+ case CompletionProposal.FIELD_IMPORT : >+ case CompletionProposal.METHOD_IMPORT : > return new String(proposal.getName()); > case CompletionProposal.PACKAGE_REF: > return new String(proposal.getDeclarationSignature()); >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v >retrieving revision 1.139 >diff -u -r1.139 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 15 Dec 2006 14:10:50 -0000 1.139 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 12 Jan 2007 17:29:32 -0000 >@@ -13397,16 +13397,23 @@ > " public static int foo;\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); > String completeBehind = "foo"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >- >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[FIELD_REF]{test.p.ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[FIELD_REF]{ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13428,7 +13435,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13436,8 +13444,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13459,7 +13473,8 @@ > " public static int foo;\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ"}); > > String str = this.workingCopies[0].getSource(); >@@ -13490,7 +13505,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ"}); > > String str = this.workingCopies[0].getSource(); >@@ -13521,7 +13537,8 @@ > " public static int foo;\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -13529,8 +13546,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "", >+ "foo[FIELD_REF]{ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13552,7 +13575,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -13560,8 +13584,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "", >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13584,7 +13614,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13592,8 +13623,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13616,7 +13653,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -13624,8 +13662,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "", >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13648,7 +13692,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13656,8 +13701,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13680,7 +13731,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -13688,8 +13740,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "", >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13713,17 +13771,24 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); > String completeBehind = "foo"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >- >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "Test.foo[TYPE_REF]{foo, test, Ltest.Test$foo;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class Test"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "Test.foo[TYPE_REF]{foo, test, Ltest.Test$foo;, null, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13745,7 +13810,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13753,9 +13819,10 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[METHOD_REF]{foo(), Ltest.Test;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.Test;, ()V, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13778,7 +13845,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13786,9 +13854,15 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[FIELD_REF]{foo, Ltest.Test;, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class Test"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "foo[FIELD_REF]{foo, Ltest.Test;, I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13811,7 +13885,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13819,9 +13894,15 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[LOCAL_VARIABLE_REF]{foo, null, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class Test"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "foo[LOCAL_VARIABLE_REF]{foo, null, I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13844,7 +13925,8 @@ > " public static int foo(int i){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13852,9 +13934,16 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, (I)I, foo, (i), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class Test"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, (I)I, foo, (i), ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -13876,7 +13965,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -13888,4 +13978,302 @@ > "", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports023() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "/** */\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo;\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("/** */"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[FIELD_REF]{ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports024() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo;\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports025() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo;\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports026() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo(){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports027() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo(){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports028() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "import test.p.ZZZ;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo(){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports030() throws JavaModelException { >+ this.oldOptions = JavaCore.getOptions(); >+ >+ try { >+ Hashtable options = new Hashtable(this.oldOptions); >+ options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.DISABLED); >+ JavaCore.setOptions(options); >+ >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo(){}\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+ } finally { >+ JavaCore.setOptions(oldOptions); >+ } >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports031() throws JavaModelException { >+ this.oldOptions = JavaCore.getOptions(); >+ >+ try { >+ Hashtable options = new Hashtable(this.oldOptions); >+ options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); >+ JavaCore.setOptions(options); >+ >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo(){}\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+ } finally { >+ JavaCore.setOptions(oldOptions); >+ } >+} > } >Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v >retrieving revision 1.79 >diff -u -r1.79 CompletionTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 8 Dec 2006 15:05:58 -0000 1.79 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 12 Jan 2007 17:29:35 -0000 >@@ -9444,7 +9444,8 @@ > " public static int foo;\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -9452,8 +9453,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[FIELD_REF]{test.p.ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[FIELD_REF]{foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[FIELD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9475,16 +9482,23 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); > String completeBehind = "foo"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >- >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9506,7 +9520,8 @@ > " public static int foo;\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ"}); > > String str = this.workingCopies[0].getSource(); >@@ -9537,7 +9552,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ"}); > > String str = this.workingCopies[0].getSource(); >@@ -9568,16 +9584,23 @@ > " public static int foo;\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); > String completeBehind = "foo"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >- >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[FIELD_REF]{test.p.ZZZ.foo, Ltest.p.ZZZ;, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[FIELD_REF]{foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[FIELD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9599,7 +9622,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -9607,8 +9631,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9631,7 +9661,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -9639,8 +9670,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9663,16 +9700,19 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); > String completeBehind = "foo"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >- >+ >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED +R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED +R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9695,7 +9735,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -9703,8 +9744,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9727,7 +9774,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -9735,8 +9783,10 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED +R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9759,7 +9809,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -9767,8 +9818,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9791,7 +9848,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -9799,8 +9857,10 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED +R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9823,7 +9883,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -9831,8 +9892,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9855,7 +9922,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -9863,8 +9931,10 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED +R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9894,7 +9964,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.q.ZZZ2.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -9902,9 +9973,10 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{test.q.ZZZ2.foo(), Ltest.q.ZZZ2;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9928,17 +10000,24 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); > String completeBehind = "foo"; > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >- >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "Test.foo[TYPE_REF]{foo, test, Ltest.Test$foo;, null, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class Test"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + >+ "Test.foo[TYPE_REF]{foo, test, Ltest.Test$foo;, null, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9960,7 +10039,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -9968,9 +10048,10 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[METHOD_REF]{foo(), Ltest.Test;, ()V, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.Test;, ()V, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -9993,7 +10074,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -10001,9 +10083,15 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[FIELD_REF]{foo, Ltest.Test;, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "foo[FIELD_REF]{foo, Ltest.Test;, I, foo, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -10026,7 +10114,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); > > String str = this.workingCopies[0].getSource(); >@@ -10034,9 +10123,15 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[LOCAL_VARIABLE_REF]{foo, null, I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "foo[LOCAL_VARIABLE_REF]{foo, null, I, foo, null, ["+start1+", "+end1+"], "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_UNQUALIFIED + R_NON_RESTRICTED)+"}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -10059,7 +10154,8 @@ > " public static int foo(int i){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -10067,9 +10163,16 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED) + "}\n" + >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, (I)I, foo, (i), "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n"+ >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, (I)I, foo, (i), ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, (I)I, foo, (i), ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -10091,7 +10194,8 @@ > " public static <T> int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -10099,8 +10203,14 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); > assertResults( >- "foo[METHOD_REF]{test.p.ZZZ.foo(), Ltest.p.ZZZ;, <T:Ljava.lang.Object;>()I, foo, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED)+"}", >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, <T:Ljava.lang.Object;>()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, <T:Ljava.lang.Object;>()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", > requestor.getResults()); > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >@@ -10122,7 +10232,8 @@ > " public static int foo(){}\n" + > "}"); > >- CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); > requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); > > String str = this.workingCopies[0].getSource(); >@@ -10134,4 +10245,306 @@ > "", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports023() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "/** */\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo;\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("/** */"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[FIELD_REF]{foo, Ltest.p.ZZZ;, I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[FIELD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports024() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo;\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports025() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo;\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports026() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo(){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports027() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public int foo(){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports029() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "import test.p.ZZZ;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo(){return 0;};\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.foo"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports030() throws JavaModelException { >+ this.oldOptions = JavaCore.getOptions(); >+ >+ try { >+ Hashtable options = new Hashtable(this.oldOptions); >+ options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.DISABLED); >+ JavaCore.setOptions(options); >+ >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo(){}\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{ZZZ.foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " ZZZ[TYPE_IMPORT]{import test.p.ZZZ;\n, test.p, Ltest.p.ZZZ;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+ } finally { >+ JavaCore.setOptions(oldOptions); >+ } >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152123 >+public void testFavoriteImports031() throws JavaModelException { >+ this.oldOptions = JavaCore.getOptions(); >+ >+ try { >+ Hashtable options = new Hashtable(this.oldOptions); >+ options.put(JavaCore.CODEASSIST_SUGGEST_STATIC_IMPORTS, JavaCore.ENABLED); >+ JavaCore.setOptions(options); >+ >+ this.workingCopies = new ICompilationUnit[2]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src3/test/Test.java", >+ "package test;\n" + >+ "public class Test {\n" + >+ " public void method() {\n" + >+ " foo\n" + >+ " }\n" + >+ "}"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src3/test/p/ZZZ.java", >+ "package test.p;\n" + >+ "public class ZZZ {\n" + >+ " public static int foo(){}\n" + >+ "}"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ requestor.setFavoriteReferences(new String[]{"test.p.ZZZ.*"}); >+ >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "foo"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED; >+ int start1 = str.lastIndexOf("foo") + "".length(); >+ int end1 = start1 + "foo".length(); >+ int start2 = str.lastIndexOf("public class"); >+ int end2 = start2 + "".length(); >+ assertResults( >+ "foo[METHOD_REF]{foo(), Ltest.p.ZZZ;, ()I, foo, null, ["+start1+", "+end1+"], "+(relevance1)+"}\n" + >+ " foo[METHOD_IMPORT]{import static test.p.ZZZ.foo;\n, Ltest.p.ZZZ;, ()I, foo, null, ["+start2+", "+end2+"], " + (relevance1) + "}", >+ requestor.getResults()); >+ } finally { >+ JavaCore.setOptions(oldOptions); >+ } >+} > }
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 152123
:
55310
|
56767
| 56841