Import exception references 47/100847/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 27 Apr 2022 15:39:42 +0000 (17:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 27 Apr 2022 15:43:37 +0000 (17:43 +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>
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 79567d51bcbf6a8088bed8b6c7c967e1302955a4..b24cf828790d4bcc723a86b41633aada3a0718a8 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
         */
     '''
 
@@ -435,7 +435,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 08935e81aa35ddfa171daa7da35c4d0790ce9b84..be2f6e8e034c345e3395036b13c957f869e4ad87 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 89239186786e3216f6a80289d0ac33c7c0e6edd4..c382c0902facc61b0b14b8ab7290343659184604 100644 (file)
@@ -92,7 +92,7 @@ class EnumTemplate extends BaseTemplate {
              *
              * @param name YANG assigned name
              * @return corresponding «enums.name» item, or {@code null} if no such item exists
-             * @throws NullPointerException if {@code name} is null
+             * @throws «NPE.importedName» if {@code name} is null
              */
             public static «enums.importedNullable» forName(«STRING.importedName» name) {
                 return switch (name) {
@@ -123,8 +123,8 @@ class EnumTemplate extends BaseTemplate {
              *
              * @param name YANG assigned name
              * @return corresponding «enums.name» item
-             * @throws NullPointerException if {@code name} is null
-             * @throws IllegalArgumentException if {@code name} does not match any item
+             * @throws «NPE.importedName» if {@code name} is null
+             * @throws «IAE.importedName» if {@code name} does not match any item
              */
             public static «enums.importedNonNull» ofName(«STRING.importedName» name) {
                 return «CODEHELPERS.importedName».checkEnum(forName(name), name);
@@ -135,7 +135,7 @@ class EnumTemplate extends BaseTemplate {
              *
              * @param intValue integer value
              * @return corresponding «enums.name» item
-             * @throws IllegalArgumentException if {@code intValue} does not match any item
+             * @throws «IAE.importedName» if {@code intValue} does not match any item
              */
             public static «enums.importedNonNull» ofValue(int intValue) {
                 return «CODEHELPERS.importedName».checkEnum(forValue(intValue), intValue);
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.
      */