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 115805 Details for
Bug 249027
NPE in Engine if type collides with a package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
bug_249027_001.txt (text/plain), 4.05 KB, created by
David Audel
on 2008-10-22 09:04:58 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
David Audel
Created:
2008-10-22 09:04:58 EDT
Size:
4.05 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ResolveTests2.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests2.java,v >retrieving revision 1.4 >diff -u -r1.4 ResolveTests2.java >--- src/org/eclipse/jdt/core/tests/model/ResolveTests2.java 9 Oct 2008 13:15:21 -0000 1.4 >+++ src/org/eclipse/jdt/core/tests/model/ResolveTests2.java 22 Oct 2008 13:04:19 -0000 >@@ -1016,4 +1016,96 @@ > this.deleteProject("PS2"); > } > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=249027 >+public void testBug249027a() throws Exception { >+ try { >+ // create P1 >+ this.createJavaProject( >+ "P1", >+ new String[]{"src"}, >+ new String[]{}, >+ "bin"); >+ >+ this.createFolder("/P1/src/p1"); >+ this.createFile( >+ "/P1/src/p1/C1.java", >+ "package p1;\n"+ >+ "public class C1 {\n" + >+ "}"); >+ >+ this.createFolder("/P1/src/p1/C1"); >+ this.createFile( >+ "/P1/src/p1/C1/C2.java", >+ "package p1.C1;\n"+ >+ "public class C2 {\n" + >+ " C1 f;\n" + >+ "}"); >+ >+ waitUntilIndexesReady(); >+ >+ // do code select >+ ICompilationUnit cu= getCompilationUnit("P1", "src", "p1.C1", "C2.java"); >+ >+ String str = cu.getSource(); >+ >+ String selection = "C1"; >+ int start = str.lastIndexOf(selection); >+ int length = selection.length(); >+ IJavaElement[] elements = cu.codeSelect(start, length); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "C1 [in C1.java [in p1 [in src [in P1]]]]", >+ elements >+ ); >+ } finally { >+ this.deleteProject("P1"); >+ } >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=249027 >+public void testBug249027b() throws Exception { >+ try { >+ // create P1 >+ this.createJavaProject( >+ "P1", >+ new String[]{"src"}, >+ new String[]{}, >+ "bin"); >+ >+ this.createFolder("/P1/src/p1"); >+ this.createFile( >+ "/P1/src/p1/C1.java", >+ "package p1;\n"+ >+ "public class C1 {\n" + >+ "}"); >+ >+ this.createFolder("/P1/src/p2"); >+ this.createFile( >+ "/P1/src/p2/C2.java", >+ "package p3;\n"+ >+ "public class C2 {\n" + >+ " C1 f;\n" + >+ "}"); >+ >+ waitUntilIndexesReady(); >+ >+ // do code select >+ ICompilationUnit cu= getCompilationUnit("P1", "src", "p2", "C2.java"); >+ >+ String str = cu.getSource(); >+ >+ String selection = "C1"; >+ int start = str.lastIndexOf(selection); >+ int length = selection.length(); >+ IJavaElement[] elements = cu.codeSelect(start, length); >+ >+ assertElementsEqual( >+ "Unexpected elements", >+ "C1 [in C1.java [in p1 [in src [in P1]]]]", >+ elements >+ ); >+ } finally { >+ this.deleteProject("P1"); >+ } >+} > } >#P org.eclipse.jdt.core >Index: codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java,v >retrieving revision 1.62 >diff -u -r1.62 Engine.java >--- codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java 27 Jun 2008 16:04:06 -0000 1.62 >+++ codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java 22 Oct 2008 13:04:20 -0000 >@@ -100,7 +100,14 @@ > ImportBinding[] importBindings = this.unitScope.imports; > int length = importBindings == null ? 0 : importBindings.length; > >- this.currentPackageName = CharOperation.concatWith(this.unitScope.fPackage.compoundName, '.'); >+ if (this.unitScope.fPackage != null) { >+ this.currentPackageName = CharOperation.concatWith(this.unitScope.fPackage.compoundName, '.'); >+ } else if (this.unitScope.referenceContext != null && >+ this.unitScope.referenceContext.currentPackage != null) { >+ this.currentPackageName = CharOperation.concatWith(this.unitScope.referenceContext.currentPackage.tokens, '.'); >+ } else { >+ this.currentPackageName = CharOperation.NO_CHAR; >+ } > > for (int i = 0; i < length; i++) { > ImportBinding importBinding = importBindings[i];
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 249027
: 115805