On 23 Jun 2017, at 19:24, Andrew Wang 
<andrew.w...@cloudera.com<mailto:andrew.w...@cloudera.com>> wrote:

This is my personal opinion, but I don't like wildcard imports in general. One 
example is that it makes it harder to determine the API impact when reviewing a 
patch that changes the version of a JAR. Given that IDEs manage imports for 
you, I don't see much benefit from wildcard imports either.

I'm strongly in favour of package imports, as it means that when someone adds a 
new class to a package, your compilation can actually fail if it clashes with 
another import. But blocking it for the names of constant strings? Overkill 
which will only lead to  IDe prompts about unknown entry is added,  unused 
imports whenever one is cut. Remember, before there was that constant .* import 
we used to put them all in interfaces and simply use implements: that strategy 
also pushes them into subclasses, which is probably more dangerous. Do we want 
to back to that?


On Fri, Jun 23, 2017 at 2:29 AM, Steve Loughran 
<ste...@hortonworks.com<mailto:ste...@hortonworks.com>> wrote:


I've justone a patch for HADOOP-15553 -moving Azure module to the parallel 
integration tests of hadoop-aws, and now checkstyle is telling me off for the 
same static .* imports as I've been using up till now


org.apache.hadoop.fs.azure.metrics.AzureFileSystemInstrumentation. 
[UnusedImports]
./hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/AzureTestUtils.java:38:import
 static org.apache.hadoop.fs.azure.integration.AzureTestConstants.*;: Using the 
'.*' form of import should be avoided - 
org.apache.hadoop.fs.azure.integration.AzureTestConstants.*. [AvoidStarImport]
./hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/AzureTestUtils.java:273:
    return testUniqueForkId == null ? defVal ::46: ':' should be on a new line. 
[OperatorWrap]
./hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/ITestAzureHugeFiles.java:42:import
 static org.apache.hadoop.fs.azure.integration.AzureTestUtils.*;: Using the 
'.*' form of import should be avoided - 
org.apache.hadoop.fs.azure.integration.AzureTestUtils.*. [AvoidStarImport]
./hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azure/integration/ITestAzureHugeFiles.java:43:import
 static org.apache.hadoop.fs.contract.ContractTestUtils.*;: Using the '.*' form 
of import should be avoided -

I know we mustn't use that for importing all the classes in a package, but 
we've never had any restrictions on using it for static imports until now


Reply via email to