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 58767 Details for
Bug 173013
[assist] NPE while completing in catch formal parameter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug173013_002.txt (text/plain), 5.66 KB, created by
David Audel
on 2007-02-12 09:16:31 EST
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2007-02-12 09:16:31 EST
Size:
5.66 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.316 >diff -u -r1.316 CompletionEngine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 26 Jan 2007 10:41:27 -0000 1.316 >+++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 12 Feb 2007 14:12:57 -0000 >@@ -2318,9 +2318,13 @@ > return; > > if (this.options.checkVisibility) { >- if (invocationType != null && !exceptionType.canBeSeenBy(receiverType, invocationType)) { >- return; >- } else if(invocationType == null && !exceptionType.canBeSeenBy(this.unitScope.fPackage)) { >+ if (invocationType != null) { >+ if (receiverType != null) { >+ if (!exceptionType.canBeSeenBy(receiverType, invocationType)) return; >+ } else { >+ if (!exceptionType.canBeSeenBy(exceptionType, invocationType)) return; >+ } >+ } else if(!exceptionType.canBeSeenBy(this.unitScope.fPackage)) { > return; > } > } >@@ -6347,10 +6351,10 @@ > int typeLength = token.length; > SourceTypeBinding[] types = this.unitScope.topLevelTypes; > >- for (int i = 0, length = types.length; i < length; i++) { >+ next : for (int i = 0, length = types.length; i < length; i++) { > SourceTypeBinding sourceType = types[i]; > >- if(isForbidden(sourceType)) continue; >+ if(isForbidden(sourceType)) continue next; > > if(proposeAllMemberTypes && > sourceType != outerInvocationType) { >@@ -6365,22 +6369,28 @@ > typesFound); > } > >- if (sourceType.sourceName == CompletionParser.FAKE_TYPE_NAME) continue; >- if (sourceType.sourceName == TypeConstants.PACKAGE_INFO_NAME) continue; >+ if (sourceType.sourceName == CompletionParser.FAKE_TYPE_NAME) continue next; >+ if (sourceType.sourceName == TypeConstants.PACKAGE_INFO_NAME) continue next; > >- if (typeLength > sourceType.sourceName.length) continue; >+ if (typeLength > sourceType.sourceName.length) continue next; > > if (!CharOperation.prefixEquals(token, sourceType.sourceName, false) > && !(this.options.camelCaseMatch && CharOperation.camelCaseMatch(token, sourceType.sourceName))) continue; > >+ for (int j = typesFound.size; --j >= 0;) { >+ ReferenceBinding otherType = (ReferenceBinding) typesFound.elementAt(j); >+ >+ if (sourceType == otherType) continue next; >+ } >+ > this.knownTypes.put(CharOperation.concat(sourceType.qualifiedPackageName(), sourceType.sourceName(), '.'), this); > > if(this.assistNodeIsClass) { >- if(!sourceType.isClass()) continue; >+ if(!sourceType.isClass()) continue next; > } else if(this.assistNodeIsInterface) { >- if(!sourceType.isInterface() && !sourceType.isAnnotationType()) continue; >+ if(!sourceType.isInterface() && !sourceType.isAnnotationType()) continue next; > } else if (this.assistNodeIsAnnotation) { >- if(!sourceType.isAnnotationType()) continue; >+ if(!sourceType.isAnnotationType()) continue next; > } > > int relevance = computeBaseRelevance(); >#P org.eclipse.jdt.core.tests.model >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.142 >diff -u -r1.142 CompletionTests.java >--- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 24 Jan 2007 16:27:41 -0000 1.142 >+++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 12 Feb 2007 14:13:07 -0000 >@@ -1114,6 +1114,48 @@ > "IZZBException[TYPE_REF]{IZZBException, test, Ltest.IZZBException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}", > requestor.getResults()); > } >+public void testCatchClauseExceptionRef14() throws JavaModelException { >+ >+ this.workingCopies = new ICompilationUnit[1]; >+ this.workingCopies[0] = getWorkingCopy( >+ "/Completion/src/test/Test.java", >+ "package test;"+ >+ "public class Test {\n" + >+ " public void throwing() throws IZZException {}\n" + >+ " public void foo() {\n" + >+ " try {\n" + >+ " throwing();\n" + >+ " }\n" + >+ " catch (IZZAException e) {\n" + >+ " }\n" + >+ " catch (IZZ) {\n" + >+ " }\n" + >+ " }" + >+ "}" + >+ "class IZZAException extends Exception {\n" + >+ "}" + >+ "class IZZException extends Exception {\n" + >+ "}\n"); >+ >+ IJavaProject project = this.workingCopies[0].getJavaProject(); >+ String visibilityCheck = project.getOption(JavaCore.CODEASSIST_VISIBILITY_CHECK, true); >+ >+ try { >+ project.setOption(JavaCore.CODEASSIST_VISIBILITY_CHECK, JavaCore.ENABLED); >+ >+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); >+ String str = this.workingCopies[0].getSource(); >+ String completeBehind = "(IZZ"; >+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); >+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); >+ >+ assertResults( >+ "IZZException[TYPE_REF]{IZZException, test, Ltest.IZZException;, null, null, " + (R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_EXPECTED_TYPE + R_UNQUALIFIED + R_EXCEPTION + R_NON_RESTRICTED) + "}", >+ requestor.getResults()); >+ } finally { >+ project.setOption(JavaCore.CODEASSIST_VISIBILITY_CHECK, visibilityCheck); >+ } >+} > /* > * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65737 > */
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 173013
: 58767