Skip to content

Add opt-in for sprout-generated interfaces #1406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

alancai98
Copy link
Member

@alancai98 alancai98 commented Mar 30, 2024

Relevant Issues

Description

  • Add sprout opt-in annotation DoNotImplementInterface option for sprout-generated interfaces
  • Currently annotation added for just the public plan's PlanVisitor
// Snippet from `PlanVisitor.kt`
/**
 * WARNING: This interface should not be implemented or extended by code outside of this library.
 * Please extend [PlanBaseVisitor].
 */
@DoNotImplementInterface
public interface PlanVisitor<R, C> {
  public fun visit(node: PlanNode, ctx: C): R

  public fun visitPartiQLPlan(node: PartiQLPlan, ctx: C): R
  ...

Other Information

  • Updated Unreleased Section in CHANGELOG: [NO]

  • Any backward-incompatible changes? [YES/NO]

Still TBD. Adding the opt-in annotation could be a breaking change.

License Information

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@alancai98 alancai98 self-assigned this Mar 30, 2024
Copy link

github-actions bot commented Mar 30, 2024

Conformance comparison report

Base (92cc57a) 44e9a8f +/-
% Passing 92.54% 92.54% 0.00%
✅ Passing 5384 5384 0
❌ Failing 434 434 0
🔶 Ignored 0 0 0
Total Tests 5818 5818 0

Number passing in both: 5384

Number failing in both: 434

Number passing in Base (92cc57a) but now fail: 0

Number failing in Base (92cc57a) but now pass: 0

@alancai98 alancai98 force-pushed the add-interface-annotation branch from d69153d to f3e30d8 Compare March 30, 2024 02:22
@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.14%. Comparing base (92cc57a) to head (fa26dc7).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1406   +/-   ##
=========================================
  Coverage     73.14%   73.14%           
  Complexity     2393     2393           
=========================================
  Files           247      247           
  Lines         17623    17623           
  Branches       3176     3176           
=========================================
  Hits          12890    12890           
  Misses         3856     3856           
  Partials        877      877           
Flag Coverage Δ
CLI 11.82% <ø> (ø)
EXAMPLES 80.07% <ø> (ø)
LANG 81.04% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alancai98 alancai98 force-pushed the add-interface-annotation branch 2 times, most recently from dc1aee9 to 0010609 Compare April 1, 2024 19:36
@alancai98 alancai98 changed the title WIP add opt-in for sprout-generated interfaces Add opt-in for sprout-generated interfaces Apr 1, 2024
@alancai98 alancai98 force-pushed the add-interface-annotation branch from 0010609 to fa26dc7 Compare April 1, 2024 20:14
@alancai98 alancai98 marked this pull request as ready for review April 1, 2024 20:37
@@ -52,6 +52,7 @@ val generate = tasks.register<Exec>("generate") {
"--poems", "builder",
"--poems", "util",
"--opt-in", "org.partiql.value.PartiQLValueExperimental",
"--restrict-interface-impl",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, restricting interface implementation using the annotation is only used for the partiql-plan

@@ -56,10 +63,17 @@ class KotlinCommand : Callable<Int> {
val input = BufferedReader(FileInputStream(file).reader()).readText()
val parser = SproutParser.default()
val universe = parser.parse(id, input)
if (restrictInterfaceImpl) {
// If interface implementations are restricted, add annotation to opt-in for generated sources.
// Currently only applies for the visitor interface.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, just apply the interface implementation restriction for the visitor interface

@alancai98
Copy link
Member Author

Closing this PR. Will reopen still targeting main. New PR will add just the warning and not the opt-in annotation since the annotation and the configurability in the command options may be overkill. We can always add such functionality to sprout if a need arises.

@alancai98 alancai98 closed this Apr 4, 2024
@alancai98 alancai98 deleted the add-interface-annotation branch April 4, 2024 22:09
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.

[sprout] Add warning/@OptIn option for sprout-generated interfaces
2 participants