Skip to content

Commit 0e6413d

Browse files
Merge pull request #21 from diffblue/bugfix/getClass
CProver.classIdentifier declaration and model for Object.getClass
2 parents 287f0b7 + f369b62 commit 0e6413d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/java/lang/Object.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,8 @@ public Object() {
4141
}
4242

4343
public final Class<?> getClass() {
44-
/*
45-
* MODELS LIBRARY {
46-
* We make this call to Class.forName to ensure it is loaded
47-
* by CBMC even with --lazy-methods on. We have to do this
48-
* because the internal support for getClass use the model of
49-
* Class.forName.
50-
* }
51-
*/
52-
Class c = Class.forName("");
53-
return CProver.nondetWithoutNullForNotModelled();
44+
// DIFFBLUE MODEL LIBRARY
45+
return Class.forName(CProver.classIdentifier(this));
5446
}
5547

5648
public int hashCode() {

src/main/java/org/cprover/CProver.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,12 @@ public static int getMonitorCount(Object object)
314314
{
315315
return object.cproverMonitorCount;
316316
}
317+
318+
/**
319+
* Class identifier of an Object. For instance "java.lang.String", "java.lang.Interger".
320+
*/
321+
public static String classIdentifier(Object object)
322+
{
323+
return object.getClass().getCanonicalName();
324+
}
317325
}

0 commit comments

Comments
 (0)