-
Notifications
You must be signed in to change notification settings - Fork 34
Update Annotations Javadocs #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,17 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to allow the creation of multiple @Ghost | ||
| * Annotation to allow the creation of multiple `@Ghost` annotations in a class or interface | ||
| * e.g. `@GhostMultiple({@Ghost("int size"), @Ghost("boolean isEmpty")})` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE}) | ||
| public @interface GhostMultiple { | ||
|
|
||
| /** | ||
| * The array of `@Ghost` annotations to be created | ||
| */ | ||
| Ghost[] value(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,16 +6,22 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to add a refinement to variables, class fields, method's parameters and method's | ||
| * return value e.g. @Refinement("x > 0") int x; | ||
| * Annotation to add a refinement to variables, class fields, method's parameters and method's return values | ||
| * e.g. `@Refinement("x > 0") int x;` | ||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER, ElementType.TYPE}) | ||
| public @interface Refinement { | ||
|
|
||
| /** | ||
| * The refinement string | ||
| */ | ||
| public String value(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets say here what are the restrictions - like logical expression, bla bla |
||
|
|
||
| /** | ||
| * An optional message to be included in the error message when the refinement is violated | ||
| */ | ||
| public String msg() default ""; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More concise: Error message when the refinement is violated (optional) |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,14 +7,18 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to create a ghost variable for a class. The annotation receives the type and name of | ||
| * the ghost within a string e.g. @RefinementAlias("Nat(int x) {x > 0}") | ||
| * Annotation to create a refinement alias | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets say what an alias means |
||
| * e.g. `@RefinementAlias("Nat(int x) { x > 0 }")` | ||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE}) | ||
| @Repeatable(RefinementAliasMultiple.class) | ||
| public @interface RefinementAlias { | ||
|
|
||
| /** | ||
| * The refinement alias string, which includes the name of the alias, its parameters and the refinement itself | ||
| */ | ||
| public String value(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,17 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to create a multiple Alias in a class | ||
| * Annotation to create multiple refinement aliases | ||
| * e.g. `@RefinementAliasMultiple({@RefinementAlias("Nat(int x) { x > 0 }"), @RefinementAlias("Pos(int x) { x >= 0 }")})` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again we dont want this right, its by omission |
||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE}) | ||
| public @interface RefinementAliasMultiple { | ||
|
|
||
| /** | ||
| * The array of `@RefinementAlias` annotations to be created | ||
| */ | ||
| RefinementAlias[] value(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,18 @@ | |
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to allow the creation of multiple `@RefinementPredicate` annotations | ||
| * e.g. `@RefinementPredicateMultiple({`@RefinementPredicate("ghost int size")`, `@RefinementPredicate("type Nat(int x) { x > 0 }")`})` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can just erase these lines |
||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||
| public @interface RefinementPredicateMultiple { | ||
|
|
||
| /** | ||
| * The array of `@RefinementPredicate` annotations to be created | ||
| */ | ||
| RefinementPredicate[] value(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,20 +7,28 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to create state transitions in a method. The annotation has three arguments: from : the | ||
| * state in which the object needs to be for the method to be invoked correctly to : the state in | ||
| * which the object will be after the execution of the method msg : optional custom error message to display when refinement is violated | ||
| * e.g. @StateRefinement(from="open(this)", to="closed(this)") | ||
| * Annotation to create state transitions in a method | ||
| * e.g. `@StateRefinement(from="open(this)", to="closed(this)", msg="The object needs to be open before closing")` | ||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||
| @Repeatable(StateRefinementMultiple.class) | ||
| public @interface StateRefinement { | ||
|
|
||
| /** | ||
| * The state in which the object needs to be before calling the method | ||
| */ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets say, logical expression, bla bla |
||
| public String from() default ""; | ||
|
|
||
| /** | ||
| * The state in which the object will be after calling the method | ||
| */ | ||
| public String to() default ""; | ||
|
|
||
| /** | ||
| * Optional custom error message to be included in the error message when the `from` is violated | ||
| */ | ||
| public String msg() default ""; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,13 +6,17 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Interface to allow multiple state refinements in a method. A method can have a state refinement | ||
| * for each set of different source and destination states | ||
| * Annotation to allow the creation of multiple `@StateRefinement` annotations | ||
| * e.g. `@StateRefinementMultiple({@StateRefinement(from="open(this)", to="closed(this)"), @StateRefinement(from="closed(this)", to="open(this)")})` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again nop |
||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) | ||
| public @interface StateRefinementMultiple { | ||
|
|
||
| /** | ||
| * The array of `@StateRefinement` annotations to be created | ||
| */ | ||
| StateRefinement[] value(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,15 +7,18 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Annotation to create the disjoint states in which class objects can be. The annotation receives a | ||
| * list of strings representing the names of the states. e.g. @StateSet({"open", "reading", | ||
| * "closed"}) | ||
| * Annotation to create the disjoint states in which class objects can be | ||
| * e.g. @StateSet({"open", "reading", "closed"}) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets say more like, an object will always have to be in one of these states at every point in the program, it cannot be in two multiple states of the same state set (e.g., open and close simultaneously). |
||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE}) | ||
| @Repeatable(StateSets.class) | ||
| public @interface StateSet { | ||
|
|
||
| /** | ||
| * The array of states to be created | ||
| */ | ||
| public String[] value(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,12 +6,17 @@ | |
| import java.lang.annotation.Target; | ||
|
|
||
| /** | ||
| * Interface to allow multiple StateSets in a class. | ||
| * Annotation to allow the creation of multiple `@StateSet` annotations | ||
| * e.g. `@StateSets({@StateSet({"open", "reading", "closed"}), @StateSet({"on", "off"})})` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again this is not how we use it |
||
| * | ||
| * @author catarina gamboa | ||
| */ | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Target({ElementType.TYPE}) | ||
| public @interface StateSets { | ||
|
|
||
| /** | ||
| * The array of `@StateSet` annotations to be created | ||
| */ | ||
| StateSet[] value(); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add some examples! like "java.lang.Math"