You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Olivier Lamy (Jira)" <ji...@apache.org> on 2022/07/22 07:54:00 UTC

[jira] [Commented] (MCOMPILER-498) Recompilation when class name doesn't match file name

    [ https://issues.apache.org/jira/browse/MCOMPILER-498?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17569859#comment-17569859 ] 

Olivier Lamy commented on MCOMPILER-498:
----------------------------------------

I would say what is the use case to have class name different from file name?

it's possible for sure but really sounds a bit weird way and generating so much possible issues ...

> Recompilation when class name doesn't match file name
> -----------------------------------------------------
>
>                 Key: MCOMPILER-498
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-498
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>            Reporter: T3rm1
>            Priority: Major
>
> The compiler plugin detects a file as stale whenever the class defined inside has a different name than the file.
> Steps to reproduce:
> Create a file named {{SpecialTest.java}} in directory {{{}foo{}}}.
> Paste in following content:
> {code:java}
> package foo;
> class UncommonTest {
> }
> class CommonTest {
> } {code}
> Run {{mvn -X test-compile}}
> It'll report on each invocation: {{[DEBUG] Stale source detected: F:\Git\bug\src\test\java\foo\SpecialTest.java}}
> That's because the plugin is looking for a fileĀ {{{}SpecialTest.class{}}}.
> This is a problem because it can easily happen that you have a typo in your class or file name so that they don't match.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)