Import exception references 48/101048/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 27 Apr 2022 15:39:42 +0000 (17:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 10 May 2022 09:25:41 +0000 (11:25 +0200)
We may be generating a competing construct, hence need to use
importedName for {IllegalArgument,NullPointer}Exception.

Change-Id: I3fe59a745bc17b292d8d50e6c55ef8669b0ee35a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4c2990d640ee5cd0811e1c7af6f2664822f95cb8)

binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/ClassTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/EnumTemplate.xtend
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/JavaFileTemplate.java

index c29f8aea4b59143f86d0be305e52a3f712545974..3bba2d1531279329225bdf56515cea864de43a96 100644 (file)
@@ -226,7 +226,7 @@ class BuilderTemplate extends AbstractBuilderTemplate {
          * </ul>
          *
          * @param arg grouping object
-         * @throws IllegalArgumentException if given argument is none of valid types or has property with incompatible value
+         * @throws «IAE.importedName» if given argument is none of valid types or has property with incompatible value
         */
     '''
 
@@ -478,7 +478,7 @@ class BuilderTemplate extends AbstractBuilderTemplate {
               *
               * @param augmentation augmentation to be added
               * @return this builder
-              * @throws NullPointerException if {@code augmentation} is null
+              * @throws «NPE.importedName» if {@code augmentation} is null
               */
             public «type.name» addAugmentation(«augmentTypeRef» augmentation) {
                 if (!(this.«AUGMENTATION_FIELD» instanceof «hashMapRef»)) {
index 4b4c9b4518f9a8fdbc148860cecbcc19f1f0907a..5fcc1964a717e490aea924e419ac9521b46f1f73 100644 (file)
@@ -428,7 +428,7 @@ class ClassTemplate extends BaseTemplate {
     def protected bitsArgs() '''
         «JU_LIST.importedName»<«STRING.importedName»> properties = «Lists.importedName».newArrayList(«allProperties.propsAsArgs»);
         if (!properties.contains(defaultValue)) {
-            throw new «IllegalArgumentException.importedName»("invalid default parameter");
+            throw new «IAE.importedName»("invalid default parameter");
         }
         int i = 0;
         return new «genTO.name»(
index c71bef1b87187ed9ccf9e0cdf2ff8ed42e274b42..27c9158f6c7579f9a83e22cb39262f60a6bce3b3 100644 (file)
@@ -110,7 +110,7 @@ class EnumTemplate extends BaseTemplate {
              *
              * @param name YANG assigned name
              * @return corresponding «enums.name» item, if present
-             * @throws NullPointerException if name is null
+             * @throws «NPE.importedName» if {@code name} is null
              */
             public static «Optional.importedName»<«enums.name»> forName(«STRING.importedName» name) {
                 return «Optional.importedName».ofNullable(NAME_MAP.get(«JU_OBJECTS.importedName».requireNonNull(name)));
index 1df057e7d4f2c44661b2b5d19b7e3aa4a306d449..845545b50629402dd9a9750abfafda1911061e09 100644 (file)
@@ -75,6 +75,10 @@ class JavaFileTemplate {
      * {@code java.lang.Deprecated} as a JavaTypeName.
      */
     static final @NonNull JavaTypeName DEPRECATED = JavaTypeName.create(Deprecated.class);
+    /**
+     * {@code java.lang.IllegalArgumentException} as a JavaTypeName.
+     */
+    static final @NonNull JavaTypeName IAE = JavaTypeName.create(IllegalArgumentException.class);
     /**
      * {@code java.lang.NullPointerException} as a JavaTypeName.
      */