Skip to content

Commit 6ada97c

Browse files
add more documentation
1 parent d754a8e commit 6ada97c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,28 @@ $ git submodule add https://github.com/bldl/java-variance
3838

3939
## Usage
4040

41+
### Annotations
42+
43+
There are currently three annotations provided by this project: MyVariance, Covariant and Contravariant. With these you are able to annotate type parameters for classes in order to
44+
45+
#### MyVariance
46+
47+
MyVariance is the most customizable one, and allows you to experiment with different types of variance. With this one there are several parameters you can provide to specify what variance rules should apply:
48+
49+
| Parameter | Description | Possible values |
50+
| ---------- | ----------------------------------------- | ----------------------------------- |
51+
| `variance` | Specifies which variance to use | COVARIANT, CONTRAVARIANT, INVARIANT |
52+
| `depth` | How deep subtyping goes | Integer value ≥ 0 |
53+
| `strict` | Whether strict checks should be performed | `true`, `false` |
54+
55+
#### Covariant
56+
57+
Covariant is a specific instance of MyVariance. It's intended to inline with the semantics of traditional covariance. It acts as MyVariance with `variance` set to `COVARIANT`, `depth` as infinite and `strict` to `true`.
58+
59+
#### Contravariant
60+
61+
Contravariant, similarly to Covariant, aims to inline with the semantics of traditional contravariance. It acts as MyVariance with `variance` set to `CONTRAVARIANT`, `depth` as infinite and `strict` to `true`.
62+
4163
### Subsection
4264

4365
## Contributing

src/main/java/anthonisen/felix/annotationProcessing/annotations/MyVariance.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* }
2525
* </pre>
2626
*
27-
* @see VarianceType
27+
* @see {@link VarianceType}
2828
*/
2929
@Retention(RetentionPolicy.SOURCE)
3030
@Target(ElementType.TYPE_PARAMETER)

0 commit comments

Comments
 (0)