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 178015 Details for
Bug 321170
Adding to build path fails for a java source file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch with test
patch_321170.txt (text/plain), 3.11 KB, created by
Jay Arthanareeswaran
on 2010-09-01 23:52:58 EDT
(
hide
)
Description:
Patch with test
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-09-01 23:52:58 EDT
Size:
3.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.454 >diff -u -r1.454 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 21 Jul 2010 14:13:46 -0000 1.454 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 2 Sep 2010 03:46:35 -0000 >@@ -997,9 +997,8 @@ > JavaProjectElementInfo projectInfo = (JavaProjectElementInfo) getJavaModelManager().getInfo(project); > ProjectCache projectCache = projectInfo == null ? null : projectInfo.projectCache; > HashtableOfArrayToObject allPkgFragmentsCache = projectCache == null ? null : projectCache.allPkgFragmentsCache; >- IClasspathEntry[] entries = >- org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourcePath.lastSegment()) >- ? project.getRawClasspath() // JAVA file can only live inside SRC folder (on the raw path) >+ boolean isJavaLike = org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourcePath.lastSegment()); >+ IClasspathEntry[] entries = isJavaLike ? project.getRawClasspath() // JAVA file can only live inside SRC folder (on the raw path) > : ((JavaProject)project).getResolvedClasspath(); > > int length = entries.length; >@@ -1011,6 +1010,8 @@ > if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) continue; > IPath rootPath = entry.getPath(); > if (rootPath.equals(resourcePath)) { >+ if (isJavaLike) >+ return null; > return project.getPackageFragmentRoot(resource); > } else if (rootPath.isPrefixOf(resourcePath)) { > // allow creation of package fragment if it contains a .java file that is included >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v >retrieving revision 1.215 >diff -u -r1.215 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 27 May 2010 10:10:45 -0000 1.215 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 2 Sep 2010 03:46:38 -0000 >@@ -6747,5 +6747,26 @@ > ContainerInitializer.setInitializer(null); > } > } >+public void testBug321170() throws Exception { >+ try { >+ IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); >+ >+ IFile file = this.createFile("/P/bin/X.java", "public class X {}"); >+ >+ IClasspathEntry[] classpath = new IClasspathEntry[1]; >+ classpath[0] = JavaCore.newLibraryEntry(new Path("/P/bin/X.java"), null, null); >+ setClasspath(p, classpath); >+ ICompilationUnit element = (ICompilationUnit)JavaCore.create(file, p); >+ assertNotNull("File created", element); >+ } >+ catch(ClassCastException e){ >+ fail("classcast exception"); >+ } >+ finally { >+ deleteProject("P"); >+ ContainerInitializer.setInitializer(null); >+ } >+} >+ > > }
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 321170
:
177828
| 178015