hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@hortonworks.com>
Subject Re: when did static .* imports fall found of checkstyle
Date Mon, 26 Jun 2017 10:34:04 GMT

On 23 Jun 2017, at 19:24, Andrew Wang <andrew.wang@cloudera.com<mailto:andrew.wang@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 <stevel@hortonworks.com<mailto:stevel@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



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message