Cleanup use of Guava library
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / repo / util / RefcountedRegistration.java
index 3cd59b2cce7cb2e960f78005d34f0912b5f4b370..087104f8e6a54af321e50bf8a4f0b7f3c1227ccd 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.model.repo.util;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+import static java.util.Objects.requireNonNull;
 
 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceRegistration;
 
@@ -16,7 +17,7 @@ final class RefcountedRegistration {
     private int refcount = 1;
 
     RefcountedRegistration(final SchemaSourceRegistration<?> reg) {
-        this.reg = Preconditions.checkNotNull(reg);
+        this.reg = requireNonNull(reg);
     }
 
     public void incRef() {
@@ -24,13 +25,13 @@ final class RefcountedRegistration {
     }
 
     public boolean decRef() {
-        Preconditions.checkState(refcount > 0, "Refcount underflow: %s", refcount);
+        checkState(refcount > 0, "Refcount underflow: %s", refcount);
 
         if (0 == --refcount) {
             reg.close();
             return true;
-        } else {
-            return false;
         }
+
+        return false;
     }
 }
\ No newline at end of file