This repository contains a javascript-based BP library.
- BPjs is open sourced under the MIT license. If you use it in a system, please provide a link to this page somewhere in the documentation/system about section.
- BPjs uses the Mozilla Rhino JavaScript engine. Project page and source code can be found here.
If you use BPjs in an academic work, please consider citing it as:
Bar-Sinai M., Weiss G. (2021) Verification of Liveness and Safety Properties of Behavioral Programs Using BPjs. In: Margaria T., Steffen B. (eds) Leveraging Applications of Formal Methods, Verification and Validation: Tools and Trends. ISoLA 2020. Lecture Notes in Computer Science, vol 12479. Springer, Cham. https://doi.org/10.1007/978-3-030-83723-5_14
- For Maven projects: Add BPjs as dependency. Note that the version number changes.
<dependencies>
...
<dependency>
<groupId>com.github.bthink-bgu</groupId>
<artifactId>BPjs</artifactId>
<version>0.14.0</version>
</dependency>
...
</dependencies>- Clone, fork, or download the starting project.
- Download the
.jarfiles directly from Maven Central. - The project's Google group
- Devoxx Belgium 2018 talk introducing Behavioral Programming and BPjs.
- Presentations: Introduction Deeper dive
- Tutorial and Reference
- API Javadocs
Important
This update breaks backward compatibility in some minor ways around logging and custom executor services, as some methods were added and some classes were moved. See below for details. Updates should be pretty straightforward. Contact us if there's any issue, we'll be happy to help.
- ⬆️ Upgraded to Rhino 1.8.1.
- ⬆️ Upgraded build and test dependencies.
- 🐛 Fixed and issued which prevented executor sevices from being re-used. Users who use custom executor services in managed environments now need to use the new methods on
ExecutorService:borrow()/borrowWithName()andreturnService(). Most users will not be affected by this change.#236 - 🎉 BPLog moved to own package. BPjs now has a central static logger, and no prints should go to
Systen.(out|err)if you don't want them to. This is still the default behavior, but now messages go through the logging system first, so they can be directed to other logging destinations as well. #231 - ⬆️
BpLogis now easier to subclass, as core functionality moved to the interface usingdefaultmethods. - ✨ Added a new logging level:
Error. Exposed viabp.log.error("ouch!"). - ⬆️ When logger is in
Finelevel, sotrage modifications are printed to the b-program's logger. #230 - 🎉 Violations now have location and stack trace. #224
- ⬆️ Upgraded to Rhino 1.8.0 with updated JavaScript version. See the many updates here.
- ⬆️ ``DfsBProgramVerifier.ProgressListener` now supports default methods for easier implementation.
- ✨ Integers are printed as integers, not floats (e.g
5, not5.0). - ✨ Custom serialization is here. Client code can implement serialization logic and register it using
BPjs.registerStubberFactory(). - ✨ Event selection strategies always run within a JS context, so any JS logic just works, no manual context wrapping required (#229).
- 🐛 When performing verification, exceptions during b-program setups are not swalloed anymore (#228).
- 🐛 Fixed a crash when accessing a b-program's global scope before the program starts to run.
- ⬆️ Added method
BProgramRunner::getListeners(#190). - ⬆️ Setting a non-function interrupt handler (which you should never do anyway) now throws an exception with informative message, rather than being siletly ignored. (#114).
- 〽️ Stack traces now use standard V8 formatting (#198).
- ✨ EventSets now have an
exceptmethod, that allows removal of events from the set. e.g.allMotionEvents.except(moveDownEvent). (#218) - ⬆️ Improved error messages when composing event sets.
- 〽️
BPjsCodeEvaluationExceptionis now have one general constructor for all rhino exception(#200) - 🐛
BProgramRunnerListenerAdapteris now doing what adapters should do (create empty implementation for abstract classes and interfaces) and does not print on errors anymore. (#119).
- ⬆️ Printouts and
toStrings of JavaScript compound values (e.g. arrays) adhere to normative JavaScript style. That is, no more[JS_Array 1,2,3], just[1,2,3]. Java objects still retain theirJ_prefix.(#213).
- ⬆️ Upgraded dependencies.
- ⬆️
MapProxy's seed is nowprotected, so client code can use it directly (#206). - ✨ Dedicated exceptions for calling
bp.syncandbp.threadoutside of a bthread. (#195, #203) - 〽️
BpLogis now an interface, and it's implementation can be changed by callingBProgram.setLogger. (#208) - ✨ BPjs' version is now available at runtime, using
BPjs.getVersion(). (#136) - ✨ BPjs' logger is now is now supporting
bp.log.error. (#175)
Legend:
- 🔄 Change
- ✨ New feature
- 🎉 New feature, but more exciting
- 〽️ Refactor (turns out this sign is called "part alternation mark" and not "weird 'M'", so it fits).
- 🚮 Deprecation
- ⬆️ Upgrade
- 🐛 Bug fix
