Skip to content

BuildInfoOption.ConstantValue#164

Merged
eed3si9n merged 1 commit intomasterfrom
wip/constantvalue
Aug 9, 2020
Merged

BuildInfoOption.ConstantValue#164
eed3si9n merged 1 commit intomasterfrom
wip/constantvalue

Conversation

@eed3si9n
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n commented Aug 8, 2020

This is a rework of #140

Looking closely it doesn't look like ScalaFinalCaseObjectRenderer added in #140 is actually going to be useful since it just added final in front of all vals.

This provides fix for #127 by generating constant value definition for Int, Long, Double, Boolean, Symbol, and String.

This allows the values to be used in annotation as the scripted test show. Note due to constant folding using this is not recommended for libraries.

usage

buildInfoOptions ++= Seq(BuildInfoOption.ConstantValue, BuildInfoOption.PackagePrivate),

This should generate

final val name = "helloworld"

@eed3si9n eed3si9n added this to the 0.10.0 milestone Aug 8, 2020
This is a rework of #140

Looking closely it doesn't look like `ScalaFinalCaseObjectRenderer` added in #140 is actually going to be useful since it just added `final` in front of all vals.

This provides fix for #127 by generating [constant value definition](https://www.scala-lang.org/files/archive/spec/2.12/04-basic-declarations-and-definitions.html#value-declarations-and-definitions) for `Int`, `Long`, `Double`, `Boolean`, `Symbol`, and `String`.

This allows the values to be used in annotation as the scripted test show. Note due to constant folding using this is not recommended for libraries.
@eed3si9n eed3si9n force-pushed the wip/constantvalue branch from b4d1990 to 0842feb Compare August 9, 2020 00:09
@eed3si9n eed3si9n merged commit 70b933c into master Aug 9, 2020
@eed3si9n eed3si9n deleted the wip/constantvalue branch August 9, 2020 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant