You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Daniel B. Widdis" <wi...@gmail.com> on 2022/02/14 16:56:23 UTC

Possible file separator bug in 3.10.0 using bnd-maven-plugin

I just bumped the maven-compiler-plugin version on my project from 3.9.0 to
3.10.0 and it caused Windows-based builds to fail maven-bnd-plugin tests
for package-info files in the "wrong" directory.  The symptom looks to be
associated with the windows file separator.

Sample failure looks like:
[INFO] Compiling 386 source files to D:\a\oshi\oshi\oshi-core\target\classes
[INFO]
[INFO] --- bnd-maven-plugin:6.1.0:bnd-process (default) @ oshi-core ---
Error:  D:\a\oshi\oshi\oshi-core\pom.xml [0:0]: Classes found in the wrong
directory:
{oshi/jna/platform/unix/package-info.class=oshi\jna\platform\unix\package-info,
oshi/driver/unix/solaris/disk/package-info.class=oshi\driver\unix\solaris\disk\package-info,
oshi/hardware/platform/mac/package-info.class=oshi\hardware\platform\mac\package-info,
oshi/software/os/package-info.class=oshi\software\os\package-info,
oshi/software/os/linux/package-info.class=oshi\software\os\linux\package-info,
... (many more)

While the failure is in another plugin, is it possible something in this PR
didn't handle the change?
 [MCOMPILER-205] Add a boolean to generate missing package-info classes by
default by gnodet · Pull Request #88 · apache/maven-compiler-plugin
(github.com) <https://github.com/apache/maven-compiler-plugin/pull/88/files>


I've looked over the code and don't see anything obvious there.

I do have package-info files in all my packages so new ones should not have
been generated, but it seems new ones may have.

Full test run here:  Bump maven-compiler-plugin from 3.9.0 to 3.10.0 ·
oshi/oshi@471641b (github.com)
<https://github.com/oshi/oshi/runs/5184078693?check_suite_focus=true>

-- 
Dan Widdis

Re: Possible file separator bug in 3.10.0 using bnd-maven-plugin

Posted by "Daniel B. Widdis" <wi...@gmail.com>.
OK, so I didn't reach the end of my investigation.  I did just look at the
Java specifications for the class file format [1].  They specify the
internal representation of packages always replace periods with forward
slashes (for historical reasons).   So the binary class file generated by
the ClassWriter on Windows is incorrect.

Looking through its code, it faithfully stores the name given it as the
third argument to visit().

So the bug is this argument (line 1356) which simply passes the parsed
path, which on Windows contains backslashes.

javaFile.substring( 0, javaFile.length() - ".java".length() )

I think I have enough info to file a Jira now.

[1] -
https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.2.1

On Mon, Feb 14, 2022 at 2:52 PM Daniel B. Widdis <wi...@gmail.com> wrote:

> I believe I've traced the problem to the binary inside the generated
> package-info.class files.  The path stored internally there uses the
> backslash, while all other class files have forward slashes on Windows.
>
> That appears to be written by the Classwriter (lines 1352-1358).   Debug
> lines show the first call to visitSource have a null/empty file name.
>
> Documentation here [1] states "The methods of this class must be called in
> the following order: visit [ visitSource ]" but in the PR the visitSource
> is called first.
>
> I've now reached the end of my uninformed debugging/speculation.
>
> [1] - ClassVisitor (ASM 9.2) (ow2.io)
> <https://asm.ow2.io/javadoc/org/objectweb/asm/ClassVisitor.html>
>
> On Mon, Feb 14, 2022 at 1:40 PM Daniel B. Widdis <wi...@gmail.com> wrote:
>
>> I've confirmed this PR is the relevant problem as the symptoms can be
>> suppressed by using
>>
>> mvn clean test "-Dmaven.compiler.createMissingPackageInfoClass=false"
>>
>>
>> On Mon, Feb 14, 2022 at 9:50 AM Greg Chabala <gr...@gmail.com>
>> wrote:
>>
>>> Just my opinion, https://github.com/apache/maven-compiler-plugin/pull/88
>>> feels like a hack solution.
>>>
>>> Generating classes for package-info.java files, just to appease some
>>> issue
>>> with the incremental compiler? That seems like it should have been
>>> filtered
>>> in the compile plugin, not litter the build with classes that have no
>>> function.
>>>
>>> On Mon, Feb 14, 2022 at 10:56 AM Daniel B. Widdis <wi...@gmail.com>
>>> wrote:
>>>
>>> > I just bumped the maven-compiler-plugin version on my project from
>>> 3.9.0 to
>>> > 3.10.0 and it caused Windows-based builds to fail maven-bnd-plugin
>>> tests
>>> > for package-info files in the "wrong" directory.  The symptom looks to
>>> be
>>> > associated with the windows file separator.
>>> >
>>> > Sample failure looks like:
>>> > [INFO] Compiling 386 source files to
>>> > D:\a\oshi\oshi\oshi-core\target\classes
>>> > [INFO]
>>> > [INFO] --- bnd-maven-plugin:6.1.0:bnd-process (default) @ oshi-core ---
>>> > Error:  D:\a\oshi\oshi\oshi-core\pom.xml [0:0]: Classes found in the
>>> wrong
>>> > directory:
>>> >
>>> >
>>> {oshi/jna/platform/unix/package-info.class=oshi\jna\platform\unix\package-info,
>>> >
>>> >
>>> oshi/driver/unix/solaris/disk/package-info.class=oshi\driver\unix\solaris\disk\package-info,
>>> >
>>> >
>>> oshi/hardware/platform/mac/package-info.class=oshi\hardware\platform\mac\package-info,
>>> > oshi/software/os/package-info.class=oshi\software\os\package-info,
>>> >
>>> >
>>> oshi/software/os/linux/package-info.class=oshi\software\os\linux\package-info,
>>> > ... (many more)
>>> >
>>> > While the failure is in another plugin, is it possible something in
>>> this PR
>>> > didn't handle the change?
>>> >  [MCOMPILER-205] Add a boolean to generate missing package-info
>>> classes by
>>> > default by gnodet · Pull Request #88 · apache/maven-compiler-plugin
>>> > (github.com) <
>>> > https://github.com/apache/maven-compiler-plugin/pull/88/files>
>>> >
>>> >
>>> > I've looked over the code and don't see anything obvious there.
>>> >
>>> > I do have package-info files in all my packages so new ones should not
>>> have
>>> > been generated, but it seems new ones may have.
>>> >
>>> > Full test run here:  Bump maven-compiler-plugin from 3.9.0 to 3.10.0 ·
>>> > oshi/oshi@471641b (github.com)
>>> > <https://github.com/oshi/oshi/runs/5184078693?check_suite_focus=true>
>>> >
>>> > --
>>> > Dan Widdis
>>> >
>>>
>>
>>
>> --
>> Dan Widdis
>>
>
>
> --
> Dan Widdis
>


-- 
Dan Widdis

Re: Possible file separator bug in 3.10.0 using bnd-maven-plugin

Posted by "Daniel B. Widdis" <wi...@gmail.com>.
I believe I've traced the problem to the binary inside the generated
package-info.class files.  The path stored internally there uses the
backslash, while all other class files have forward slashes on Windows.

That appears to be written by the Classwriter (lines 1352-1358).   Debug
lines show the first call to visitSource have a null/empty file name.

Documentation here [1] states "The methods of this class must be called in
the following order: visit [ visitSource ]" but in the PR the visitSource
is called first.

I've now reached the end of my uninformed debugging/speculation.

[1] - ClassVisitor (ASM 9.2) (ow2.io)
<https://asm.ow2.io/javadoc/org/objectweb/asm/ClassVisitor.html>

On Mon, Feb 14, 2022 at 1:40 PM Daniel B. Widdis <wi...@gmail.com> wrote:

> I've confirmed this PR is the relevant problem as the symptoms can be
> suppressed by using
>
> mvn clean test "-Dmaven.compiler.createMissingPackageInfoClass=false"
>
>
> On Mon, Feb 14, 2022 at 9:50 AM Greg Chabala <gr...@gmail.com>
> wrote:
>
>> Just my opinion, https://github.com/apache/maven-compiler-plugin/pull/88
>> feels like a hack solution.
>>
>> Generating classes for package-info.java files, just to appease some issue
>> with the incremental compiler? That seems like it should have been
>> filtered
>> in the compile plugin, not litter the build with classes that have no
>> function.
>>
>> On Mon, Feb 14, 2022 at 10:56 AM Daniel B. Widdis <wi...@gmail.com>
>> wrote:
>>
>> > I just bumped the maven-compiler-plugin version on my project from
>> 3.9.0 to
>> > 3.10.0 and it caused Windows-based builds to fail maven-bnd-plugin tests
>> > for package-info files in the "wrong" directory.  The symptom looks to
>> be
>> > associated with the windows file separator.
>> >
>> > Sample failure looks like:
>> > [INFO] Compiling 386 source files to
>> > D:\a\oshi\oshi\oshi-core\target\classes
>> > [INFO]
>> > [INFO] --- bnd-maven-plugin:6.1.0:bnd-process (default) @ oshi-core ---
>> > Error:  D:\a\oshi\oshi\oshi-core\pom.xml [0:0]: Classes found in the
>> wrong
>> > directory:
>> >
>> >
>> {oshi/jna/platform/unix/package-info.class=oshi\jna\platform\unix\package-info,
>> >
>> >
>> oshi/driver/unix/solaris/disk/package-info.class=oshi\driver\unix\solaris\disk\package-info,
>> >
>> >
>> oshi/hardware/platform/mac/package-info.class=oshi\hardware\platform\mac\package-info,
>> > oshi/software/os/package-info.class=oshi\software\os\package-info,
>> >
>> >
>> oshi/software/os/linux/package-info.class=oshi\software\os\linux\package-info,
>> > ... (many more)
>> >
>> > While the failure is in another plugin, is it possible something in
>> this PR
>> > didn't handle the change?
>> >  [MCOMPILER-205] Add a boolean to generate missing package-info classes
>> by
>> > default by gnodet · Pull Request #88 · apache/maven-compiler-plugin
>> > (github.com) <
>> > https://github.com/apache/maven-compiler-plugin/pull/88/files>
>> >
>> >
>> > I've looked over the code and don't see anything obvious there.
>> >
>> > I do have package-info files in all my packages so new ones should not
>> have
>> > been generated, but it seems new ones may have.
>> >
>> > Full test run here:  Bump maven-compiler-plugin from 3.9.0 to 3.10.0 ·
>> > oshi/oshi@471641b (github.com)
>> > <https://github.com/oshi/oshi/runs/5184078693?check_suite_focus=true>
>> >
>> > --
>> > Dan Widdis
>> >
>>
>
>
> --
> Dan Widdis
>


-- 
Dan Widdis

Re: Possible file separator bug in 3.10.0 using bnd-maven-plugin

Posted by "Daniel B. Widdis" <wi...@gmail.com>.
I've confirmed this PR is the relevant problem as the symptoms can be
suppressed by using

mvn clean test "-Dmaven.compiler.createMissingPackageInfoClass=false"


On Mon, Feb 14, 2022 at 9:50 AM Greg Chabala <gr...@gmail.com> wrote:

> Just my opinion, https://github.com/apache/maven-compiler-plugin/pull/88
> feels like a hack solution.
>
> Generating classes for package-info.java files, just to appease some issue
> with the incremental compiler? That seems like it should have been filtered
> in the compile plugin, not litter the build with classes that have no
> function.
>
> On Mon, Feb 14, 2022 at 10:56 AM Daniel B. Widdis <wi...@gmail.com>
> wrote:
>
> > I just bumped the maven-compiler-plugin version on my project from 3.9.0
> to
> > 3.10.0 and it caused Windows-based builds to fail maven-bnd-plugin tests
> > for package-info files in the "wrong" directory.  The symptom looks to be
> > associated with the windows file separator.
> >
> > Sample failure looks like:
> > [INFO] Compiling 386 source files to
> > D:\a\oshi\oshi\oshi-core\target\classes
> > [INFO]
> > [INFO] --- bnd-maven-plugin:6.1.0:bnd-process (default) @ oshi-core ---
> > Error:  D:\a\oshi\oshi\oshi-core\pom.xml [0:0]: Classes found in the
> wrong
> > directory:
> >
> >
> {oshi/jna/platform/unix/package-info.class=oshi\jna\platform\unix\package-info,
> >
> >
> oshi/driver/unix/solaris/disk/package-info.class=oshi\driver\unix\solaris\disk\package-info,
> >
> >
> oshi/hardware/platform/mac/package-info.class=oshi\hardware\platform\mac\package-info,
> > oshi/software/os/package-info.class=oshi\software\os\package-info,
> >
> >
> oshi/software/os/linux/package-info.class=oshi\software\os\linux\package-info,
> > ... (many more)
> >
> > While the failure is in another plugin, is it possible something in this
> PR
> > didn't handle the change?
> >  [MCOMPILER-205] Add a boolean to generate missing package-info classes
> by
> > default by gnodet · Pull Request #88 · apache/maven-compiler-plugin
> > (github.com) <
> > https://github.com/apache/maven-compiler-plugin/pull/88/files>
> >
> >
> > I've looked over the code and don't see anything obvious there.
> >
> > I do have package-info files in all my packages so new ones should not
> have
> > been generated, but it seems new ones may have.
> >
> > Full test run here:  Bump maven-compiler-plugin from 3.9.0 to 3.10.0 ·
> > oshi/oshi@471641b (github.com)
> > <https://github.com/oshi/oshi/runs/5184078693?check_suite_focus=true>
> >
> > --
> > Dan Widdis
> >
>


-- 
Dan Widdis

Re: Possible file separator bug in 3.10.0 using bnd-maven-plugin

Posted by Greg Chabala <gr...@gmail.com>.
Just my opinion, https://github.com/apache/maven-compiler-plugin/pull/88
feels like a hack solution.

Generating classes for package-info.java files, just to appease some issue
with the incremental compiler? That seems like it should have been filtered
in the compile plugin, not litter the build with classes that have no
function.

On Mon, Feb 14, 2022 at 10:56 AM Daniel B. Widdis <wi...@gmail.com> wrote:

> I just bumped the maven-compiler-plugin version on my project from 3.9.0 to
> 3.10.0 and it caused Windows-based builds to fail maven-bnd-plugin tests
> for package-info files in the "wrong" directory.  The symptom looks to be
> associated with the windows file separator.
>
> Sample failure looks like:
> [INFO] Compiling 386 source files to
> D:\a\oshi\oshi\oshi-core\target\classes
> [INFO]
> [INFO] --- bnd-maven-plugin:6.1.0:bnd-process (default) @ oshi-core ---
> Error:  D:\a\oshi\oshi\oshi-core\pom.xml [0:0]: Classes found in the wrong
> directory:
>
> {oshi/jna/platform/unix/package-info.class=oshi\jna\platform\unix\package-info,
>
> oshi/driver/unix/solaris/disk/package-info.class=oshi\driver\unix\solaris\disk\package-info,
>
> oshi/hardware/platform/mac/package-info.class=oshi\hardware\platform\mac\package-info,
> oshi/software/os/package-info.class=oshi\software\os\package-info,
>
> oshi/software/os/linux/package-info.class=oshi\software\os\linux\package-info,
> ... (many more)
>
> While the failure is in another plugin, is it possible something in this PR
> didn't handle the change?
>  [MCOMPILER-205] Add a boolean to generate missing package-info classes by
> default by gnodet · Pull Request #88 · apache/maven-compiler-plugin
> (github.com) <
> https://github.com/apache/maven-compiler-plugin/pull/88/files>
>
>
> I've looked over the code and don't see anything obvious there.
>
> I do have package-info files in all my packages so new ones should not have
> been generated, but it seems new ones may have.
>
> Full test run here:  Bump maven-compiler-plugin from 3.9.0 to 3.10.0 ·
> oshi/oshi@471641b (github.com)
> <https://github.com/oshi/oshi/runs/5184078693?check_suite_focus=true>
>
> --
> Dan Widdis
>