BUG-4264: deprecate packageNameForTypeDefinition() 56/26556/3
authorRobert Varga <rovarga@cisco.com>
Sat, 5 Sep 2015 19:21:58 +0000 (21:21 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 7 Sep 2015 12:18:01 +0000 (14:18 +0200)
This method is only used in tests and is broken, schedule it for
removal.

Change-Id: I4b3820fd9e02d4903087271e2982390e8c2573a2
Signed-off-by: Robert Varga <rovarga@cisco.com>
binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/yangtools/binding/generator/util/BindingGeneratorUtil.java
binding/mdsal-binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/BindingGeneratorUtilTest.java

index ba1d42f9dd817d764b75881c85aeb5335c4b3abf..5609aeeda59c0b0e2b11b17b96eda4b6774a6ce7 100644 (file)
@@ -262,7 +262,13 @@ public final class BindingGeneratorUtil {
      *             <li>if <code>basePackageName</code> equals <code>null</code></li>
      *             <li>if <code>typeDefinition</code> equals <code>null</code></li>
      *             </ul>
+     * @deprecated This method ignores typeDefinition argument and its result is only
+     *             <code>indingMapping.normalizePackageName(basePackageName)</code>.
+     *             Aside from tests, there is not a single user in OpenDaylight codebase,
+     *             hence it can be considered buggy and defunct. It is scheduled for removal
+     *             in Boron release.
      */
+    @Deprecated
     public static String packageNameForTypeDefinition(final String basePackageName,
             final TypeDefinition<?> typeDefinition) {
         if (basePackageName == null) {
@@ -272,9 +278,7 @@ public final class BindingGeneratorUtil {
             throw new IllegalArgumentException("Type Definition reference cannot be NULL!");
         }
 
-        final StringBuilder builder = new StringBuilder();
-        builder.append(basePackageName);
-        return BindingMapping.normalizePackageName(builder.toString());
+        return BindingMapping.normalizePackageName(basePackageName);
     }
 
     /**
index 9a3e4a2bac36aa4e611ea7b4f7f1e6bbde70e6ed..928958966c8af55c717abc42499bacb69a59db27 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
 import com.google.common.base.Optional;
 import java.io.File;
 import java.io.IOException;
@@ -60,7 +59,7 @@ public class BindingGeneratorUtilTest {
     @Rule
     public ExpectedException expectedEx = ExpectedException.none();
 
-    private static List<File> loadTestResources(String testFile) {
+    private static List<File> loadTestResources(final String testFile) {
         final List<File> testModels = new ArrayList<File>();
         File listModelFile;
         try {
@@ -172,6 +171,7 @@ public class BindingGeneratorUtilTest {
      * </ul>
      */
     @Test
+    @Deprecated
     public void testPackageNameForTypeDefinitionNullBasePackageName() {
         expectedEx.expect(IllegalArgumentException.class);
         expectedEx.expectMessage("Base Package Name cannot be NULL!");
@@ -186,6 +186,7 @@ public class BindingGeneratorUtilTest {
      * </ul>
      */
     @Test
+    @Deprecated
     public void testPackageNameForTypeDefinitionNullTypeDefinition() {
         expectedEx.expect(IllegalArgumentException.class);
         expectedEx.expectMessage("Type Definition reference cannot be NULL!");