Skip to content

Error on synchronization on objects in Java #153

Closed
@mgudemann

Description

@mgudemann

This example fails with unexpected statement: monitorenter

public class monitorenter1
{
  public boolean doIt(boolean b)
  {
    boolean a;
    synchronized(this) {
      a = !b;
    }
    return a;
  }
  public void test()
  {
    assert(doIt(false));
  }
}

the critical section is enclosed between monitorenter and monitorexit in the bytecode.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions