Hadoop Common
  1. Hadoop Common
  2. HADOOP-1294

Fix unchecked warnings in main Hadoop code under Java 6.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: test
    • Labels:
      None

      Description

      Reported by Tahir Hashmi:

      I get the following warning while building:

      [javac]
      /home/tahir/Desktop/Trunk/trunk/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java:439:
      warning: [unchecked] unchecked call to
      getConstructor(java.lang.Class<?>...) as a member of the raw type
      java.lang.Class
      [javac] randomDataGeneratorCtor = clazz.getConstructor(new
      Class[]

      {Long.TYPE}

      );
      [javac] ^
      [javac] Note: Some input files use or override a deprecated API.

      1. java6_unchecked.patch
        0.6 kB
        Tom White
      2. java6_unchecked2.patch
        3 kB
        Tom White

        Activity

        Hide
        Tom White added a comment -

        This is occurring because the getConstructor method on Class changed between Java 5 and 6, from:

        public Constructor<T> getConstructor(Class... parameterTypes)

        to

        public Constructor<T> getConstructor(Class<?>... parameterTypes)

        This patch should fix the warning. I haven't managed to test it on Java 6 - Tahir, would you be able to try it please?

        Show
        Tom White added a comment - This is occurring because the getConstructor method on Class changed between Java 5 and 6, from: public Constructor<T> getConstructor(Class... parameterTypes) to public Constructor<T> getConstructor(Class<?>... parameterTypes) This patch should fix the warning. I haven't managed to test it on Java 6 - Tahir, would you be able to try it please?
        Show
        Hadoop QA added a comment - +1 http://issues.apache.org/jira/secure/attachment/12356233/java6_unchecked.patch applied and successfully tested against trunk revision r532083. Test results: http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/76/testReport/ Console output: http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/76/console
        Hide
        Tahir Hashmi added a comment -

        I get the following warning after applying the patch:

        [javac] /home/tahir/Desktop/Hadoop/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java:439: warning: [unchecked] unchecked call to getConstructor(java.lang.Class<?>...) as a member of the raw type java.lang.Class
        [javac] randomDataGeneratorCtor = clazz.getConstructor(Long.TYPE);
        [javac] ^
        [javac] Note: Some input files use or override a deprecated API.
        [javac] Note: Recompile with -Xlint:deprecation for details.

        Show
        Tahir Hashmi added a comment - I get the following warning after applying the patch: [javac] /home/tahir/Desktop/Hadoop/src/test/org/apache/hadoop/dfs/ClusterTestDFS.java:439: warning: [unchecked] unchecked call to getConstructor(java.lang.Class<?>...) as a member of the raw type java.lang.Class [javac] randomDataGeneratorCtor = clazz.getConstructor(Long.TYPE); [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details.
        Hide
        Tom White added a comment -

        Thanks Tahir. I've now got Java 6 working which exposed a few more warnings. This patch fixes them. I've checked it with Java 5 too.

        Show
        Tom White added a comment - Thanks Tahir. I've now got Java 6 working which exposed a few more warnings. This patch fixes them. I've checked it with Java 5 too.
        Hide
        Tom White added a comment -

        I've just committed this.

        Show
        Tom White added a comment - I've just committed this.
        Hide
        Hadoop QA added a comment -
        Show
        Hadoop QA added a comment - Integrated in Hadoop-Nightly #71 (See http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Nightly/71/ )

          People

          • Assignee:
            Tom White
            Reporter:
            Tom White
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development