Skip to content

Commit 99ad676

Browse files
committed
Fix Comments
1 parent ba4c8d9 commit 99ad676

File tree

11 files changed

+12
-12
lines changed

11 files changed

+12
-12
lines changed

pages/concepts/external-refinements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ public interface SocketRefinements {
3737

3838
```java
3939
Socket socket = new Socket();
40-
socket.connect(new InetSocketAddress("example.com", 80)); // type error!
40+
socket.connect(new InetSocketAddress("example.com", 80)); // State Refinement Error
4141
socket.close();
4242
```

pages/concepts/ghosts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public interface StackRefinements<E> {
3535
Stack<String> s = new Stack<>();
3636
s.push("hello");
3737
s.pop();
38-
s.pop(); // type error!
38+
s.pop(); // State Refinement Error
3939
```
4040

4141
In the "constructor" method, the ghost variable `size` is initialized to 0. An equality in a method postcondition is how ghost variables are updated. However, here it is not necessary, since when no postcondition is declared, it is initialized to its default value, similarly to how Java initializes fields to their default values when no explicit initializer is provided (`int --> 0`, `boolean --> false`, etc.).

pages/concepts/state-refinements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class File {
3333
File f = new File();
3434
f.read();
3535
f.close();
36-
f.read(); // type error!
36+
f.read(); // State Refinement Error
3737
```
3838

3939
If a class follows an implicit protocol that can be described by a DFA, the protocol can be encoded in LiquidJava so that methods are enforced to be called in the correct order.

pages/examples/arraylist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public interface ArrayListRefinements<E> {
2929
ArrayList<Integer> list = new ArrayList<>();
3030
list.add(1);
3131
list.get(0);
32-
list.get(1); // type error!
32+
list.get(1); // Refinement Error
3333
```
3434

3535
The key idea is that LiquidJava turns the usual runtime condition for `get(i)` into a static precondition over the tracked `size` ghost variable.

pages/examples/counter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Counter {
3030
int c = 0;
3131
c = Counter.increment(c);
3232
c = Counter.decrement(c);
33-
c = Counter.decrement(c); // type error!
33+
c = Counter.decrement(c); // Refinement Error
3434
```
3535

3636
The parameter refinement on `decrement` requires the input to be strictly positive, so LiquidJava rejects the final call when `c` is already `0`.

pages/examples/downloader.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ d.finish();
4040
Downloader d = new Downloader();
4141
d.start();
4242
d.update(50);
43-
d.finish(); // type error!
44-
```
43+
d.finish(); // State Refinement Error
44+
```

pages/examples/email.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ email.from("me");
7474
Email email = new Email();
7575
email.from("me");
7676
.to("bob");
77-
.build(); // type error!
77+
.build(); // State Refinement Error
7878
```
7979

8080
LiquidJava enforces the intended protocol:

pages/examples/media-player.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ player.play();
3838
player.pause();
3939
player.resume();
4040
player.stop();
41-
player.resume(); // type error!
41+
player.resume(); // State Refinement Error
4242
```
4343

4444
Because `resume` is only valid from `paused()`, the final call is rejected after `stop()` puts the object back in `stopped()`.

pages/examples/order.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Order order = new Order();
5252
order.addItem("shirt", 60)
5353
.addItem("shoes", 80)
5454
.checkout()
55-
.pay(120); // type error!
55+
.pay(120); // State Refinement Error
5656
```
5757

5858
This example enforces the intended protocol:

pages/examples/reentrant-lock.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface ReentrantLockRefinements {
3131
ReentrantLock lock = new ReentrantLock();
3232
lock.lock();
3333
lock.unlock();
34-
lock.unlock(); // type error
34+
lock.unlock(); // State Refinement Error
3535
```
3636

3737
The external refinement enforces the expected protocol: `lock()` is only allowed when the object is `unlocked()`, and `unlock()` is only allowed when it is `locked()`.

0 commit comments

Comments
 (0)