Remove useless UnsupportedOperationException throws
[yangtools.git] / common / util / src / main / java / org / opendaylight / yangtools / util / RecursiveObjectLeaker.java
index ddd31ebdb869672e3008fafd8f8292deec43282c..0c3cd1df311b60f0ef5a4c3a4ab41acb30aff6e1 100644 (file)
@@ -14,8 +14,7 @@ import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayDeque;
 import java.util.Deque;
 import java.util.Map.Entry;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
+import org.eclipse.jdt.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +34,7 @@ import org.slf4j.LoggerFactory;
  * WARNING: BE CAREFUL WHEN USING THIS CLASS. IT LEAKS OBJECTS WHICH ARE NOT COMPLETELY INITIALIZED.
  *
  * <p>
- * WARNING: THIS CLASS EAVES THREAD-LOCAL RESIDUE. MAKE SURE IT IS OKAY OR CALL {@link #cleanup()} IN APPROPRIATE
+ * WARNING: THIS CLASS LEAVES THREAD-LOCAL RESIDUE. MAKE SURE IT IS OKAY OR CALL {@link #cleanup()} IN APPROPRIATE
  *          PLACES.
  *
  * <p>
@@ -45,7 +44,6 @@ import org.slf4j.LoggerFactory;
  * @author Robert Varga
  */
 @Beta
-@ThreadSafe
 public final class RecursiveObjectLeaker {
     // Logging note. Only keys passed can be logged, as objects beng resolved may not be properly constructed.
     private static final Logger LOG = LoggerFactory.getLogger(RecursiveObjectLeaker.class);
@@ -54,7 +52,7 @@ public final class RecursiveObjectLeaker {
     private static final ThreadLocal<Deque<Entry<?, Object>>> STACK = new ThreadLocal<>();
 
     private RecursiveObjectLeaker() {
-        throw new UnsupportedOperationException();
+        // Hidden on purpose
     }
 
     // Key is checked for identity
@@ -107,7 +105,7 @@ public final class RecursiveObjectLeaker {
     // BEWARE: this method returns incpmpletely-initialized objects (that is the purpose of this class).
     //
     //         BE VERY CAREFUL WHAT OBJECT STATE YOU TOUCH
-    public static @Nullable <T> T lookup(final Object key, final Class<T> requiredClass) {
+    public static <T> @Nullable T lookup(final Object key, final Class<T> requiredClass) {
         final Deque<Entry<?, Object>> stack = STACK.get();
         if (stack != null) {
             for (Entry<?, Object> e : stack) {