This rule is Obsolete | |
Synopsis: | Order Import Statements. |
Language: | Java |
Severity Level: | 7 |
Category: | ImportStatement |
Description: |
The ordering of import statements is:
To exactly match the IDE settings, the imports should be:
Originally, there was no style requirement on the ordering, meaning IDEs were either always changing the ordering or IDE developers had to disable the automatic import management features and manually maintain the imports. This was deemed bad. When java-style was asked, the preferred styles varied wildly and it came down to Android needing to simply "pick an ordering and be consistent." So we chose a style, updated the style guide, and made the IDEs obey it. We expect that as IDE users work on the code, imports in all packages will match this pattern without extra engineering effort. This style was chosen such that:
The use and location of static imports have been mildly controversial issues. Some people prefer static imports to be interspersed with the remaining imports, while some prefer them to reside above or below all other imports. Additionally, we have not yet determined how to make all IDEs use the same ordering. Since many consider this a low priority issue, just use your judgement and be consistent. |
Literature References: |
Google Android Guidelines |