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 52310 Details for
Bug 161204
code assist with unresolved types does not work when using 5.0 rt.jar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug161204_001.txt (text/plain), 37.16 KB, created by
David Audel
on 2006-10-19 09:40:08 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2006-10-19 09:40:08 EDT
Size:
37.16 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java,v >retrieving revision 1.1 >diff -u -r1.1 CompletionWithMissingTypesTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java 12 Oct 2006 09:22:02 -0000 1.1 >+++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests.java 19 Oct 2006 13:43:16 -0000 >@@ -66,7 +66,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -103,7 +103,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -146,7 +146,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -183,8 +183,8 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED; >- int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.") + "m.".length(); > int end1 = start1; > int start2 = str.lastIndexOf("MissingType"); >@@ -243,7 +243,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -282,7 +282,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -409,7 +409,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -450,7 +450,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingMemberType"); >@@ -487,7 +487,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m().b") + "m().".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -524,7 +524,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m(0).b") + "m(0).".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -653,7 +653,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m().b") + "m().".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -692,7 +692,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -797,7 +797,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.e") + "m.".length(); > int end1 = start1 + "e".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -844,7 +844,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingMemberType"); >@@ -940,7 +940,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingMemberMemberType"); >@@ -954,7 +954,7 @@ > } > } > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984 >-public void _test0023() throws JavaModelException { >+public void test0023() throws JavaModelException { > this.oldOptions = JavaCore.getOptions(); > > try { >@@ -1035,7 +1035,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingMemberType"); >@@ -1129,7 +1129,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingMemberMemberType"); >Index: src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java,v >retrieving revision 1.1 >diff -u -r1.1 CompletionWithMissingTypesTests_1_5.java >--- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java 12 Oct 2006 09:22:02 -0000 1.1 >+++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java 19 Oct 2006 13:43:16 -0000 >@@ -64,7 +64,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -108,7 +108,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType2"); >@@ -159,7 +159,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType2"); >@@ -206,7 +206,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType<"); >@@ -269,7 +269,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType1"); >@@ -324,7 +324,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m(0, 0).b") + "m(0, 0).".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -367,7 +367,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -406,7 +406,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -476,7 +476,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("m.b") + "m.".length(); > int end1 = start1 + "b".length(); > int start2 = str.lastIndexOf("MissingType"); >@@ -519,4 +519,51 @@ > "", > requestor.getResults()); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=161204 >+public void test0012() throws JavaModelException { >+ this.workingCopies = new ICompilationUnit[3]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " void foo() {\n" + >+ " MissingType m = null;\n" + >+ " m.b\n" + >+ " }\n" + >+ "}\n"); >+ >+ this.workingCopies[1] = getWorkingCopy( >+ "/Completion/src/missing1/MissingType.java", >+ "package missing1;"+ >+ "public class MissingType<T> {\n" + >+ " public void bar() {};\n" + >+ "}\n"); >+ >+ this.workingCopies[2] = getWorkingCopy( >+ "/Completion/src/missing2/MissingType.java", >+ "package missing2;"+ >+ "public class MissingType {\n" + >+ " public void bar() {};\n" + >+ "}\n"); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true, false, true); >+ requestor.allowAllRequiredProposals(); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "m.b"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance2 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; >+ int start1 = str.lastIndexOf("m.b") + "m.".length(); >+ int end1 = start1 + "b".length(); >+ int start2 = str.lastIndexOf("MissingType"); >+ int end2 = start2 + "MissingType".length(); >+ assertResults( >+ "bar[METHOD_REF]{bar(), Lmissing1.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance1) + "}\n" + >+ " MissingType<T>[TYPE_REF]{missing1.MissingType, missing1, Lmissing1.MissingType<TT;>;, null, null, ["+start2+", "+end2+"], " + (relevance1) + "}\n" + >+ "bar[METHOD_REF]{bar(), Lmissing2.MissingType;, ()V, bar, null, ["+start1+", "+end1+"], " + (relevance2) + "}\n" + >+ " MissingType[TYPE_REF]{missing2.MissingType, missing2, Lmissing2.MissingType;, null, null, ["+start2+", "+end2+"], " + (relevance2) + "}", >+ requestor.getResults()); >+} > } >Index: src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests2.java,v >retrieving revision 1.1 >diff -u -r1.1 CompletionWithMissingTypesTests2.java >--- src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests2.java 12 Oct 2006 09:22:02 -0000 1.1 >+++ src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests2.java 19 Oct 2006 13:43:16 -0000 >@@ -143,7 +143,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > cu.codeComplete(cursorLocation, requestor); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("x.fo") + "x.".length(); > int end1 = start1 + "fo".length(); > int start2 = str.lastIndexOf("XX"); >@@ -237,7 +237,7 @@ > int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); > cu.codeComplete(cursorLocation, requestor); > >- int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED; >+ int relevance1 = R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC + R_NON_RESTRICTED + R_NO_PROBLEMS; > int start1 = str.lastIndexOf("x.fo") + "x.".length(); > int end1 = start1 + "fo".length(); > int start2 = str.lastIndexOf("XX"); >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java,v >retrieving revision 1.29 >diff -u -r1.29 RelevanceConstants.java >--- codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 5 Jul 2006 08:35:49 -0000 1.29 >+++ codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java 19 Oct 2006 13:43:23 -0000 >@@ -40,4 +40,5 @@ > int R_INLINE_TAG = 31; > int R_VALUE_TAG = 31; > int R_NON_INHERITED = 2; >+ int R_NO_PROBLEMS = 1; > } >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.304 >diff -u -r1.304 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 16 Oct 2006 17:21:09 -0000 1.304 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 19 Oct 2006 13:43:22 -0000 >@@ -46,6 +46,7 @@ > import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; > import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; > import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; >+import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; > import org.eclipse.jdt.internal.compiler.util.SuffixConstants; > import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; > import org.eclipse.jdt.internal.compiler.util.ObjectVector; >@@ -71,9 +72,10 @@ > public class CompletionProblemFactory extends DefaultProblemFactory { > private int lastErrorStart; > >- public boolean checkProblems = false; >- public boolean hasProblems = false; >- >+ private boolean checkProblems = false; >+ public boolean hasForbiddenProblems = false; >+ public boolean hasAllowedProblems = false; >+ > public CompletionProblemFactory(Locale loc) { > super(loc); > } >@@ -109,26 +111,47 @@ > CompletionEngine.this.problem = pb; > this.lastErrorStart = start; > } >- if (this.checkProblems && !this.hasProblems) { >- if (id == IProblem.UsingDeprecatedType) { >- this.hasProblems = >- CompletionEngine.this.options.checkDeprecation; >- } else if (id == IProblem.NotVisibleType) { >- this.hasProblems = >- CompletionEngine.this.options.checkVisibility; >- } else if (id == IProblem.ForbiddenReference) { >- this.hasProblems = >- CompletionEngine.this.options.checkForbiddenReference; >- } else if (id == IProblem.DiscouragedReference) { >- this.hasProblems = >- CompletionEngine.this.options.checkDiscouragedReference; >- } else { >- this.hasProblems = true; >+ if (this.checkProblems && !this.hasForbiddenProblems) { >+ switch (id) { >+ case IProblem.UsingDeprecatedType: >+ this.hasForbiddenProblems = >+ CompletionEngine.this.options.checkDeprecation; >+ break; >+ case IProblem.NotVisibleType: >+ this.hasForbiddenProblems = >+ CompletionEngine.this.options.checkVisibility; >+ break; >+ case IProblem.ForbiddenReference: >+ this.hasForbiddenProblems = >+ CompletionEngine.this.options.checkForbiddenReference; >+ break; >+ case IProblem.DiscouragedReference: >+ this.hasForbiddenProblems = >+ CompletionEngine.this.options.checkDiscouragedReference; >+ break; >+ default: >+ if ((severity & ProblemSeverities.Optional) != 0) { >+ this.hasAllowedProblems = true; >+ } else { >+ this.hasForbiddenProblems = true; >+ } >+ >+ break; > } > } > > return pb; > } >+ >+ public void startCheckingProblems() { >+ this.checkProblems = true; >+ this.hasForbiddenProblems = false; >+ this.hasAllowedProblems = false; >+ } >+ >+ public void stopCheckingProblems() { >+ this.checkProblems = false; >+ } > } > > private class AcceptedType { >@@ -805,7 +828,7 @@ > SourceTypeBinding enclosingType = scope.enclosingSourceType(); > if (!enclosingType.isAnnotationType()) { > if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) { >- findMethods(this.completionToken,null,null,enclosingType,scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null); >+ findMethods(this.completionToken,null,null,enclosingType,scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null, false); > } > if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) { > proposeNewMethod(this.completionToken, enclosingType); >@@ -827,7 +850,7 @@ > SourceTypeBinding enclosingType = scope.enclosingSourceType(); > if (!enclosingType.isAnnotationType()) { > if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) { >- findMethods(this.completionToken,null,null,scope.enclosingSourceType(),scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null); >+ findMethods(this.completionToken,null,null,scope.enclosingSourceType(),scope,new ObjectVector(),false,false,true,null,null,false,false,true,null, null, null, false); > } > if (!this.requestor.isIgnored(CompletionProposal.POTENTIAL_METHOD_DECLARATION)) { > proposeNewMethod(this.completionToken, scope.enclosingSourceType()); >@@ -940,7 +963,7 @@ > setSourceRange((int) (completionPosition >>> 32), (int) completionPosition); > TypeBinding receiverType = ((VariableBinding) qualifiedBinding).type; > if (receiverType != null) { >- findFieldsAndMethods(this.completionToken, receiverType.capture(scope, ref.sourceEnd), scope, ref, scope,false,false, null, null, null); >+ findFieldsAndMethods(this.completionToken, receiverType.capture(scope, ref.sourceEnd), scope, ref, scope,false,false, null, null, null, false); > } else if (this.assistNodeInJavadoc == 0 && > (this.requestor.isAllowingRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF) || > this.requestor.isAllowingRequiredProposals(CompletionProposal.METHOD_REF, CompletionProposal.TYPE_REF))) { >@@ -1029,7 +1052,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > > if (!isInsideAnnotationAttribute && !this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { >@@ -1050,7 +1074,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > > } else if (qualifiedBinding instanceof PackageBinding) { >@@ -1134,7 +1159,8 @@ > access.receiver instanceof SuperReference, > null, > null, >- null); >+ null, >+ false); > } > > } else if (astNode instanceof CompletionOnMessageSend) { >@@ -1165,7 +1191,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > } else if (astNode instanceof CompletionOnExplicitConstructorCall) { > if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF)) { >@@ -1403,7 +1430,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > } > } >@@ -1479,7 +1507,8 @@ > true, > null, > null, >- null); >+ null, >+ false); > } > > if (!this.requestor.isIgnored(CompletionProposal.METHOD_REF) >@@ -1500,7 +1529,8 @@ > true, > null, > null, >- null); >+ null, >+ false); > if (fieldRef.receiverType instanceof ReferenceBinding) { > ReferenceBinding refBinding = (ReferenceBinding)fieldRef.receiverType; > if (this.completionToken == null >@@ -1551,7 +1581,8 @@ > true, > null, > null, >- null); >+ null, >+ false); > } > } else if (astNode instanceof CompletionOnJavadocAllocationExpression) { > // setSourceRange(astNode.sourceStart, astNode.sourceEnd, false); >@@ -2547,7 +2578,8 @@ > boolean canBePrefixed, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > ObjectVector newFieldsFound = new ObjectVector(); > // Inherited fields which are hidden by subclasses are filtered out >@@ -2658,6 +2690,9 @@ > if (onlyStaticFields && this.insideQualifiedReference) { > relevance += computeRelevanceForInheritance(receiverType, field.declaringClass); > } >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > > this.noProposal = false; > // Standard proposal >@@ -2751,7 +2786,8 @@ > boolean canBePrefixed, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > boolean notInJavadoc = this.assistNodeInJavadoc == 0; > if (fieldName == null && notInJavadoc) >@@ -2795,7 +2831,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > currentType = currentType.superclass(); > } while (notInJavadoc && currentType != null); >@@ -2819,7 +2856,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > > ReferenceBinding[] itsInterfaces = anInterface.superInterfaces(); >@@ -2848,7 +2886,8 @@ > boolean superCall, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > if (token == null) > return; >@@ -2872,7 +2911,9 @@ > relevance += computeRelevanceForCaseMatching(token,lengthField); > relevance += computeRelevanceForExpectingType(TypeBinding.INT); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for length field >- >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > this.noProposal = false; > if(!isIgnored(CompletionProposal.FIELD_REF, missingElements != null)) { > CompletionProposal proposal = this.createProposal(CompletionProposal.FIELD_REF, this.actualCompletionPosition); >@@ -2918,7 +2959,9 @@ > relevance += computeRelevanceForStatic(false, false); > relevance += computeRelevanceForQualification(false); > relevance += computeRelevanceForRestrictions(IAccessRule.K_ACCESSIBLE); // no access restriction for clone() method >- >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > char[] completion; > if (this.source != null > && this.source.length > this.endPosition >@@ -2986,7 +3029,8 @@ > false, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > > if(proposeMethod) { >@@ -3007,7 +3051,8 @@ > false, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > } > >@@ -3158,7 +3203,8 @@ > TypeBinding guessedType, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean hasProblems) { > findFieldsAndMethods( > CompletionEngine.this.completionToken, > guessedType, >@@ -3169,7 +3215,8 @@ > false, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ hasProblems); > > } > }; >@@ -4002,7 +4049,8 @@ > boolean canBePrefixed, > Binding[] missingElements, > int[] missingElementssStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > if (selector == null) > return; >@@ -4041,7 +4089,8 @@ > canBePrefixed, > missingElements, > missingElementssStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > } > >@@ -4104,7 +4153,8 @@ > true, > null, > null, >- null); >+ null, >+ false); > staticsOnly |= enclosingType.isStatic(); > break; > >@@ -4133,7 +4183,8 @@ > boolean canBePrefixed, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > ObjectVector newMethodsFound = new ObjectVector(); > // Inherited methods which are hidden by subclasses are filtered out >@@ -4339,6 +4390,9 @@ > if (onlyStaticMethods && this.insideQualifiedReference) { > relevance += computeRelevanceForInheritance(receiverType, method.declaringClass); > } >+ if (missingElements != null) { >+ relevance += computeRelevanceForMissingElements(missingElementsHaveProblems); >+ } > > this.noProposal = false; > // Standard proposal >@@ -4587,6 +4641,12 @@ > } > return 0; > } >+ private int computeRelevanceForMissingElements(boolean hasProblems) { >+ if (!hasProblems) { >+ return R_NO_PROBLEMS; >+ } >+ return 0; >+ } > private int computeRelevanceForQualification(boolean prefixRequired) { > if(!prefixRequired && !this.insideQualifiedReference) { > return R_UNQUALIFIED; >@@ -5043,7 +5103,8 @@ > boolean canBePrefixed, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds) { >+ int[] missingElementsEnds, >+ boolean missingElementsHaveProblems) { > > boolean notInJavadoc = this.assistNodeInJavadoc == 0; > if (selector == null && notInJavadoc) { >@@ -5083,7 +5144,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } else { > findInterfacesMethods( > selector, >@@ -5103,7 +5165,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > > currentType = scope.getJavaLangObject(); >@@ -5127,7 +5190,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > > currentType = receiverType.superclass(); > } >@@ -5164,7 +5228,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } > } > >@@ -5187,7 +5252,8 @@ > canBePrefixed, > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ missingElementsHaveProblems); > } else { > hasPotentialDefaultAbstractMethods = false; > } >@@ -6044,7 +6110,8 @@ > true, > null, > null, >- null); >+ null, >+ false); > } > if(proposeMethod && !insideAnnotationAttribute) { > findMethods( >@@ -6064,7 +6131,8 @@ > true, > null, > null, >- null); >+ null, >+ false); > } > } > staticsOnly |= enclosingType.isStatic(); >@@ -6100,7 +6168,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > if(proposeMethod && !insideAnnotationAttribute) { > findMethods( >@@ -6120,7 +6189,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > } > } else { >@@ -6140,7 +6210,8 @@ > false, > null, > null, >- null); >+ null, >+ false); > } > } else if ((binding.kind() & Binding.METHOD) != 0) { > if(proposeMethod && !insideAnnotationAttribute) { >Index: codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java,v >retrieving revision 1.1 >diff -u -r1.1 MissingTypesGuesser.java >--- codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java 12 Oct 2006 09:21:44 -0000 1.1 >+++ codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java 19 Oct 2006 13:43:23 -0000 >@@ -35,7 +35,8 @@ > TypeBinding guessedType, > Binding[] missingElements, > int[] missingElementsStarts, >- int[] missingElementsEnds); >+ int[] missingElementsEnds, >+ boolean hasProblems); > > } > >@@ -521,24 +522,22 @@ > > nextSubstitution(substituedTypeNodes, subtitutions, substitutionsIndexes); > >- this.problemFactory.hasProblems = false; >- this.problemFactory.checkProblems = true; >+ >+ this.problemFactory.startCheckingProblems(); > TypeBinding guessedType = null; > switch (scope.kind) { > case Scope.METHOD_SCOPE : > case Scope.BLOCK_SCOPE : > resolutionCleaner.cleanUp(convertedType, (BlockScope)scope); >- convertedType.traverse(resolutionCleaner, (BlockScope)scope); > guessedType = convertedType.resolveType((BlockScope)scope); > break; > case Scope.CLASS_SCOPE : > resolutionCleaner.cleanUp(convertedType, (ClassScope)scope); >- convertedType.traverse(resolutionCleaner, (ClassScope)scope); > guessedType = convertedType.resolveType((ClassScope)scope); > break; > } >- this.problemFactory.checkProblems = false; >- if (!this.problemFactory.hasProblems) { >+ this.problemFactory.stopCheckingProblems(); >+ if (!this.problemFactory.hasForbiddenProblems) { > if (guessedType != null) { > Binding[] missingElements = new Binding[length]; > int[] missingElementsStarts = new int[length]; >@@ -554,7 +553,8 @@ > guessedType.capture(scope, typeRef.sourceEnd), > missingElements, > missingElementsStarts, >- missingElementsEnds); >+ missingElementsEnds, >+ this.problemFactory.hasAllowedProblems); > } > } > }
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 161204
: 52310