maven-compiler-plugin icon indicating copy to clipboard operation
maven-compiler-plugin copied to clipboard

[MCOMPILER-498] Recompilation when class name doesn't match file name

Open jira-importer opened this issue 3 years ago • 1 comments

T3rm1 opened MCOMPILER-498 and commented

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:

package foo;

class UncommonTest {
}

class CommonTest {
} 

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.


No further details from MCOMPILER-498

jira-importer avatar Jul 16 '22 13:07 jira-importer

Olivier Lamy commented

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 ...

jira-importer avatar Jul 22 '22 07:07 jira-importer