Skip to content

Commit c5ccb5c

Browse files
committed
HADOOP-17115. Replace Guava Sets usage by Hadoop's own Sets in hadoop-common and hadoop-tools
1 parent b93e448 commit c5ccb5c

File tree

21 files changed

+552
-17
lines changed

21 files changed

+552
-17
lines changed

hadoop-common-project/hadoop-common/pom.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,38 @@
634634
</filesets>
635635
</configuration>
636636
</plugin>
637+
<plugin>
638+
<groupId>org.apache.maven.plugins</groupId>
639+
<artifactId>maven-enforcer-plugin</artifactId>
640+
<dependencies>
641+
<dependency>
642+
<groupId>de.skuzzle.enforcer</groupId>
643+
<artifactId>restrict-imports-enforcer-rule</artifactId>
644+
<version>${restrict-imports.enforcer.version}</version>
645+
</dependency>
646+
</dependencies>
647+
<executions>
648+
<execution>
649+
<id>banned-illegal-imports</id>
650+
<phase>process-sources</phase>
651+
<goals>
652+
<goal>enforce</goal>
653+
</goals>
654+
<configuration>
655+
<rules>
656+
<restrictImports implementation="de.skuzzle.enforcer.restrictimports.rule.RestrictImports">
657+
<includeTestCode>true</includeTestCode>
658+
<reason>Use hadoop-common provided Sets rather than Guava provided Sets</reason>
659+
<bannedImports>
660+
<bannedImport>org.apache.hadoop.thirdparty.com.google.common.collect.Sets</bannedImport>
661+
<bannedImport>com.google.common.collect.Sets</bannedImport>
662+
</bannedImports>
663+
</restrictImports>
664+
</rules>
665+
</configuration>
666+
</execution>
667+
</executions>
668+
</plugin>
637669
</plugins>
638670
</build>
639671

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableRates.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.Set;
2323

2424
import static org.apache.hadoop.thirdparty.com.google.common.base.Preconditions.*;
25-
import org.apache.hadoop.thirdparty.com.google.common.collect.Sets;
25+
import org.apache.hadoop.util.Sets;
2626

2727
import org.apache.hadoop.classification.InterfaceAudience;
2828
import org.apache.hadoop.classification.InterfaceStability;

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/MutableRatesWithAggregation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
package org.apache.hadoop.metrics2.lib;
2020

21-
import org.apache.hadoop.thirdparty.com.google.common.collect.Sets;
21+
import org.apache.hadoop.util.Sets;
2222
import java.lang.ref.WeakReference;
2323
import java.lang.reflect.Method;
2424
import java.util.Iterator;

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/JvmPauseMonitor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@
2929
import org.apache.hadoop.service.AbstractService;
3030

3131
import org.apache.hadoop.thirdparty.com.google.common.base.Joiner;
32-
import org.apache.hadoop.thirdparty.com.google.common.base.Preconditions;
3332
import org.apache.hadoop.thirdparty.com.google.common.collect.Lists;
3433
import org.apache.hadoop.thirdparty.com.google.common.collect.Maps;
35-
import org.apache.hadoop.thirdparty.com.google.common.collect.Sets;
3634
import org.slf4j.Logger;
3735
import org.slf4j.LoggerFactory;
3836

0 commit comments

Comments
 (0)