@@ -42,7 +42,7 @@ window.LIQUID_JAVA_TUTORIAL = {
4242
4343public class RGB {
4444 public static void main(String[] args) {
45- // Add the RGB channel refinement here
45+ // Add the RGB refinement here
4646 int red = 300;
4747 }
4848}` ,
@@ -94,12 +94,12 @@ public class RGB {
9494 "Method refinements describe which calls are valid and what the implementation promises about its result." ,
9595 concept : {
9696 label : "Inputs and outputs" ,
97- code : `@Refinement("_ == numerator / denominator ")
97+ code : `@Refinement("_ == x / y ")
9898public static int divide(
99- int numerator ,
100- @Refinement("_ != 0") int denominator
99+ int x ,
100+ @Refinement("_ != 0") int y
101101) {
102- return numerator / denominator ;
102+ return x / y ;
103103}` ,
104104 explanation :
105105 "The parameter contract prevents division by zero. The return contract connects the result to the two inputs." ,
@@ -177,6 +177,9 @@ public class Midpoint {
177177 label : "Follow the transition" ,
178178 code : `@StateSet({"off", "on"})
179179public class LightBulb {
180+ @StateRefinement(to="off(this)")
181+ public void LightBulb() { } // Constructor
182+
180183 @StateRefinement(from="off(this)", to="on(this)")
181184 public void turnOn() { }
182185}` ,
@@ -208,7 +211,7 @@ import liquidjava.specification.StateSet;
208211@StateSet({"unconnected", "bound", "connected", "closed"})
209212public interface SocketRefinements {
210213 @StateRefinement(to="unconnected(this)")
211- public void Socket();
214+ public void Socket(); // Constructor
212215
213216 @StateRefinement(from="true", to="true")
214217 public void bind(SocketAddress add);
@@ -301,7 +304,12 @@ public interface SocketRefinements {
301304 code : `@ExternalRefinementsFor("java.util.ArrayList")
302305@Ghost("int size")
303306public interface ArrayListRefinements<E> {
304- @StateRefinement(to="size(this) == size(old(this)) + 1")
307+ @StateRefinement(to="size(this) == 0")
308+ public void ArrayList(); // Constructor
309+
310+ @StateRefinement(
311+ to="size(this) == size(old(this)) + 1"
312+ )
305313 public boolean add(E element);
306314}` ,
307315 explanation :
@@ -324,7 +332,7 @@ import liquidjava.specification.StateRefinement;
324332@Ghost("int size")
325333public interface StackRefinements<E> {
326334 @StateRefinement(to="true")
327- public void Stack();
335+ public void Stack(); // Constructor
328336
329337 @StateRefinement(to="true")
330338 public E push(E elem);
0 commit comments