Groovy equivalent to java's declaration without access modifier
access-modifiers, groovy, java
Solution
Since the default access modifier for a class in Java is "package-private", I think the closest you could get in Groovy to the same behavior would be to make the class "package-protected," which is done with the @PackageScope annotation:
@PackageScope class Person {
}
By the way, there's an open and unresolved bug (feature?) in Groovy that prevents any sort of "private" visibility from working. Implementation is planned for Groovy v3.0.
Problem
So, I can declare a class in Groovy as: ``` //groovy-code class Person { } ``` which is the equivalent to write in java something like: ``` //java-code public class Person { } ``` Just out of curiosity.. what's groovy equivalent to this coded in java: ``` //java-code class Person { } ``` I mean is there a way to achieve the same that I can achieve in Java by declaring something without an access modifier?