Skip to content

CProver.classIdentifier declaration and model for Object.getClass #21

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

Merged
merged 2 commits into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/main/java/java/lang/Object.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,8 @@ public Object() {
}

public final Class<?> getClass() {
/*
* MODELS LIBRARY {
* We make this call to Class.forName to ensure it is loaded
* by CBMC even with --lazy-methods on. We have to do this
* because the internal support for getClass use the model of
* Class.forName.
* }
*/
Class c = Class.forName("");
return CProver.nondetWithoutNullForNotModelled();
// DIFFBLUE MODEL LIBRARY
return Class.forName(CProver.classIdentifier(this));
}

public int hashCode() {
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/cprover/CProver.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,12 @@ public static int getMonitorCount(Object object)
{
return object.cproverMonitorCount;
}

/**
* Class identifier of an Object. For instance "java.lang.String", "java.lang.Interger".
*/
public static String classIdentifier(Object object)
{
return object.getClass().getCanonicalName();
}
}