Community
Participate
Working Groups
Try to run the ASTModelBridgeTests setting the location of the workspace in c:\temp. Two tests will fail. We need to check if the EXTERNAL_JAR_DIR_PATH ends with File.separator. This would fix one test. We need this: protected String getExternalJCLPathString() { if (EXTERNAL_JAR_DIR_PATH.endsWith(File.separator)) { return EXTERNAL_JAR_DIR_PATH + "jclMin.jar"; } else { return EXTERNAL_JAR_DIR_PATH + File.separator + "jclMin.jar"; } } and: /** * Returns the java.io path to the source of the external java class library (e.g. jclMinsrc.zip) */ protected String getExternalJCLSourcePathString() { if (EXTERNAL_JAR_DIR_PATH.endsWith(File.separator)) { return EXTERNAL_JAR_DIR_PATH + "jclMinsrc.zip"; } else { return EXTERNAL_JAR_DIR_PATH + File.separator + "jclMinsrc.zip"; } } and: public String getSourceWorkspacePath() { if (getPluginDirectoryPath().endsWith(File.separator)) { return getPluginDirectoryPath() + "workspace"; } else { return getPluginDirectoryPath() + File.separator + "workspace"; } } These three methods are in AbstractJavaModelTests. Once this is done, the test testModelTopLevelType3 is still failing because jclMin.jar is not found as an external package fragment root. It seems to be located in the project root path. See JavaProject#public IPackageFragmentRoot getPackageFragmentRoot(IPath path) in the case the segment count is 1. I changed it to: case 1: // default root if (org.eclipse.jdt.internal.compiler.util.Util.isArchiveFileName(path.lastSegment())) { IResource resource = this.project.getWorkspace().getRoot().findMember(path); if (resource != null && resource.getType() == IResource.FOLDER){ return getPackageFragmentRoot(resource); } return getPackageFragmentRoot0(path); } else { return getPackageFragmentRoot(this.project); } but it is not quite right. I still have problems with the File.separator.
Changed EXTERNAL_JAR_DIR_PATH to always end with a File.separatorChar. Changed all its usages in the tests to not append a File.separatorChar. Changed TypeBinding#getClassFile(char[]) to not convert the File.separatorChar into a slash. Changed ClasspathEntry#validateClasspath(...) and validateClasspathEntry(...) to not assume that the path has at least one segment. All Java model tests now pass if the workspace is at the root of the file system.
Implementation reviewed for 3.1 M4 using build I200412142000.