Use asserts to detect the problematic situations only in development versions ImmutableNodeInternals208589
authorJaroslav Tulach <jtulach@netbeans.org>
Wed, 06 Jun 2012 21:44:28 +0200
branchImmutableNodeInternals208589
changeset 231088947b842bf87f
parent 231087 9661b2ec3040
child 231089 83fcf04d41ac
Use asserts to detect the problematic situations only in development versions
openide.nodes/src/org/openide/nodes/EntrySupportLazy.java
     1.1 --- a/openide.nodes/src/org/openide/nodes/EntrySupportLazy.java	Wed Jun 06 21:40:45 2012 +0200
     1.2 +++ b/openide.nodes/src/org/openide/nodes/EntrySupportLazy.java	Wed Jun 06 21:44:28 2012 +0200
     1.3 @@ -83,10 +83,10 @@
     1.4      
     1.5      private void setState(EntrySupportLazyState old, EntrySupportLazyState s) {
     1.6          assert Thread.holdsLock(LOCK);
     1.7 -        if (!internal.compareAndSet(old, s)) {
     1.8 -            IllegalStateException ex = new IllegalStateException("Somebody changed internal state meanwhile!\nExpected: " + old + "\ncurrent : " + internal.get()); // NOI18N
     1.9 -            throw ex;
    1.10 -        }
    1.11 +        boolean success = internal.compareAndSet(old, s);
    1.12 +        assert success : "Somebody changed internal state meanwhile!\n"
    1.13 +            + "Expected: " + old + "\n"
    1.14 +            + "Current : " + internal.get(); // NOI18N
    1.15      }
    1.16  
    1.17      public boolean checkInit() {