Skip to content

Commit 0b40a45

Browse files
committed
Update Docs
1 parent 1742eea commit 0b40a45

7 files changed

Lines changed: 25 additions & 15 deletions

File tree

pages/annotations/external-refinements-for.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ import java.net.*;
2020
public interface SocketRefinements {
2121
@StateRefinement(to="unconnected()")
2222
public void Socket();
23-
23+
2424
@StateRefinement(from="unconnected()", to="bound()")
2525
public void bind(SocketAddress add);
26-
26+
2727
@StateRefinement(from="bound()", to="connected()")
2828
public void connect(SocketAddress add);
29-
29+
3030
@StateRefinement(from="connected()")
3131
public void sendUrgentData(int n);
32-
32+
3333
@StateRefinement(from="!closed()", to="closed()")
3434
public void close();
3535
}

pages/annotations/refinement-alias.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ public class MyClass {
2424
}
2525
```
2626

27-
This helps keep contracts shorter and easier to maintain by giving common constraints a domain-specific name and reusing them in.
27+
This helps keep contracts shorter and easier to maintain by replacing repeated predicates with a domain-specific alias.

pages/annotations/refinements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Refinement predicates use a language similar to Java, where you can write boolea
4343
| Logic | `!` `&&` <code>&#124;&#124;</code> `-->` | `@Refinement("0 <= y && y <= 100") int y = 25` |
4444
| Arithmetic | `+` `-` `*` `/` `%` | `@Refinement("v + 20 < 100") int v = 79` |
4545
| Conditional | `cond ? e1 : e2` | `@Refinement("a > b ? _ == a : _ == b") int max(int a, int b)` |
46-
| Ghosts | `ghost(...args)` | `@Refinement("0 <= _ < size(this)") int index` |
46+
| Ghosts | `ghost(...args)` | `@Refinement("0 <= _ && _ < size(this)") int index` |
4747
| Aliases | `Alias(...args)` | `@Refinement("Positive(_)") int c = 10` |
4848
| Literals | `true` `false` `0` `1.5` | `@Refinement("true") void print()` |
4949
| Enums | `EnumType.Value` | `@Refinement("_ == Status.Open") Status status` |

pages/examples/email.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,25 @@ public class Email {
2121
@StateRefinement(to="empty()")
2222
public Email() {}
2323

24+
@Refinement("_ == this")
2425
@StateRefinement(from="empty()", to="senderSet()")
25-
public Email from(String s) {}
26+
public Email from(String s) { return this; }
2627

28+
@Refinement("_ == this")
2729
@StateRefinement(from="senderSet() || receiverSet()", to="receiverSet()")
28-
public Email to(String s) {}
30+
public Email to(String s) { return this; }
2931

32+
@Refinement("_ == this")
3033
@StateRefinement(from="receiverSet()")
31-
public Email subject(String s) {}
34+
public Email subject(String s) { return this; }
3235

36+
@Refinement("_ == this")
3337
@StateRefinement(from="receiverSet()", to="bodySet()")
34-
public Email body(String s) {}
38+
public Email body(String s) { return this; }
3539

40+
@Refinement("_ == this")
3641
@StateRefinement(from="bodySet()")
37-
public Email build() {}
42+
public Email build() { return this; }
3843
}
3944
```
4045

pages/examples/order.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ public class Order {
1919
@StateRefinement(to="ordering() && total() == 0")
2020
public Order() {}
2121

22+
@Refinement("_ == this")
2223
@StateRefinement(from="ordering()", to="ordering() && total() == total(old(this)) + price")
23-
public Order addItem(String name, @Refinement("_ > 0") int price) {}
24+
public Order addItem(String name, @Refinement("_ > 0") int price) { return this; }
2425

26+
@Refinement("_ == this")
2527
@StateRefinement(from="ordering() && total() > 0", to="checkout() && total() == total(old(this))")
26-
public Order checkout() {}
28+
public Order checkout() { return this; }
2729

30+
@Refinement("_ == this")
2831
@StateRefinement(from="checkout() && amount == total()", to="finished()")
29-
public Order pay(@Refinement("_ > 0") int amount) {}
32+
public Order pay(@Refinement("_ > 0") int amount) { return this; }
3033
}
3134
```
3235

pages/getting-started/overview.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ These make it possible to catch bugs that the standard Java type system cannot,
2424
## Example
2525

2626
```java
27+
import liquidjava.specification.Refinement;
28+
2729
public class Example {
2830
public static int divide(int a, @Refinement("b != 0") int b) {
2931
return a / b;

pages/getting-started/setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ mvn clean install
6969

7070
This runs the verifier on your project and prints any errors to the console.
7171

72-
> You can find more about the command-line interface [here]({{ '/command-line-interface/' | relative_url }}).
72+
> You can find more about the command-line interface [here]({{ '/command-line-interface/' | relative_url }}).

0 commit comments

Comments
 (0)