summaryrefslogtreecommitdiff
path: root/generator
diff options
context:
space:
mode:
authorJulian Kast <Julian.kast@livio.io>2020-08-17 07:28:01 -0700
committerGitHub <noreply@github.com>2020-08-17 07:28:01 -0700
commit68b9e47af491c9c1bc06ff80dee8b25aa16c1822 (patch)
tree5d3cd717e276d9c6c4660981bab033ea915b84d7 /generator
parent84e8ef3940b7f2e8e3cfeeb6f432230a5918d53f (diff)
parent9c2c295fd68ed4cd9cb715f9b4fd3e7bfb2afead (diff)
downloadsdl_android-68b9e47af491c9c1bc06ff80dee8b25aa16c1822.tar.gz
Merge pull request #1445 from smartdevicelink/feature/issue_1444_fix_generated_imports
Update RPC Generator to generate correct Android X imports
Diffstat (limited to 'generator')
-rw-r--r--generator/README.md10
-rw-r--r--generator/transformers/functions_producer.py10
-rw-r--r--generator/transformers/structs_producer.py8
3 files changed, 14 insertions, 14 deletions
diff --git a/generator/README.md b/generator/README.md
index ae3934d18..d87ec0a17 100644
--- a/generator/README.md
+++ b/generator/README.md
@@ -430,7 +430,7 @@ Where `[name]` is the value from the `"name"` attribute of `<struct>`.
### Constructor with all required parameters, based on `"mandatory"` attribute of the `<param>`
This constructor requires the import of `NonNull` annotation
```java
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
```
The constructor should include all set of `<param>` with the `"mandatory"` attribute is "true". JavaDoc should include all constructor parameters and the constructor should call all corresponding setters inside itself.
@@ -590,7 +590,7 @@ Output (javadoc comments skipped):
```java
package com.smartdevicelink.proxy.rpc;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.TemperatureUnit;
@@ -768,7 +768,7 @@ Where `[name]` is the value from the `"name"` attribute of `<function>`.
### Constructor with all required parameters, based on `"mandatory"` attribute of the `<param>`
This constructor requires the import of `NonNull` annotation
```java
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
```
The constructor should include all set of `<param>` with the `"mandatory"` attribute is "true". JavaDoc should include all constructor parameters and the constructor should call all corresponding setters inside itself.
@@ -997,7 +997,7 @@ Output (javadoc comments skipped):
```java
package com.smartdevicelink.proxy.rpc;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;
@@ -1039,7 +1039,7 @@ Output (javadoc comments skipped):
```java
package com.smartdevicelink.proxy.rpc;
-import android.support.annotation.NonNull;
+import androidx.annotation.NonNull;
import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCNotification;
diff --git a/generator/transformers/functions_producer.py b/generator/transformers/functions_producer.py
index 8b5a83aee..c121de557 100644
--- a/generator/transformers/functions_producer.py
+++ b/generator/transformers/functions_producer.py
@@ -46,7 +46,7 @@ class FunctionsProducer(InterfaceProducerCommon):
if not class_name.endswith("Response"):
class_name += 'Response'
imports.add('com.smartdevicelink.proxy.rpc.enums.Result')
- imports.add('android.support.annotation.NonNull')
+ imports.add('androidx.annotation.NonNull')
elif item.message_type.name == 'request':
extends_class = self.request_class
elif item.message_type.name == 'notification':
@@ -87,9 +87,9 @@ class FunctionsProducer(InterfaceProducerCommon):
def sort_imports(self, imports: set):
sorted_imports = []
- if 'android.support.annotation.NonNull' in imports:
- sorted_imports.append('android.support.annotation.NonNull')
- imports.remove('android.support.annotation.NonNull')
+ if 'androidx.annotation.NonNull' in imports:
+ sorted_imports.append('androidx.annotation.NonNull')
+ imports.remove('androidx.annotation.NonNull')
sorted_imports.append('')
sorted_imports.append('com.smartdevicelink.protocol.enums.FunctionID')
imports.remove('com.smartdevicelink.protocol.enums.FunctionID')
@@ -144,7 +144,7 @@ class FunctionsProducer(InterfaceProducerCommon):
if tr in self.struct_names:
imports.add('{}.{}'.format(self.structs_package, tr))
if param.is_mandatory:
- imports.add('android.support.annotation.NonNull')
+ imports.add('androidx.annotation.NonNull')
Params = namedtuple('Params', sorted(p))
return imports, Params(**p)
diff --git a/generator/transformers/structs_producer.py b/generator/transformers/structs_producer.py
index c7c5a3058..400e36800 100644
--- a/generator/transformers/structs_producer.py
+++ b/generator/transformers/structs_producer.py
@@ -76,9 +76,9 @@ class StructsProducer(InterfaceProducerCommon):
def sort_imports(self, imports: set):
sorted_imports = []
- if 'android.support.annotation.NonNull' in imports:
- sorted_imports.append('android.support.annotation.NonNull')
- imports.remove('android.support.annotation.NonNull')
+ if 'androidx.annotation.NonNull' in imports:
+ sorted_imports.append('androidx.annotation.NonNull')
+ imports.remove('androidx.annotation.NonNull')
sorted_imports.append('')
tmp = []
for i in imports:
@@ -124,7 +124,7 @@ class StructsProducer(InterfaceProducerCommon):
if tr in self.struct_names:
imports.add('{}.{}'.format(self.structs_package, tr))
if param.is_mandatory:
- imports.add('android.support.annotation.NonNull')
+ imports.add('androidx.annotation.NonNull')
Params = namedtuple('Params', sorted(p))
return imports, Params(**p)