Klitos Kyriacou
04/14/2022, 8:38 AMval sqlServerDataSource = SQLServerDataSource()
sqlServerDataSource.url = myUrl
sqlServerDataSource.user = myUser
sqlServerDataSource.password = myPassword
The error is:
Cannot access 'password': it is public/*package*/ for synthetic extension in '<library Maven: com.microsoft.sqlserver:mssql-jdbc:10.2.0.jre17>'
There is no error on url or user; only on password. If I replace it with sqlServerDataSource.setPassword(myPassword)
it works. But why can't I use the property syntax, and what exactly does the error message mean, and why only password has this error?public void setPassword(String password)
but only a package-private String getPassword()
. This prevents Kotlin from synthesizing a password
property.
Is this intentional, or is it a bug?Michael de Kaste
04/14/2022, 9:24 AMVampire
04/14/2022, 9:26 AMNote that, if the Java class only has a setter, it isn't visible as a property in Kotlin because Kotlin doesn't support set-only properties.
ephemient
04/14/2022, 10:21 AM