Having the file location not matching the declared package is considered bad practice in software development. It can lead to confusion, make code harder to locate and navigate to, hinder collaboration among team members, cause issues with build systems and tools, reduce code portability and reusability, and negatively impact code readability and understanding. It is important to adhere to the convention of matching file locations with package declarations for a well-organized and maintainable codebase.
package otherpack
// This class file is located at src/main/kotlin/mypack
class MyClass {
// ...
}
Make sure that package declaration complies with the location of the source file.
package mypack
// This class file is located at src/main/kotlin/mypack
class MyClass {
// ...
}