@@ -579,6 +579,19 @@ is defined but not implemented. Such an un-implemented abstract method is someth
579
579
we want to avoid, even if our artifact version constraints mean it should technically
580
580
never get called.
581
581
582
+ ### Hiding Generated Forwarder Methods
583
+
584
+ As the generated forwarder methods are intended only for binary compatibility purposes,
585
+ we should generally hide them: IDEs, downstream compilers, ScalaDoc, etc. should behave as
586
+ if the generated methods do not exist.
587
+
588
+ This is done in two different ways:
589
+
590
+ 1 . In Scala 2, we generate the methods in a post-` pickler ` phase. This ensures they do
591
+ not appear in the scala signature, and thus are not exposed to downstream tooling
592
+
593
+ 2 . In Scala 3, the generated methods are flagged as ` Invisible `
594
+
582
595
## Limitations
583
596
584
597
### Only the one parameter list of multi-parameter list methods can be ` @unroll ` ed.
@@ -825,25 +838,6 @@ object Unrolled{
825
838
```
826
839
827
840
828
- ### Should the Generated Methods be Deprecated or Invisible?
829
-
830
- It is not clear to me if we should discourage usage of the generated forwarders
831
- methods, or hide them:
832
-
833
- 1 . On one hand, downstream code should not be compiling against these methods: they are
834
- purely for binary compatibility
835
-
836
- 2 . On the other hand, downstream code does not control which overload of the method is
837
- selected: that is up to the Scala compiler and how overloading interacts with default
838
- parameter values. I have encountered scenarios with manually-written forwarders where
839
- selected over the "primary" implementation
840
-
841
- 3 . The forwarders are meant to have the exact same semantics as the "primary" implementation.
842
- Thus it _ does not matter_ whether you call the primary and pass it a default value,
843
- or you call a forwarder which then calls the primary and passes it the same default value.
844
-
845
- For now, I have left the generated methods "as is", though choosing to hide them or deprecate
846
- them or something else is definitely an option
847
841
848
842
### Generating Forwarders For Parameter Type Widening or Result Type Narrowing
849
843
0 commit comments