GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — A for loop over indices forgets the list's ghost, so i < l.size() does not prove l.get(i) · Issue #479 · liquid-java/liquidjava Open DescriptionSummaryIn Minimal reproducer
import liquidjava.specification.ExternalRefinementsFor; import liquidjava.specification.Ghost; import liquidjava.specification.Refinement; import liquidjava.specification.StateRefinement; @ExternalRefinementsFor("java.util.ArrayList") @Ghost("int size") public interface ArrayListRefinements<E> { @StateRefinement(to = "size(this) == 0") void ArrayList(); @StateRefinement(to = "size(this) == size(old(this)) + 1") boolean add(E e); E get(@Refinement("_ >= 0 && _ < size(this)") int index); @Refinement("_ == size(this) && _ >= 0") int size(); }
import java.util.ArrayList; public class Client { public static void main(String[] args) { ArrayList<String> l = new ArrayList<>(); l.add("a"); l.add("b"); for (int i = 0; i < l.size(); i++) { String s = l.get(i); // Refinement Error } } } Output on Expected: Seen on 1a506fe and Why it matters: real codeThis is the commonest way to walk a list. A spec that tracks a list's size (so that Found while writing an ArrayList spec (liquid-java/co-specification, verifier probe V37). ActivityMetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |