Skip to content

Model additions from SV-COMP 26 - #48

Open
peterschrammel wants to merge 6 commits into
masterfrom
sv-comp26
Open

peterschrammel wants to merge 6 commits into
masterfrom
sv-comp26

Conversation

@peterschrammel

Copy link
Copy Markdown
Member

No description provided.

static Class getPrimitiveClass(int i){
if(i==0)
return Class.forName("boolean");
return boolean.class;

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.

int.class compiles to getstatic Integer.TYPE, so Integer.<clinit> reads Integer.TYPE while initialising it: all TYPE fields end up null (assert Integer.TYPE != null fails). getPrimitiveClass(String) (Character) still uses forName. Drop this commit in favour of #43?

*/
public PrintWriter printf(String format, Object ... args) {
// return format(format, args);
return CProver.nondetWithoutNull(this);

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.

nondetWithoutNull(this) ignores its argument and returns a fresh object; should be return this; (also lines 990, 1053, 1116, 1152, 1194, 1219). pw.append('a') == pw currently fails.

public class Collections {
// Suppresses default constructor, ensuring non-instantiability.
// DIFFBLUE MODEL LIBRARY - not used in model
// private Collections() {

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.

Keep the private constructor: without it, Collections gets a public one.

*/
@SuppressWarnings("unchecked")
public static <T extends Comparable<? super T>> void sort(List<T> list) {
list.sort(null);

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.

ArrayList.sort is notModelled, which JBMC treats as a no-op, so this doesn't sort: after sorting [3, 1], assert l.get(0) == 3 is SUCCESSFUL. Not fullSupport.

* @diffblue.untested
* @diffblue.noSupport
*/
public static <T> void fill(List<? super T> list, T obj) {

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.

notModelled in a void method is a no-op, so fill silently does nothing (wrong SUCCESS). Keep the JDK body? Same for other simple void methods.

// return a;
if (a.length < size()) {
// DIFFBLUE MODEL LIBRARY
// Object.getClass() is currently not modelled, so we need to use

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.

Out of date once diffblue/cbmc#9390 is merged.

*
* @diffblue.noSupport
*/
public void write(String str) throws IOException {

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.

No-op, so a user's Writer subclass never sees this reach its write(char[], int, int). The JDK bodies of write(String), write(char[]) and append only delegate; keep them?

* @diffblue.untested Only exception support is tested.
* */
@Override
public char charAt(int index) {

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.

What does this fix? JBMC's string solver replaces StringBuilder.charAt:(I)C anyway; I saw no difference, with or without --no-refine-strings.

*
* @since 1.5
*/

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.

Nit: the only change from OpenJDK.

* @author Josh Bloch
* @since 1.7
*/

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.

Nit: the only change from OpenJDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants