JDK-6759775 : RegularFileObject.inferBinaryName gives bad result on empty path
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-10-15
  • Updated: 2016-03-23
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7 b39Fixed
Independent of whether or not empty path elements should be allowed on a path, if an empty path element is found, then RegularFileObject.inferBinaryName will give an incorrect result for a file found from a directory (e.g. a classes/ directory) found elsewhere on the path.

EVALUATION noreg-other since the fix is covered by running testgetallmemberes in particular modes, and because we will probably consider disallowing empty elements in paths, which would invalidate any explicit test for this bug fix.

EVALUATION If a class is found in a classes/directory, then JavaFileObject.inferBinaryName will be provided by RegularFileObject.inferBinaryName. There is no reliable way to determine the binary name, and so the method works imperfectly by looking for the first directory on the path whose path is a prefix of the path for the class in question. An empty path provides a trivial and incorrect match. The solution is to treat empty path elements, if they occur, as user.dir. A separate issue to be resolved is whether empty path elements should be allowed at all.