Skip to content

Commit d96ce9c

Browse files
authored
HADOOP-17968 Migrate checkstyle module illegalimport to maven enforcer banned-illegal-imports (apache#3584)
Reviewed-by: Ahmed Hussein <[email protected]> Signed-off-by: Takanobu Asanuma <[email protected]>
1 parent d598904 commit d96ce9c

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

hadoop-build-tools/src/main/resources/checkstyle/checkstyle.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@
122122
<!-- Checks for imports -->
123123
<!-- See http://checkstyle.sf.net/config_import.html -->
124124
<module name="IllegalImport">
125-
<property name="regexp" value="true"/>
126-
<property name="illegalPkgs" value="sun, com\.google\.common"/>
127-
<property name="illegalClasses" value="^org\.apache\.hadoop\.thirdparty\.com\.google\.common\.io\.BaseEncoding, ^org\.apache\.hadoop\.thirdparty\.com\.google\.common\.base\.(Optional|Function|Predicate|Supplier), ^org\.apache\.hadoop\.thirdparty\.com\.google\.common\.collect\.(ImmutableListMultimap)"/>
125+
<property name="regexp" value="true"/>
126+
<property name="illegalPkgs" value="sun"/>
128127
</module>
129128
<module name="RedundantImport"/>
130129
<module name="UnusedImports"/>

pom.xml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,69 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/x
189189
<reason>Use hadoop-common provided Sets rather than Guava provided Sets</reason>
190190
<bannedImports>
191191
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.collect.Sets</bannedImport>
192-
<bannedImport>com.google.common.collect.Sets</bannedImport>
193192
</bannedImports>
194193
</restrictImports>
195194
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
196195
<includeTestCode>true</includeTestCode>
197196
<reason>Use hadoop-common provided Lists rather than Guava provided Lists</reason>
198197
<bannedImports>
199198
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.collect.Lists</bannedImport>
200-
<bannedImport>com.google.common.collect.Lists</bannedImport>
201199
</bannedImports>
202200
</restrictImports>
203201
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
204202
<includeTestCode>true</includeTestCode>
205-
<reason>Use hadoop-common provided VisibleForTesting rather than the one provided by Guava</reason>
203+
<reason>Use hadoop-annotation provided VisibleForTesting rather than the one provided by Guava</reason>
206204
<bannedImports>
207205
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.annotations.VisibleForTesting</bannedImport>
208-
<bannedImport>com.google.common.annotations.VisibleForTesting</bannedImport>
206+
</bannedImports>
207+
</restrictImports>
208+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
209+
<includeTestCode>true</includeTestCode>
210+
<reason>Use alternatives to Guava common classes</reason>
211+
<bannedImports>
212+
<bannedImport>com.google.common.**</bannedImport>
213+
</bannedImports>
214+
</restrictImports>
215+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
216+
<includeTestCode>true</includeTestCode>
217+
<reason>Use alternative to Guava provided BaseEncoding</reason>
218+
<bannedImports>
219+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.io.BaseEncoding</bannedImport>
220+
</bannedImports>
221+
</restrictImports>
222+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
223+
<includeTestCode>true</includeTestCode>
224+
<reason>Use alternative to Guava provided Optional</reason>
225+
<bannedImports>
226+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.base.Optional</bannedImport>
227+
</bannedImports>
228+
</restrictImports>
229+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
230+
<includeTestCode>true</includeTestCode>
231+
<reason>Use alternative to Guava provided Function</reason>
232+
<bannedImports>
233+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.base.Function</bannedImport>
234+
</bannedImports>
235+
</restrictImports>
236+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
237+
<includeTestCode>true</includeTestCode>
238+
<reason>Use alternative to Guava provided Predicate</reason>
239+
<bannedImports>
240+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.base.Predicate</bannedImport>
241+
</bannedImports>
242+
</restrictImports>
243+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
244+
<includeTestCode>true</includeTestCode>
245+
<reason>Use alternative to Guava provided Supplier</reason>
246+
<bannedImports>
247+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.base.Supplier</bannedImport>
248+
</bannedImports>
249+
</restrictImports>
250+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
251+
<includeTestCode>true</includeTestCode>
252+
<reason>Use alternative to Guava provided ImmutableListMultimap</reason>
253+
<bannedImports>
254+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.collect.ImmutableListMultimap</bannedImport>
209255
</bannedImports>
210256
</restrictImports>
211257
</rules>

0 commit comments

Comments
 (0)