Skip to content

Commit 0874633

Browse files
authored
Merge pull request #694 from scala/DarkDimius-patch-5
@stableabi More fixes to html version
2 parents 1dc51d3 + 17f5871 commit 0874633

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sips/pending/_posts/2017-01-13-binary-compatibility.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ As defined by the JVM spec\[[4]\]:
3636
runtime as they no longer link to the changed field.
3737

3838
In this document we use the term `binary descriptor` to refer to both method and field descriptors used by the JVM.
39+
3940
* ##### Public API
4041

4142
Methods and fields marked with `ACC_PUBLIC`\[[5]\] may be accessed from any class and package.
@@ -50,6 +51,7 @@ As defined by the JVM spec\[[4]\]:
5051

5152
In this document we use the term `Public API` to refer both to methods and fields defined as `ACC_PUBLIC` and `ACC_PROTECTED`.
5253
Changes do binary descriptors of Public API may lead to runtime linkage failures.
54+
5355
* ##### Binary compatibility
5456

5557
Two versions of the same class are called binary compatible if there are no changes to the Public API of this class,
@@ -101,6 +103,7 @@ This is because we will be able to allow more features later, but we won't have
101103

102104
## Overview ##
103105
In order for a class, trait or an object to succeed compilation with the `@stableABI` annotation it has to be:
106+
104107
- defined on the top level;
105108
- if a class or an object has a companion annotated with `@stableABI`, than annotation applies to both of them;
106109
- use a subset of Scala that during compilation does not require changes to public API of the class, including
@@ -164,6 +167,7 @@ Note that while those features are prohibited in the public API, they can be saf
164167
- case classes. Can be simulated by explicitly defining getters and other members synthesized for a case class(`copy`, `productArity`, `apply`, `unapply`, etc).
165168

166169
The features listed below cannot be easily re-implemented in a class or trait annotated with `@stableABI`.
170+
167171
- default arguments;
168172
- default methods. See Addendum;
169173
- constant types(both explicit and inferred);
@@ -194,6 +198,7 @@ While in perfect world it would be nice to require all `@stableABI` classes and
194198
and only return `@stableABI` values, we believe that all-or-nothing system will be a lot harder to adopt and migrate to.
195199

196200
Because of this we propose to emmit warnings in those cases:
201+
197202
- non-`@stableABI` value is returned from a method or field defined inside a `@stableABI` class or trait;
198203
- an invocation to a method not-defined inside a `@stableABI` class is used in
199204
implementation of a method or a field initializer inside a `@stableABI` class or trait.
@@ -237,6 +242,7 @@ This provides early guidance and warning when designing long-living APIs before
237242

238243
## Compilation scheme ##
239244
No modification of typer or any existing phase is planned. The current proposed scheme introduces a late phase that runs before the very bytecode emission that checks that:
245+
240246
- classes, traits and objects annotated as `@stableABI` are on the top level;
241247
- compiler did not introduce new Public API methods or fields inside `@stableABI` classes, traits and objects;
242248
- compiler did not change descriptors of existing Public API methods or fields inside `@stableABI` classes, traits and objects.

0 commit comments

Comments
 (0)