Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package testSuite.classes.arraylist_correct;

import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.RefinementPredicate;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.*;

@ExternalRefinementsFor("java.util.ArrayList")
public interface ArrayListRefinements<E> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package testSuite.classes.socket_error;

import java.net.SocketAddress;
import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
import liquidjava.specification.*;

@ExternalRefinementsFor("java.net.Socket")
@StateSet({"unconnected", "binded", "connected", "closed"})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package testSuite.classes.state_multiple_cases_correct;

import java.io.InputStream;
import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.Refinement;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
import liquidjava.specification.*;

// https://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html
@ExternalRefinementsFor("java.io.InputStreamReader")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Optional<Predicate> getRefinementFromAnnotation(CtElement element) throws
Optional<Predicate> constr = Optional.empty();
Optional<String> ref = Optional.empty();
for (CtAnnotation<? extends Annotation> ann : element.getAnnotations()) {
String an = ann.getActualAnnotation().annotationType().getCanonicalName();
String an = ann.getAnnotationType().getQualifiedName();
if (an.contentEquals("liquidjava.specification.Refinement")) {
String value = getStringFromAnnotation(ann.getValue("value"));
ref = Optional.of(value);
Expand Down Expand Up @@ -93,7 +93,7 @@ public Optional<Predicate> getRefinementFromAnnotation(CtElement element) throws
@SuppressWarnings({ "rawtypes" })
public Optional<String> getMessageFromAnnotation(CtElement element) {
for (CtAnnotation<? extends Annotation> ann : element.getAnnotations()) {
String an = ann.getActualAnnotation().annotationType().getCanonicalName();
String an = ann.getAnnotationType().getQualifiedName();
if (an.contentEquals("liquidjava.specification.Refinement")) {
Map<String, CtExpression> values = ann.getAllValues();
String msg = getStringFromAnnotation((values.get("msg")));
Expand All @@ -109,7 +109,7 @@ public Optional<String> getMessageFromAnnotation(CtElement element) {
public void handleStateSetsFromAnnotation(CtElement element) throws LJError {
int set = 0;
for (CtAnnotation<? extends Annotation> ann : element.getAnnotations()) {
String an = ann.getActualAnnotation().annotationType().getCanonicalName();
String an = ann.getAnnotationType().getQualifiedName();
if (an.contentEquals("liquidjava.specification.StateSet")) {
set++;
createStateSet((CtNewArray<String>) ann.getAllValues().get("value"), set, element);
Expand Down Expand Up @@ -266,7 +266,7 @@ protected void handleAlias(String ref, CtElement element, SourcePosition positio

Optional<CtAnnotation<?>> getExternalRefinement(CtInterface<?> intrface) {
for (CtAnnotation<? extends Annotation> ann : intrface.getAnnotations())
if (ann.getActualAnnotation().annotationType().getCanonicalName()
if (ann.getAnnotationType().getQualifiedName()
.contentEquals("liquidjava.specification.ExternalRefinementsFor")) {
return Optional.of(ann);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class AuxStateHandler {
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void handleConstructorState(CtConstructor<?> c, RefinedFunction f, TypeChecker tc) throws LJError {
List<CtAnnotation<? extends Annotation>> an = getStateAnnotation(c);
List<CtAnnotation<? extends Annotation>> an = getStateAnnotations(c);
if (!an.isEmpty()) {
for (CtAnnotation<? extends Annotation> a : an) {
Map<String, CtExpression> m = a.getAllValues();
Expand Down Expand Up @@ -140,7 +140,7 @@ private static List<GhostFunction> getDifferentSets(TypeChecker tc, String klass
*/
public static void handleMethodState(CtMethod<?> method, RefinedFunction f, TypeChecker tc, String prefix)
throws LJError {
List<CtAnnotation<? extends Annotation>> an = getStateAnnotation(method);
List<CtAnnotation<? extends Annotation>> an = getStateAnnotations(method);
if (!an.isEmpty()) {
setFunctionStates(f, an, tc, method, prefix);
}
Expand Down Expand Up @@ -611,9 +611,8 @@ static VariableInstance getTarget(CtElement invocation) {
return null;
}

private static List<CtAnnotation<? extends Annotation>> getStateAnnotation(CtElement element) {
return element.getAnnotations().stream().filter(ann -> ann.getActualAnnotation().annotationType()
.getCanonicalName().contentEquals("liquidjava.specification.StateRefinement"))
.collect(Collectors.toList());
private static List<CtAnnotation<? extends Annotation>> getStateAnnotations(CtElement element) {
return element.getAnnotations().stream().filter(ann -> ann.getAnnotationType().getQualifiedName()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

.contentEquals("liquidjava.specification.StateRefinement")).collect(Collectors.toList());
}
}
Loading