Skip to content

Commit 76451c9

Browse files
Enable Monitor entry exception
and comment on issues with Monitor exit exceptions. See also cbmc#1236.
1 parent 3163b09 commit 76451c9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ public static void monitorenter(Object object)
122122
{
123123
//FIXME: we shoud remove the call to this method from the call
124124
// stack appended to the thrown exception
125-
// if (object == null)
126-
// throw new NullPointerException();
125+
if (object == null)
126+
throw new NullPointerException();
127127

128128
CProver.atomicBegin();
129129
// this assume blocks this execution path in JBMC and simulates
@@ -143,13 +143,16 @@ public static void monitorenter(Object object)
143143
*/
144144
public static void monitorexit(Object object)
145145
{
146-
//FIXME: we shoud remove the call to this method from the call
146+
// FIXME: we shoud remove the call to this method from the call
147147
// stack appended to the thrown exception
148+
// FIXME: Enabling thes exceptions makes
149+
// jbmc-regression/synchronized-blocks/test_sync.desc
150+
// run into an infinite loop during symex
148151
// if (object == null)
149-
// throw new NullPointerException();
152+
// throw new NullPointerException();
150153

151154
// if (object.cproverMonitorCount == 0)
152-
// throw new IllegalMonitorStateException();
155+
// throw new IllegalMonitorStateException();
153156
CProver.atomicBegin();
154157
object.cproverMonitorCount--;
155158
CProver.atomicEnd();

0 commit comments

Comments
 (0)