Do not guard utility class constructors
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 17 Aug 2021 19:59:51 +0000 (21:59 +0200)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:36 +0000 (10:41 +1000)
There is no point in having exception throwing here, just use a simple
comment.

Change-Id: If4e2c22bde3a2456e1aec77ef2a1e846c2732a7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/yang/types/TypedefResolver.java
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/GeneratorUtil.java
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/LengthGenerator.java
binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/LengthGeneratorTest.java [deleted file]

index 7ac351cda3c758f6fc0dd6fe127e23c00ad63f51..7d7fe9d8290328a4506aa1fdcba9c1e3c875ab89 100644 (file)
@@ -23,7 +23,7 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 final class TypedefResolver {
     private TypedefResolver() {
-        throw new UnsupportedOperationException();
+        // Hidden on purpose
     }
 
     static List<TypeDefinition<?>> getAllTypedefs(final Module module) {
index d83a32466ab3a9c2c0d40f5dffc5fdf61d251c44..8c8e3075c305806fc2135143db92046b101026b8 100644 (file)
@@ -28,7 +28,7 @@ import org.opendaylight.mdsal.binding.model.ri.Types;
 
 public final class GeneratorUtil {
     private GeneratorUtil() {
-        throw new UnsupportedOperationException();
+        // Hidden on purpose
     }
 
     /**
@@ -321,4 +321,4 @@ public final class GeneratorUtil {
         }
         return propertiesOfAllParents;
     }
-}
\ No newline at end of file
+}
index fdf490ae365c85ff9ead37e74c112f563cfdbe0b..978192fbca2f905f647b32c9cfd826870406a88c 100644 (file)
@@ -23,7 +23,7 @@ final class LengthGenerator {
     private static final Logger LOG = LoggerFactory.getLogger(LengthGenerator.class);
 
     private LengthGenerator() {
-        throw new UnsupportedOperationException();
+        // Hidden on purpose
     }
 
     private static String lengthCheckerName(final String member) {
diff --git a/binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/LengthGeneratorTest.java b/binding/mdsal-binding-java-api-generator/src/test/java/org/opendaylight/mdsal/binding/java/api/generator/LengthGeneratorTest.java
deleted file mode 100644 (file)
index 4f0e83c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.mdsal.binding.java.api.generator;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import org.junit.Test;
-
-public class LengthGeneratorTest {
-    @Test
-    public void constructTest() throws ReflectiveOperationException {
-        final Constructor<LengthGenerator> constructor = LengthGenerator.class.getDeclaredConstructor();
-        constructor.setAccessible(true);
-        try {
-            constructor.newInstance();
-            fail();
-        } catch (InvocationTargetException e) {
-            assertTrue(e.getCause() instanceof UnsupportedOperationException);
-        }
-    }
-}
\ No newline at end of file