Search code examples
javacoding-stylecomments

What do the comments `// <name> ::` and `// :: <name>` to mark code segments in Java mean?


I've noticed that colleagues of mine use the following comments in Java classes to mark a group of declarations as coherent parts.

I've noticed that these comments are used frequently. Where do they come from? What do they mean? Why do people do this? Is this some sort of trend or does it come from another language that I have never heard of?

// age verification ::

private boolean verifiyAdult(UserAccount a) { ... }
private boolean verifyBornInPast(UserAccount a) { ... }
private boolean verifyNotBornInFuture(UserAccount a) { ... }

// :: age verfication

I can understand why someone would want to mark a large segment as cohesive, but I can't understand what the two colons are for.


Solution

  • Turns out that the reason some Java developers use it, is because it is an IntelliJ idea feature: Java equivalent to #region in C#