ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 51947] New: Empty package-info.class created in wrong directory.
Date Tue, 04 Oct 2011 09:24:41 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=51947

             Bug #: 51947
           Summary: Empty package-info.class created in wrong directory.
           Product: Ant
           Version: 1.8.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: freakrob@gmail.com
    Classification: Unclassified


Created attachment 27682
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27682
Testcase showing a simple reproducable bug.

Overview:

The bug seems to be related to the bugfix for Bug 43114.
I encountered the bug while compiling the output of an xjc task, but really any
Java folder structure can be used to reproduce the bug.

Basically, the javac task will create empty package-info.class files relative
to its current working directory. However, the source tree it sees is relative
to the source directory.

Hence, when compiling files for source dir srcdir="/a/b/c" where "/" is my
working directory. Package "d" is at "/a/b/c/d" and its package-info is at
"/a/b/c/d/package-info.java". The empty package-info.class file will be created
at "/d/package-info.class". This is obviously undesired, as the empty class
file should be generated in "/a/b/c/d/package-info.class".

This however is generated by javac on its own. It seems the
generateMissingPackageInfoClasses() inside the javac task will also search the
wrong path for previously compiled package-info.class files.

Notice that my working directory could be any other directory, unrelated to
srcdir.

Steps to Reproduce:

Please see the attached testcase. Reproducible always.

The folder "test" stands for any source tree folder, e.g. folders created by
xjc or a regular java project.

Basically call javac task with srcdir != working directory and empty
package-info.class files will be generated for package names inside srcdir, but
relative to working directory.

Actual Results: 

package-info.class is generated at "com/example/ant_test/package-info.class"
(test_top_level_directory task) resp. "ant_test/package-info.class"
(test_xml_package_directory task).

Expected Results:

I expected the package-info.class to be generated at
"test/com/example/ant_test/package-info.class".

Other Platforms:

I think this is a general bug and not restricted to my host OS. However, I
could not and dir not test on Linux or Mac or any other Windows platform.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message