### 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 31 Aug 2010 12:30:33 -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