BeanInfo alternative

Just found out that @BeanInfo has been deprecated. What’s the reasoning behind that?

It provided a quick way to ensure that normal Scala methods (without get/set prefix) could be used as beans.

What appears to be left, is the cumbersome @BeanProperty, which not only has to be applied for every single property, but also results in one or two extra generated methods per property.

Did I miss a replacement?

Hi Nils

It’s an un(der)-tested and un(der)-maintained feature. I looked at it two years ago and found so many issues that it seemed unlikely that someone would be successfully using it. Here’s the (short) discussion from back then: https://groups.google.com/forum/#!topic/scala-internals/wI78prtTtKE/discussion

If there’s interest in keeping the feature, contributions are very welcome. In a first step, an extensive test suite would be good to have. This doesn’t need to come with bug fixes, it can test the current state of things, to make sure that at least we stay bug-compatible.

Maybe the feature can be implemented differently with a macro annotation, but that currently requires the “macro paradise” compiler plugin. This might change in a later 2.12.x release (a new macro system is being worked on).

Lukas

I’ve used it successfully many times to turn basic case classes into read-only beans, or more specifically marking those methods as getters. I’ve never had the need to use the other stuff you mention, so it’s probably broken as you’ve found.

However, it still seems there’s some value in the existing annotation, particularly considering there’s no real alternative.