playframework / play-enhancer

14 stars 9 forks source link

Deprecate and document alternatives #18

Open dwijnand opened 5 years ago

dwijnand commented 5 years ago

Some of the possible alternatives:

  1. Lombok + subprojects for the annotated classes
  2. Writing the boilerplate code
  3. AutoValue?
mkurz commented 5 years ago

That won't work because it's not possible to access lombok generated code from within Scala (=twirl) code. More information can be found in my old comment here: https://github.com/playframework/playframework/pull/4006#issuecomment-81049150

mkurz commented 5 years ago

The Scala compiler doesn't know anything about what lombok annotations will generate, hence it can't access lombok generated methods: https://github.com/scala/scala/tree/2.13.x/src/compiler/scala/tools/nsc/javac

mkurz commented 5 years ago

Here is also a good explanation. The problem is the Scala parser does not support/run an annotation processor.

dwijnand commented 5 years ago

As feared. Thanks for the wonderful explanation and links, @mkurz!

marcospereira commented 5 years ago

Thanks, @mkurz!

Well, play-enhancer stills not a good solution, and I think we need to deprecate it anyway even if Lombok is not a drop-in replacement. Maybe this issue is about documenting the alternatives (write the code yourself, use Lombok with a subproject).

mkurz commented 5 years ago

Yeah. I personally use Lombok within subprojects for my Play-Java projects. That works fine.

marcospereira commented 5 years ago

I've reopened and edited the title and description.

mkurz commented 5 years ago

Or just wait until Java itself catches up :laughing: :rofl: (like https://cr.openjdk.java.net/~briangoetz/amber/datum.html)

ignasi35 commented 5 years ago

Or just wait until Java itself catches up

buys a comfortable chair

marcospereira commented 5 years ago

One thing that we can do just right now is to avoid using it in our sample applications. Not a 100% sure, but I think https://github.com/playframework/play-java-ebean-example is the only one using it.

ignasi35 commented 5 years ago

A quick, naïve search in my local repos:

find . | grep plugins.sbt | xargs grep enhanc| awk -F\/  '{print $2 }' | uniq
play-java-fileupload-example
play-java-grpc-example
play-java-jpa-example
play-java-starter-example
playframework

I wouldn't be suprised if it's used somewhere else.

PS: I don't see it used in playframework/play-java-ebean-example

dwijnand commented 5 years ago

From https://github.com/search?l=Scala&q=org%3Aplayframework+sbt-play-enhancer+-repo%3Aplayframework%2Fplay-enhancer&type=Code:

Other projects:

marcospereira commented 5 years ago

Yeah, for most of these samples, I don't think it is necessary. But I think play-ebean requires it, so we can just remove from all the other examples not using Ebean and use alternatives.