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
Method Specification Inconsistency #481
Comments
Samantha,
Hi All,I have been trying to use OpenJML on some popular leaf libraries such org.apache.commons.math3 to check method and specification consistency. I am attaching a toy example where the OpenJML-ESC/Java2 is reporting that method and specification is consistent. However that shouldn't be the case as the method being called here inserts an element into an array. So there should be possible index out of range warnings and so on. Can you please help me understand the possible reason behind this? |
Hi David, Thank you for your prompt reply.
I was expecting the static checker would give warnings such as Invalid assertion (PossiblyTooLargeIndex). Because the body of the getEntry function called inside getDummyEntry looks like following screenshot. |
Samantha,
Hi David,Thank you for your prompt reply.
|
Samantha, The reason that there is no warning on the call of the method fc.getEntry(index) is that there are no specifications for getEntry that limit the range of values that it might have. Checking is done modularly, method by method.So inside getDummyEntry we only check that the implementation of the method, combined with the specifications of any methods it calls, is consistent with the specification of getDummyEntry. Try this. Write a ArrayFieldVector.jml file something like
Hi David,Thank you for your prompt reply.
|
Hi David, Actually I am interested in the source files of that library itself. I am not using the class file. I have run the OpenJML with ESC tool directly on the ArrayFieldVector class and I get an internal error, although the tool continues to run. I am attaching the snapshot. Even in this case where I am using the source file, when the tool finishes running I am getting that method and specification are consistent message for the method getEntry(int) that I am interested in. The reason behind using the getDummyEntry() to call one method is I don't want to check specification for all the methods, only one or two methods. Is there any other way of doing so than what I am doing right now? I would like to avoid running the tool on the entire source file e.g. ArrayFieldVector.java. I understand I am not adding the JML specification, but as I am directly using the source code of the library I was expecting index related warnings from OpenJML with ESC tool and I would like to check whether adding the following gets rid of the warnings. |
Samantha, Sorry for the delay in replying. The bug you report is significant and I would appreciate receiving the files you are using so that I can reproduce and fix it. I'll need the files for whichever method produced the internal error and for any classes etc. that are imported by that file.
To: OpenJML/OpenJML OpenJML@noreply.github.com Hi David,Actually I am interested in the source files of that library itself. I am not using the class file. I have run the OpenJML with ESC tool directly on the ArrayFieldVector class and I get an internal error, although the tool continues to run. I am attaching the snapshot.Even in this case where I am using the source file, when the tool finishes running I am getting that method and specification are consistent message for the method getEntry(int) that I am interested in. The reason behind using the getDummyEntry() to call one method is I don't want to check specification for all the methods, only one or two methods. Is there any other way of doing so than what I am doing right now? I would like to avoid running the tool on the entire source file e.g. ArrayFieldVector.java.I understand I am not adding the JML specification, but as I am directly using the source code of the library I was expecting index related warnings from OpenJML with ESC tool and I would like to check whether adding the following gets rid of the warnings.— |
Hi David, I am attaching the folder to reproduce the error. The main file ArrayFieldVector.java that I am testing is under org.apache.commons.math3.linear package. The other packages contains necessary dependency. I would like to ask if there is any other way to run the OpenJML tool with ESC on only one method of any class rather than the whole source file? Thanks in advance! |
You can run ESC on just one method with the command-line argument -method=... . Put in the name of the method if it is unique or the full package.class.method name. In the GUI, you can select a function name, say in the outline or project explorer view, and right-click to select running ESC.
To: OpenJML/OpenJML OpenJML@noreply.github.com Hi David,I am attaching the folder to reproduce the error. The main file ArrayFieldVector.java that I am testing is under org.apache.commons.math3.linear package. The other packages contains necessary dependency.I would like to ask if there is any other way to run the OpenJML tool with ESC on only one method of any class rather than the whole source file?Thanks in advance!org.apache.commons.math3.zip— |
Thanks. However I am getting a duplicate context value error as below: eclipse.buildId=4.4.2.M20150204-1700 org.eclipse.core.jobs java.lang.AssertionError: duplicate context value |
On a first try I'm missing MathIllegalNumberException and AbstractIntegerDistribution Which method in particular are you trying to check? Send the command line if you can. |
After trying to pull in a few extra files from the apache distribution, I just importe the whole library. Arre you working with a specific version? |
I am using the GUI, the method I am interested in is getEntry(int) from org.apache.commons.math3.linear.ArrayFieldVector. I am working with Apache Commons Math 3.6.1 version. |
Fixed in V0.8.3, just released. Note that trying to run all of the apache commons library at once will probably run out of memory. But one at a time will probably be OK -- I can successfully run ArrayFieldVector for example. |
Let me know if you have any other problems. I'm also interested in what your overall project is. |
Hi David, Thanks for the new version. Unfortunately after updating the new V0.8.3. I couldn't use the tool any more (ESC/JAVA2, OpenJML typecheck etc.). Therefore I deleted the version and reinstalled. Now it is giving me major minor version 52.0 error, I can't even set up preference page for OpenJML. |
When you reinstalled, what version did you reinstall?
Hi David,Thanks for the new version. Unfortunately after updating the new V0.8.3. I couldn't use the tool any more (ESC/JAVA2, OpenJML typecheck etc.). Therefore I deleted the version and reinstalled. Now it is giving me major minor version 52.0 error, I can't even set up preference page for OpenJML. |
Samantha - V0.8.3 is Java 8. Java 8 and Java 7 versions do not play together. I am putting all effort and bug fixes into the Java 8 version. The major minor version 52.0 error is definitely a sign of mixed versions of Java.
Hi David,Thanks for the new version. Unfortunately after updating the new V0.8.3. I couldn't use the tool any more (ESC/JAVA2, OpenJML typecheck etc.). Therefore I deleted the version and reinstalled. Now it is giving me major minor version 52.0 error, I can't even set up preference page for OpenJML. |
Hi David, My bad! I thought I need to use Java 7. My overall project is Specification Inference. I am a graduate student at Iowa State University. Currently I am interested in specifications of different libraries. |
Samantha,
Hi David,My bad! I thought I need to use Java 7. My overall project is Specification Inference. I am a graduate student at Iowa State University. Currently I am interested in specifications of different libraries. — |
Hi All,
I have been trying to use OpenJML on some popular leaf libraries such org.apache.commons.math3 to check method and specification consistency. I am attaching a toy example where the OpenJML-ESC/Java2 is reporting that method and specification is consistent. However that shouldn't be the case as the method being called here inserts an element into an array. So there should be possible index out of range warnings and so on. Can you please help me understand the possible reason behind this?
The text was updated successfully, but these errors were encountered: