I would like to create a Java class that follows the Scala setters/getters convention.
I tried following simple class, but it does not work:
public c
I’m afraid you can’t. In Scala, the accessor has to be method with no parameter list, like def a = _a
. Writing e.g. def a() = _a
in Scala would cause the same error, and there is no way that you can define a method with no parameter list in Java. You may be able to fool the Scala compiler by generating your own ScalaSignature
, but that's probably not worth the trouble…