groovy Visiblity Private fields and methods are not private in groovy

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

class MyClass { 
    private String privateField 
} 

def prvtClss = new MyClass(privateField: 'qwerty') 
println prvtClss.privateField

will print us 'qwerty'

This issue is known since version 1.1 and there is a bug report on that: http://jira.codehaus.org/browse/GROOVY-1875. It is not resolved even with groovy 2 release.



Got any groovy Question?