Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-10866

Fix Eclipse Java 8 compile errors related to generic parameters.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha1
    • Fix Version/s: 3.0.0-alpha2
    • Component/s: None
    • Labels:
      None

      Description

      Compilation with Java 8 in Eclipse returns errors, which are related to the use of generics. This does not effect command line maven builds and is confirmed to be a bug in Eclipse.The fix is scheduled only for the next release, so all of us using Eclipse now will have that error.
      Unless we fix it in Hadoop code, which makes sense to me as it appears as a warning in any case.

      1. HDFS-10866.01.patch
        9 kB
        Konstantin Shvachko
      2. IntelliJ.png
        31 kB
        Akira Ajisaka
      3. Screen Shot 2016-09-19 at 1.50.22 PM.png
        56 kB
        Zhe Zhang

        Activity

        Hide
        shv Konstantin Shvachko added a comment -

        Twp types of errors:

        1. In MapFile.main() Eclipse complains that ReflectionUtils.newInstance() is not applicable for the arguments (Class<? extends WritableComparable>, Configuration).
        2. The following line, which appears multiple times in two tests TestDelegationTokenRenewer and TestWebHdfsTokens
          verify(fs, never()).setDelegationToken(any(Token.class));
          causes error saying setDelegationToken(Token<T>) is not applicable for the arguments (Token).
        Show
        shv Konstantin Shvachko added a comment - Twp types of errors: In MapFile.main() Eclipse complains that ReflectionUtils.newInstance() is not applicable for the arguments (Class<? extends WritableComparable>, Configuration) . The following line, which appears multiple times in two tests TestDelegationTokenRenewer and TestWebHdfsTokens verify(fs, never()).setDelegationToken(any(Token.class)); causes error saying setDelegationToken(Token<T>) is not applicable for the arguments (Token) .
        Hide
        shv Konstantin Shvachko added a comment -

        Simple patch, which fixes eclipse build for me and removes a bunch of warnings.

        • For (1) it just adds <?> for the generic type in variable declaration.
        • For (2) I just used less type specific any() instead of any(Token.class).
        Show
        shv Konstantin Shvachko added a comment - Simple patch, which fixes eclipse build for me and removes a bunch of warnings. For (1) it just adds <?> for the generic type in variable declaration. For (2) I just used less type specific any() instead of any(Token.class) .
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 18s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
        0 mvndep 0m 14s Maven dependency ordering for branch
        +1 mvninstall 6m 37s trunk passed
        +1 compile 6m 47s trunk passed
        +1 checkstyle 1m 25s trunk passed
        +1 mvnsite 1m 45s trunk passed
        +1 mvneclipse 0m 25s trunk passed
        +1 findbugs 2m 58s trunk passed
        +1 javadoc 1m 39s trunk passed
        0 mvndep 0m 14s Maven dependency ordering for patch
        +1 mvninstall 1m 24s the patch passed
        +1 compile 6m 41s the patch passed
        +1 javac 6m 41s the patch passed
        -0 checkstyle 1m 25s root: The patch generated 1 new + 96 unchanged - 2 fixed = 97 total (was 98)
        +1 mvnsite 1m 45s the patch passed
        +1 mvneclipse 0m 25s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 3m 12s the patch passed
        +1 javadoc 1m 39s the patch passed
        -1 unit 7m 2s hadoop-common in the patch failed.
        -1 unit 58m 48s hadoop-hdfs in the patch failed.
        +1 asflicense 0m 25s The patch does not generate ASF License warnings.
        106m 2s



        Reason Tests
        Failed junit tests hadoop.net.TestDNS
          hadoop.hdfs.TestDataTransferKeepalive



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:9560f25
        JIRA Issue HDFS-10866
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12828782/HDFS-10866.01.patch
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux 92911648a680 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / ec3ea18
        Default Java 1.8.0_101
        findbugs v3.0.0
        checkstyle https://builds.apache.org/job/PreCommit-HDFS-Build/16767/artifact/patchprocess/diff-checkstyle-root.txt
        unit https://builds.apache.org/job/PreCommit-HDFS-Build/16767/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt
        unit https://builds.apache.org/job/PreCommit-HDFS-Build/16767/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt
        Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/16767/testReport/
        modules C: hadoop-common-project/hadoop-common hadoop-hdfs-project/hadoop-hdfs U: .
        Console output https://builds.apache.org/job/PreCommit-HDFS-Build/16767/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 18s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. 0 mvndep 0m 14s Maven dependency ordering for branch +1 mvninstall 6m 37s trunk passed +1 compile 6m 47s trunk passed +1 checkstyle 1m 25s trunk passed +1 mvnsite 1m 45s trunk passed +1 mvneclipse 0m 25s trunk passed +1 findbugs 2m 58s trunk passed +1 javadoc 1m 39s trunk passed 0 mvndep 0m 14s Maven dependency ordering for patch +1 mvninstall 1m 24s the patch passed +1 compile 6m 41s the patch passed +1 javac 6m 41s the patch passed -0 checkstyle 1m 25s root: The patch generated 1 new + 96 unchanged - 2 fixed = 97 total (was 98) +1 mvnsite 1m 45s the patch passed +1 mvneclipse 0m 25s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 3m 12s the patch passed +1 javadoc 1m 39s the patch passed -1 unit 7m 2s hadoop-common in the patch failed. -1 unit 58m 48s hadoop-hdfs in the patch failed. +1 asflicense 0m 25s The patch does not generate ASF License warnings. 106m 2s Reason Tests Failed junit tests hadoop.net.TestDNS   hadoop.hdfs.TestDataTransferKeepalive Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue HDFS-10866 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12828782/HDFS-10866.01.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux 92911648a680 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / ec3ea18 Default Java 1.8.0_101 findbugs v3.0.0 checkstyle https://builds.apache.org/job/PreCommit-HDFS-Build/16767/artifact/patchprocess/diff-checkstyle-root.txt unit https://builds.apache.org/job/PreCommit-HDFS-Build/16767/artifact/patchprocess/patch-unit-hadoop-common-project_hadoop-common.txt unit https://builds.apache.org/job/PreCommit-HDFS-Build/16767/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/16767/testReport/ modules C: hadoop-common-project/hadoop-common hadoop-hdfs-project/hadoop-hdfs U: . Console output https://builds.apache.org/job/PreCommit-HDFS-Build/16767/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        shv Konstantin Shvachko added a comment -

        Looks like test failures are unrelated and the checkstyle issue is not new.
        Anybody wants to review this?

        Show
        shv Konstantin Shvachko added a comment - Looks like test failures are unrelated and the checkstyle issue is not new. Anybody wants to review this?
        Hide
        ajisakaa Akira Ajisaka added a comment -

        I tried your patch and got the following error in IntelliJ IDEA 2016.2.4.

        How about using verify(fs, never()).setDelegationToken((Token)any()) instead?

        Show
        ajisakaa Akira Ajisaka added a comment - I tried your patch and got the following error in IntelliJ IDEA 2016.2.4. How about using verify(fs, never()).setDelegationToken((Token)any()) instead?
        Hide
        shv Konstantin Shvachko added a comment -

        Thanks for checking on IntelliJ, Akira. (Token) is a raw type - that was the problem with the original variant. LMK if (Token<?>)any() works for you. It does for me.

        Show
        shv Konstantin Shvachko added a comment - Thanks for checking on IntelliJ, Akira. (Token) is a raw type - that was the problem with the original variant. LMK if (Token<?>)any() works for you. It does for me.
        Hide
        hadoopqa Hadoop QA added a comment -
        +1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 9s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 2 new or modified test files.
        0 mvndep 0m 14s Maven dependency ordering for branch
        +1 mvninstall 6m 39s trunk passed
        +1 compile 6m 44s trunk passed
        +1 checkstyle 1m 27s trunk passed
        +1 mvnsite 1m 44s trunk passed
        +1 mvneclipse 0m 24s trunk passed
        +1 findbugs 2m 55s trunk passed
        +1 javadoc 1m 38s trunk passed
        0 mvndep 0m 14s Maven dependency ordering for patch
        +1 mvninstall 1m 25s the patch passed
        +1 compile 6m 43s the patch passed
        +1 javac 6m 43s the patch passed
        -0 checkstyle 1m 26s root: The patch generated 1 new + 96 unchanged - 2 fixed = 97 total (was 98)
        +1 mvnsite 1m 43s the patch passed
        +1 mvneclipse 0m 24s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 3m 13s the patch passed
        +1 javadoc 1m 38s the patch passed
        +1 unit 7m 58s hadoop-common in the patch passed.
        +1 unit 58m 31s hadoop-hdfs in the patch passed.
        +1 asflicense 0m 24s The patch does not generate ASF License warnings.
        106m 25s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:9560f25
        JIRA Issue HDFS-10866
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12828909/HDFS-10866.02.patch
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux 75cdeafcd3ef 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / 0e68e14
        Default Java 1.8.0_101
        findbugs v3.0.0
        checkstyle https://builds.apache.org/job/PreCommit-HDFS-Build/16779/artifact/patchprocess/diff-checkstyle-root.txt
        Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/16779/testReport/
        modules C: hadoop-common-project/hadoop-common hadoop-hdfs-project/hadoop-hdfs U: .
        Console output https://builds.apache.org/job/PreCommit-HDFS-Build/16779/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 reexec 0m 9s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 2 new or modified test files. 0 mvndep 0m 14s Maven dependency ordering for branch +1 mvninstall 6m 39s trunk passed +1 compile 6m 44s trunk passed +1 checkstyle 1m 27s trunk passed +1 mvnsite 1m 44s trunk passed +1 mvneclipse 0m 24s trunk passed +1 findbugs 2m 55s trunk passed +1 javadoc 1m 38s trunk passed 0 mvndep 0m 14s Maven dependency ordering for patch +1 mvninstall 1m 25s the patch passed +1 compile 6m 43s the patch passed +1 javac 6m 43s the patch passed -0 checkstyle 1m 26s root: The patch generated 1 new + 96 unchanged - 2 fixed = 97 total (was 98) +1 mvnsite 1m 43s the patch passed +1 mvneclipse 0m 24s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 3m 13s the patch passed +1 javadoc 1m 38s the patch passed +1 unit 7m 58s hadoop-common in the patch passed. +1 unit 58m 31s hadoop-hdfs in the patch passed. +1 asflicense 0m 24s The patch does not generate ASF License warnings. 106m 25s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Issue HDFS-10866 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12828909/HDFS-10866.02.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux 75cdeafcd3ef 3.13.0-93-generic #140-Ubuntu SMP Mon Jul 18 21:21:05 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 0e68e14 Default Java 1.8.0_101 findbugs v3.0.0 checkstyle https://builds.apache.org/job/PreCommit-HDFS-Build/16779/artifact/patchprocess/diff-checkstyle-root.txt Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/16779/testReport/ modules C: hadoop-common-project/hadoop-common hadoop-hdfs-project/hadoop-hdfs U: . Console output https://builds.apache.org/job/PreCommit-HDFS-Build/16779/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        zhz Zhe Zhang added a comment -

        Thanks Konstantin. v2 patch works for my IntelliJ installation (see version in attached image).

        +1 (let's wait for Akira to confirm).

        Show
        zhz Zhe Zhang added a comment - Thanks Konstantin. v2 patch works for my IntelliJ installation (see version in attached image). +1 (let's wait for Akira to confirm).
        Hide
        ajisakaa Akira Ajisaka added a comment -

        Thanks Konstatin for the update and thanks Zhe Zhang for the review.
        Rethinking this, I'm +1 for the v1 patch. After re-importing the project, the v1 patch worked on my environment. Hi Zhe Zhang, would you verify the v1 patch? Sorry for back and force.

        Show
        ajisakaa Akira Ajisaka added a comment - Thanks Konstatin for the update and thanks Zhe Zhang for the review. Rethinking this, I'm +1 for the v1 patch. After re-importing the project, the v1 patch worked on my environment. Hi Zhe Zhang , would you verify the v1 patch? Sorry for back and force.
        Hide
        shv Konstantin Shvachko added a comment - - edited

        I just committed patch 01 to trunk.

        Show
        shv Konstantin Shvachko added a comment - - edited I just committed patch 01 to trunk.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10481 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10481/)
        HDFS-10866. Fix Eclipse Java compile errors related to generic (shv: rev 6eb700ee7469cd77524676d62cbd20043f111288)

        • (edit) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java
        • (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java
        • (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTokens.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10481 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10481/ ) HDFS-10866 . Fix Eclipse Java compile errors related to generic (shv: rev 6eb700ee7469cd77524676d62cbd20043f111288) (edit) hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/MapFile.java (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestDelegationTokenRenewer.java (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestWebHdfsTokens.java

          People

          • Assignee:
            shv Konstantin Shvachko
            Reporter:
            shv Konstantin Shvachko
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development