SUGGESTED FIX
Index: src/share/classes/com/sun/tools/javac/comp/Enter.java
============================================================
@@ -369,28 +368,23 @@
*/
private static boolean classNameMatchesFileName(ClassSymbol c,
Env<AttrContext> env) {
- // XXX 06/09/99 iris
- // Using a Name for filename is a small abuse of the abstraction.
String fname = env.toplevel.sourcefile.toString();
String cname = c.name + ".java";
- try {
- return
- endsWith(fname, cname)
- // hack to make things work for Windows 95:
- || endsWith(new File(fname).getCanonicalPath(), cname);
- } catch (java.io.IOException ex) {
- return false;
- }
+ return endsWith(fname, cname);
}
//where
/** Does path name have file name as last component?
*/
protected static boolean endsWith(String pathname, String filename) {
- return
- pathname.endsWith(filename) &&
- (pathname.length() == filename.length() ||
- pathname.charAt(pathname.length() - filename.length() - 1) ==
- File.separatorChar);
+ if (pathname.endsWith(filename)) {
+ int diff = pathname.length() - filename.length();
+ if (diff == 0 || pathname.charAt(diff - 1) == File.separatorChar)
+ return true;
+ File path = new File(new File(pathname).getName());
+ File file = new File(filename);
+ return path.equals(file);
+ }
+ return false;
}
/** Complain about a duplicate class. */
###@###.### 2004-11-25 04:15:43 GMT
|
EVALUATION
I need a reproducible test case.
###@###.### 2004-11-20 00:43:05 GMT
Based on the additional information from the submitter I was able to
reproduce the problem on Windows XP. You need to run it from the
Windows command prompt, cygwin is too helpful.
I cannot create a regression test as I don't have a way to test platform
specific behavior.
###@###.### 2004-11-25 02:08:04 GMT
SQE (###@###.###) will implement tests for this.
###@###.### 2004-11-29 18:38:15 GMT
I turns out that it is easy to write test for platform specific
behavior in jtreg, so SQE doesn't need to write a test case.
###@###.### 2005-05-27 23:03:53 GMT
|