-
Notifications
You must be signed in to change notification settings - Fork 63
Add AGORA invariants #497
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
Open
juaaloval
wants to merge
146
commits into
codespecs:master
Choose a base branch
from
juaaloval:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add AGORA invariants #497
Changes from 6 commits
Commits
Show all changes
146 commits
Select commit
Hold shift + click to select a range
1da1698
Add Beet invariants and modifications in computeConfidence functions
juaaloval d44d50d
Remove double quotes from Texinfo
juaaloval b13b587
Remove comparison using reference equality instead of value equality
juaaloval 05306ea
Change EOL chars again
juaaloval ff8c123
Run make reformat
juaaloval 39f5376
Fix nullness typechecking warnings
mernst 8381479
Remove boilerplate comments
mernst 2f71044
Merge ../daikon-fork-mernst-branch-no-we-are-serializable
mernst 4361507
Remove boilerplate comments
mernst 753b103
Don't require Javadoc
mernst 3057b65
Merge ../daikon-fork-mernst-branch-no-we-are-serializable
mernst a166354
Remove import wildcards in Daikon.java
juaaloval 94c8460
Convert string patterns into private static variables
juaaloval 335cdad
Remove changes in computeConfidence
juaaloval 37d1a6b
Fix test typecheck
juaaloval 437fb28
Remove unrequired import
juaaloval 47d646b
Compute confidence referencing Invariant class
juaaloval e1cff75
Fix Signedness Checker warnings
mernst 4403d92
Merge ../daikon-branch-master into no-we-are-serializable
mernst e84472b
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-no-w…
mernst 3a17680
Reinstate cast
mernst 3d3270d
Update Checker Framework
mernst 21a408c
Typecheck with both bundled CF and latest CF
mernst 33f2af5
Typecheck with both bundled CF and latest CF
mernst c9a9655
Use script instead of direct command
mernst 5034620
Reinstate cast
mernst a1e78ea
Remove JAVACHECK_EXTRA_ARGS
mernst 7fac2ea
Update checker.jar
mernst c35a35f
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-no-w…
mernst 6365fdb
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-remo…
mernst af3b661
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-type…
mernst 53e7491
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-no-w…
mernst 055b763
Merge /home/mernst/research/invariants/daikon-branch-master into type…
mernst e38ee22
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-type…
mernst 95ecbe5
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-no-w…
mernst b4fa11b
Formatting
mernst ba24338
Merge /home/mernst/research/invariants/daikon-branch-master
mernst 20c8864
Merge /home/mernst/research/invariants/daikon-branch-master
mernst ddc7443
Undo a change
mernst 68aa5eb
Merge branch 'master' into master
mernst a70c0bc
Merge ../daikon-fork-JuanCarlosAlonsoValenzuela into agora-javadoc
mernst 2900c7d
Add Javadoc for some Agora invariants
mernst 0394acb
Code review suggestions
mernst a7d28c3
Merge pull request #2 from mernst/agora-javadoc
juaaloval edd3609
Merge branch 'pr/1'
juaaloval 0afc34b
Add missing imports
juaaloval 1ca93f6
Remove unused variables
juaaloval 1069e37
Add missing documentation and convert regexes to public variables
juaaloval f5b6f56
Merge branch 'master' into master
juaaloval 18be64c
Fix Javadoc in `IsEmail.java`
mernst 387f1f4
Add missing documentation
juaaloval 41cf7f1
Improve diagnostics from test-misc.sh
mernst ce4a6bc
Add missing @return to Javadoc
juaaloval adedd6b
make reformat
juaaloval 69ce4ea
Merge ../daikon-fork-mernst-branch-ci-explanation
mernst c9f9c37
Merge branch 'master' of github.com:JuanCarlosAlonsoValenzuela/daikon
mernst 746e1d5
Merge branch 'master' into master
mernst 316964b
Changelog
mernst 1fd2996
Code review changes
mernst b2dc6c2
Agora tests
mernst 96dce5d
Merge ../daikon-fork-mernst-branch-empty-sequence
mernst 5afd592
Enable Agora invariants
mernst c382469
More Agora tests
mernst b40c9ea
Undo a change
mernst 7805e66
Fix crashes caused by arrays of strings containing null elements
juaaloval d764c14
make reformat
juaaloval a389cc8
Add new suppressor and fix FP possibly-null reference
juaaloval adee0a1
Replace suppressor with isObviousDynamically
juaaloval b3f138d
Add get_ni_suppressions and isObviousDynamically to SequenceFixedLeng…
juaaloval c681fa9
Merge ../daikon-branch-master
mernst 6665dd8
Style
mernst 10df849
Merge ../daikon-branch-master
mernst 2bfd849
Merge ../daikon-branch-master
mernst f8c3fd3
Fix .jpp errors
mernst a901d57
Remove trailing whitespace
mernst 16567b6
Reinstate trailing blank lines
mernst a1a6114
Ignore more files
mernst 2fb8ec4
Remove blank lines
mernst 526ca78
Add blank lines back
mernst ebcd346
Merge ../daikon-fork-mernst-branch-remove-trailing-whitespace
mernst 04dbc6a
Update test goals
mernst e55a13f
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst 00091b3
Add blank lines
mernst 1bc2a6e
Add blank lines back
mernst ac643b0
Show failure
mernst 1b0710a
Merge /home/mernst/research/invariants/daikon-fork-mernst-branch-remo…
mernst 1ebf874
Add length invariant output
mernst 6878e69
Merge /home/mernst/research/invariants/daikon-branch-master
mernst d883e6f
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst 5d48f25
Update goals
mernst a663b39
Merge /home/mernst/research/invariants/daikon-branch-master
mernst 393e5b8
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst 0195077
Update Agora test goals
mernst 2d9a658
Checkpoint
mernst 57e77d5
Fix typo
mernst 13ad30d
Add comment
mernst 6321f65
Check that `merge()` is defined
mernst 4a1c8e2
Merge ../daikon-fork-mernst-branch-check-merge-overridden into agora-…
mernst 87c129b
Better test
mernst b7a5e0a
Merge ../daikon-fork-mernst-branch-check-merge-overridden into agora-…
mernst cef2160
Fix typo
mernst 6cbffae
Fix counting of number of samples
mernst 95aeb0e
Merge ../daikon-fork-mernst-branch-commonsequence-elts into agora-pas…
mernst 68273e1
Merge /home/mernst/research/invariants/daikon-branch-master
mernst b2861cf
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst 7b62cd9
Merge /home/mernst/research/invariants/daikon-branch-master
mernst ede8a57
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst acd3d02
Merge /home/mernst/research/invariants/daikon-branch-master
mernst f99c8ad
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst b5c9f50
Undo undesirable whitespace changes
mernst d6c0410
Improve diagnostics
mernst 065c573
Improve diagnostics
mernst f7b55c2
Rename variable
mernst 4627fdd
Merge ../daikon-fork-mernst-branch-non-agora-changes
mernst 5bc8260
Merge /home/mernst/research/invariants/daikon-branch-master
mernst b1f4017
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst 1c9f2e6
Add clone and merge methods to AGORA invariants
juaaloval 9db1417
Remove redundant parentheses
juaaloval f6b37e0
Merge /home/mernst/research/invariants/daikon-branch-master
mernst 63b47ca
Merge /home/mernst/research/invariants/daikon-fork-JuanCarlosAlonsoVa…
mernst 6090617
Use variable
mernst 8c0dc2a
Update tests due to formatting of invariant
mernst 04aaa10
Suppress nullness warning
mernst 59cbbc0
Update goals
mernst 1bc8703
Update goals
mernst d053314
`.j8` files are not used
mernst ecc4602
Update goal
mernst 549cff4
Add missing documentation
juaaloval 28a2f4a
Merge pull request #3 from mernst/agora-passing-tests
juaaloval ebb62c5
Merge ../daikon-branch-master
mernst 0a6378d
Merge ../daikon-branch-master
mernst 39c488d
The empty string is not numeric
mernst 252d2e1
Merge ../daikon-branch-master
mernst db4f4e0
Merge ../daikon-branch-master
mernst 88a7bf5
Merge ../daikon-branch-master
mernst 681643a
Merge ../daikon-branch-master
mernst 288792e
Merge ../daikon-branch-master
mernst b64b681
Merge ../daikon-branch-master
mernst 08cccc9
Merge ../daikon-branch-master
mernst d20ddc8
Merge ../daikon-branch-master
mernst 62852a2
Merge ../daikon-branch-master
mernst 92ad307
Merge ../daikon-branch-master
mernst c553282
Merge ../daikon-branch-master
mernst 02a40a1
Merge ../daikon-branch-master
mernst 2e792e1
Merge ../daikon-branch-master
mernst 979393d
Merge ../daikon-branch-master
mernst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| package daikon.inv.unary.string; | ||
|
|
||
| import daikon.PptSlice; | ||
| import daikon.inv.Invariant; | ||
| import daikon.inv.InvariantStatus; | ||
| import daikon.inv.OutputFormat; | ||
| import daikon.inv.unary.string.dates.IsDateDDMMYYYY; | ||
| import daikon.inv.unary.string.dates.IsDateMMDDYYYY; | ||
| import daikon.inv.unary.string.dates.IsDateYYYYMMDD; | ||
| import daikon.suppress.NISuppressee; | ||
| import daikon.suppress.NISuppression; | ||
| import daikon.suppress.NISuppressionSet; | ||
| import daikon.suppress.NISuppressor; | ||
| import org.checkerframework.checker.interning.qual.Interned; | ||
| import org.checkerframework.checker.lock.qual.GuardSatisfied; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
| import org.checkerframework.dataflow.qual.Pure; | ||
| import org.checkerframework.dataflow.qual.SideEffectFree; | ||
| import org.checkerframework.framework.qual.Unused; | ||
| import typequals.prototype.qual.Prototype; | ||
|
|
||
| /** | ||
| * Indicates that the value of a string variable always has a fixed length n. Prints as {@code | ||
| * LENGTH(x)==n}. | ||
| */ | ||
| public class FixedLengthString extends SingleString { | ||
|
|
||
| // We are Serializable, so we specify a version to allow changes to | ||
| // method signatures without breaking serialization. If you add or | ||
| // remove fields, you should change this number to the current date. | ||
| static final long serialVersionUID = 20230704L; | ||
|
|
||
| // Variables starting with dkconfig_ should only be set via the | ||
| // daikon.config.Configuration interface. | ||
| /** Boolean. True iff Positive invariants should be considered. */ | ||
| public static boolean dkconfig_enabled = false; | ||
|
|
||
| @Unused(when = Prototype.class) | ||
| private @Nullable Integer length = null; | ||
|
|
||
| /// | ||
| /// Required methods | ||
| /// | ||
| private FixedLengthString(PptSlice ppt) { | ||
| super(ppt); | ||
| } | ||
|
|
||
| private @Prototype FixedLengthString() { | ||
| super(); | ||
| } | ||
|
|
||
| private static @Prototype FixedLengthString proto = new @Prototype FixedLengthString(); | ||
|
|
||
| // Returns the prototype invariant | ||
| public static @Prototype FixedLengthString get_proto() { | ||
| return proto; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean enabled() { | ||
| return dkconfig_enabled; | ||
| } | ||
|
|
||
| @Override | ||
| public FixedLengthString instantiate_dyn(@Prototype FixedLengthString this, PptSlice slice) { | ||
| return new FixedLengthString(slice); | ||
| } | ||
|
|
||
| @SideEffectFree | ||
| @Override | ||
| public String format_using(@GuardSatisfied FixedLengthString this, OutputFormat format) { | ||
| return "LENGTH(" + var().name() + ")==" + length; | ||
| } | ||
|
|
||
| @Override | ||
| public InvariantStatus add_modified(@Interned String a, int count) { | ||
| return check_modified(a, count); | ||
| } | ||
|
|
||
| @Override | ||
| public InvariantStatus check_modified(@Interned String v, int count) { | ||
| // Initialize the length the first time | ||
| if (length == null) { | ||
| length = v.length(); | ||
| } | ||
|
|
||
| if (v.length() == length) { | ||
| return InvariantStatus.NO_CHANGE; | ||
| } | ||
| return InvariantStatus.FALSIFIED; | ||
| } | ||
|
|
||
| @Override | ||
| protected double computeConfidence() { | ||
| return 1 - Math.pow(.1, ppt.num_samples()); | ||
| } | ||
|
|
||
| @Pure | ||
| @Override | ||
| public boolean isSameFormula(Invariant other) { | ||
| // Check type and length value | ||
| assert other instanceof FixedLengthString; | ||
|
|
||
| FixedLengthString o = (FixedLengthString) other; | ||
| if (!o.length.equals(length)) { | ||
| return false; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| /** NI suppressions, initialized in get_ni_suppressions() */ | ||
| private static @Nullable NISuppressionSet suppressions = null; | ||
|
|
||
| /** returns the ni-suppressions for SeqIndexFloatGreaterEqual */ | ||
| @Pure | ||
| @Override | ||
| public NISuppressionSet get_ni_suppressions() { | ||
| if (suppressions == null) { | ||
|
|
||
| NISuppressee suppressee = new NISuppressee(FixedLengthString.class, 1); | ||
|
|
||
| // suppressor definitions (used in suppressions below) | ||
| NISuppressor isDateMMDDYYYY = new NISuppressor(0, IsDateMMDDYYYY.class); | ||
| NISuppressor isDateDDMMYYYY = new NISuppressor(0, IsDateDDMMYYYY.class); | ||
| NISuppressor isDateYYYYMMDD = new NISuppressor(0, IsDateYYYYMMDD.class); | ||
|
|
||
| suppressions = | ||
| new NISuppressionSet( | ||
| new NISuppression[] { | ||
| new NISuppression(isDateMMDDYYYY, suppressee), | ||
| new NISuppression(isDateDDMMYYYY, suppressee), | ||
| new NISuppression(isDateYYYYMMDD, suppressee), | ||
| }); | ||
| } | ||
| return suppressions; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package daikon.inv.unary.string; | ||
|
|
||
| import daikon.PptSlice; | ||
| import daikon.inv.Invariant; | ||
| import daikon.inv.InvariantStatus; | ||
| import daikon.inv.OutputFormat; | ||
| import java.util.regex.Matcher; | ||
| import java.util.regex.Pattern; | ||
| import org.checkerframework.checker.lock.qual.GuardSatisfied; | ||
| import org.checkerframework.dataflow.qual.Pure; | ||
| import org.checkerframework.dataflow.qual.SideEffectFree; | ||
| import typequals.prototype.qual.Prototype; | ||
|
|
||
| /** | ||
| * Indicates that the value of a string type variable is always an email. Represented as {@code x is | ||
| * Email}. | ||
| */ | ||
| public class IsEmail extends SingleString { | ||
| // We are Serializable, so we specify a version to allow changes to | ||
| // method signatures without breaking serialization. If you add or | ||
| // remove fields, you should change this number to the current date. | ||
| static final long serialVersionUID = 20230704L; | ||
|
|
||
| // Variables starting with dkconfig_ should only be set via the | ||
| // daikon.config.Configuration interface. | ||
| /** Boolean. True iff Positive invariants should be considered. */ | ||
| public static boolean dkconfig_enabled = false; | ||
|
|
||
| /// | ||
| /// Required methods | ||
| /// | ||
| private IsEmail(PptSlice ppt) { | ||
| super(ppt); | ||
| } | ||
|
|
||
| private @Prototype IsEmail() { | ||
| super(); | ||
| } | ||
|
|
||
| private static @Prototype IsEmail proto = new @Prototype IsEmail(); | ||
|
|
||
| // Returns the prototype invariant | ||
| public static @Prototype IsEmail get_proto() { | ||
| return proto; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean enabled() { | ||
| return dkconfig_enabled; | ||
| } | ||
|
|
||
| @Override | ||
| public IsEmail instantiate_dyn(@Prototype IsEmail this, PptSlice slice) { | ||
| return new IsEmail(slice); | ||
| } | ||
|
|
||
| // A printed representation for user output | ||
| @SideEffectFree | ||
| @Override | ||
| public String format_using(@GuardSatisfied IsEmail this, OutputFormat format) { | ||
| return var().name() + " is Email"; | ||
| } | ||
|
|
||
| @Override | ||
| public InvariantStatus check_modified(String v, int count) { | ||
|
|
||
| Pattern pattern = | ||
| Pattern.compile( | ||
| "^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9]^[0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])$"); | ||
|
|
||
| Matcher matcher = pattern.matcher(v); | ||
|
|
||
| if (matcher.matches()) { | ||
| return InvariantStatus.NO_CHANGE; | ||
| } | ||
| return InvariantStatus.FALSIFIED; | ||
| } | ||
|
|
||
| @Override | ||
| public InvariantStatus add_modified(String v, int count) { | ||
| return check_modified(v, count); | ||
| } | ||
|
|
||
| @Override | ||
| protected double computeConfidence() { | ||
| return 1 - Math.pow(.1, ppt.num_samples()); | ||
| } | ||
|
|
||
| @Pure | ||
| @Override | ||
| public boolean isSameFormula(Invariant other) { | ||
| assert other instanceof IsEmail; | ||
| return true; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.