protocolbuffers/protobuf

Protobuf/Gradle Case Sensitivity Issue on macOS - class x is public should be declared in a file named x.java

Open

#14,555 opened on 2023年10月30日

GitHub で見る
 (1 comment) (0 reactions) (1 assignee)C++ (16,128 forks)batch import
help wantedjavaplatform related

Repository metrics

Stars
 (71,223 stars)
PR merge metrics
 (平均マージ 2d 11h) (30d で 185 merged PRs)

説明

I encountered an issue with Protobuf and Gradle on macOS, which I believe may be related to case sensitivity of file names. When using two Protobuf message types, ChecklistItemMsg and CheckListItemMsg, where the only difference is the letter 'L' case, the Gradle build process fails on macOS but works fine on Linux.

message ChecklistItemMsg {
}
message CheckListItemMsg {
}

error: class ChecklistItemMsg is public, should be declared in a file named ChecklistItemMsg.java public final class ChecklistItemMsg extends ^

Expected Behavior: I expected that the Gradle build process would generate two Java files, one for each of the .proto files. Specifically, it should generate ChecklistItemMsg.java and CheckListItemMsg.java.

Actual Behavior: However, on macOS, the build process only generates one of the expected files (e.g., CheckListItemMsg.java), while the other file (ChecklistItemMsg.java) is missing. This results in a build error because the missing file is referenced in the code.

Platform Information:

  • Laptop: Macbook Pro with M2 chip
  • Operating System: macOS [Version]
  • Development Environment: IntelliJ IDEA 2023.2.4
  • Java Version: OpenJDK 17
  • Protobuf Version: 3.x
  • Gradle: Embedded with the IDE

Additional Information:

  • I've verified that the issue is specific to macOS as the build process works as expected on a Linux system.
  • I had to change the name of one of the messages to resolve the issue, which is not an ideal solution.
  • It appears that the issue is related to the case sensitivity of file names in the macOS file system.

コントリビューターガイド