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 194243 Details for
Bug 343865
[assist] CompletionContext token start and end incorrectly returning 0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v1.0 complete + regression tests
patch343865.txt (text/plain), 8.40 KB, created by
Ayushman Jain
on 2011-04-28 04:40:30 EDT
(
hide
)
Description:
proposed fix v1.0 complete + regression tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-04-28 04:40:30 EDT
Size:
8.40 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.429 >diff -u -r1.429 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 21 Apr 2011 09:40:30 -0000 1.429 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 28 Apr 2011 08:39:33 -0000 >@@ -670,6 +670,15 @@ > this.monitor = monitor; > } > >+ public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { >+ if (!CharOperation.equals(sourceUnit.getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME)) { >+ // do not accept package-info.java as a type for completion engine >+ // because it contains no extra info that will help in completion >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 >+ super.accept(sourceUnit, accessRestriction); >+ } >+ } >+ > public void acceptConstructor( > int modifiers, > char[] simpleTypeName, >#P org.eclipse.jdt.core.tests.model >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.122 >diff -u -r1.122 CompletionTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 25 Nov 2010 08:43:27 -0000 1.122 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 28 Apr 2011 08:39:35 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -2423,6 +2423,7 @@ > } else { > assertResults( > "interface[KEYWORD]{interface, null, null, interface, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + >+ "YAAnnot[TYPE_REF]{testxxx.YAAnnot, testxxx, Ltestxxx.YAAnnot;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + > "_ConfigurationData[TYPE_REF]{test325481._ConfigurationData, test325481, Ltest325481._ConfigurationData;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + > "_Path[TYPE_REF]{test325481._Path, test325481, Ltest325481._Path;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + > "Deprecated[TYPE_REF]{Deprecated, java.lang, Ljava.lang.Deprecated;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}\n" + >@@ -9021,6 +9022,7 @@ > assertResults( > "interface[KEYWORD]{interface, null, null, interface, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + > "QQAnnotation[TYPE_REF]{pkgannotations.QQAnnotation, pkgannotations, Lpkgannotations.QQAnnotation;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + >+ "YAAnnot[TYPE_REF]{testxxx.YAAnnot, testxxx, Ltestxxx.YAAnnot;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED) + "}\n" + > "_ConfigurationData[TYPE_REF]{test325481._ConfigurationData, test325481, Ltest325481._ConfigurationData;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + > "_Path[TYPE_REF]{test325481._Path, test325481, Ltest325481._Path;, null, null, " + (R_NAME_PREFIX + R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_NON_RESTRICTED) + "}\n" + > "Deprecated[TYPE_REF]{Deprecated, java.lang, Ljava.lang.Deprecated;, null, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_ANNOTATION + R_TARGET + R_NON_RESTRICTED + R_UNQUALIFIED) + "}", >@@ -13874,4 +13876,43 @@ > "Inn.Inn3[TYPE_REF]{Inn3, label, Llabel.Inn$Inn3;, null, null, 44}", > requestor.getResults()); > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 >+// Verify that no NPE is thrown and we get correct proposals >+public void testBug343865a() throws JavaModelException { >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ ICompilationUnit cu = getCompilationUnit("Completion", "src3", "testxxx", "TestType.java"); >+ >+ String str = cu.getSource(); >+ String completeBehind = "@YAAnnot("; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ cu.codeComplete(cursorLocation, requestor); >+ >+ assertResults( >+ "name[ANNOTATION_ATTRIBUTE_REF]{name, Ltestxxx.YAAnnot;, Ljava.lang.String;, name, null, " + (R_NAME_FIRST_PREFIX + R_EXPECTED_TYPE + R_RESOLVED) + "}\n" + >+ "val[ANNOTATION_ATTRIBUTE_REF]{val, Ltestxxx.YAAnnot;, I, val, null, " + (R_NAME_FIRST_PREFIX + R_EXPECTED_TYPE + R_RESOLVED) + "}", >+ requestor.getResults()); >+} >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=343865 >+// Verify that the correct expected type is computed >+public void testBug343865b() throws JavaModelException { >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ ICompilationUnit cu = getCompilationUnit("Completion", "src3", "testxxx", "TestType2.java"); >+ >+ String str = cu.getSource(); >+ String completeBehind = "String xxyy2 = xxy"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ cu.codeComplete(cursorLocation, requestor); >+ >+ assertResults( >+ "expectedTypesSignatures={Ljava.lang.String;}\n" + >+ "expectedTypesKeys={Ljava/lang/String;}", >+ requestor.getContext()); >+ >+ assertResults( >+ "xxyy[FIELD_REF]{xxyy, Ltestxxx.TestType2;, I, xxyy, null, " + (R_NAME_FIRST_PREFIX + R_EXPECTED_TYPE + R_RESOLVED) + "}\n" + >+ "xxyy1[FIELD_REF]{xxyy1, Ltestxxx.TestType2;, Ljava.lang.String;, xxyy1, null, " + (R_NAME_FIRST_PREFIX + R_EXPECTED_TYPE + R_RESOLVED + R_EXACT_EXPECTED_TYPE) + "}", >+ requestor.getResults()); >+} > } >Index: workspace/Completion/src3/testxxx/Annot.java >=================================================================== >RCS file: workspace/Completion/src3/testxxx/Annot.java >diff -N workspace/Completion/src3/testxxx/Annot.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Completion/src3/testxxx/Annot.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+package testxxx; >+ >+@interface YAAnnot { >+ >+ int val(); >+ String name(); >+ >+} >Index: workspace/Completion/src3/testxxx/TestType.java >=================================================================== >RCS file: workspace/Completion/src3/testxxx/TestType.java >diff -N workspace/Completion/src3/testxxx/TestType.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Completion/src3/testxxx/TestType.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+ >+package testxxx; >+ >+public class TestType { >+ >+ String abc = "hi"; >+ >+ @YAAnnot() >+ protected String element = abc; >+ >+} >Index: workspace/Completion/src3/testxxx/TestType2.java >=================================================================== >RCS file: workspace/Completion/src3/testxxx/TestType2.java >diff -N workspace/Completion/src3/testxxx/TestType2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Completion/src3/testxxx/TestType2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+package testxxx; >+ >+public class TestType2 { >+ int xxyy = 1; >+ String xxyy1 = "hi"; >+ String xxyy2 = xxy >+ >+} >\ No newline at end of file >Index: workspace/Completion/src3/testxxx/package-info.java >=================================================================== >RCS file: workspace/Completion/src3/testxxx/package-info.java >diff -N workspace/Completion/src3/testxxx/package-info.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ workspace/Completion/src3/testxxx/package-info.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+@Deprecated >+@YAAnnot(name = "", val = 0) >+package testxxx;
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 343865
:
194065
|
194161
|
194242
| 194243