Harmony
  1. Harmony
  2. HARMONY-6333

[classlib][luni] DatagramSocketImplTest fails to compile on RI due to method override differences

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0M12
    • Component/s: None
    • Labels:
      None
    • Environment:
      all
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Novice

      Description

      Testcase org.apache.harmony.luni.tests.java.net.DatagramSocketImplTest fails to compile on Sun or IBM java, with the error messages:

      [javac] 1. ERROR in ../modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketImplTest.java
      [javac] (at line 75)
      [javac] public Object getOption(int optID) throws SocketException {
      [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      [javac] The method getOption(int) of type MockDatagramSocketImpl must override a superclass method
      [javac] ----------
      [javac] 2. ERROR in ../modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/DatagramSocketImplTest.java
      [javac] (at line 133)
      [javac] public void setOption(int optID, Object val) throws SocketException {
      [javac] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      [javac] The method setOption(int, Object) of type MockDatagramSocketImpl must override a superclass method
      [javac] ----------
      [javac] 2 problems (2 errors)

      The problem is that in the Harmony implementation the getOption and setOption method signatures are copied from the SocketOptions interface into the implementing DatagramSocketImpl class, which is abstract. MockDatagramSocketImpl in the testcase extends this abstract class and annotates the methods with "@Override". However, the method signatures must not be copied in the reference implementations, as the "@Override" annotation throws an error saying that the methods aren't being overridden.

      Removing the override annotations fixes the problem, but I think the method signatures should be removed from java.net.DatagramSocketImpl

      1. 6333.patch
        2 kB
        Catherine Hope

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        37m 43s 1 Tim Ellison 03/Sep/09 14:49
        Resolved Resolved Closed Closed
        4d 18h 28m 1 Catherine Hope 08/Sep/09 09:17
        Catherine Hope made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Catherine Hope added a comment -

        Verified

        Show
        Catherine Hope added a comment - Verified
        Tim Ellison made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.0M12 [ 12314191 ]
        Resolution Fixed [ 1 ]
        Hide
        Tim Ellison added a comment -

        Thanks Catherine.

        Patch applied to LUNI module at repo revision r810938.

        I also removed @Override annotations from the PlainDatagramSocketImpl for the same reasons.

        Please verify the changes.

        Show
        Tim Ellison added a comment - Thanks Catherine. Patch applied to LUNI module at repo revision r810938. I also removed @Override annotations from the PlainDatagramSocketImpl for the same reasons. Please verify the changes.
        Tim Ellison made changes -
        Assignee Tim Ellison [ tellison ]
        Catherine Hope made changes -
        Field Original Value New Value
        Attachment 6333.patch [ 12418512 ]
        Catherine Hope created issue -

          People

          • Assignee:
            Tim Ellison
            Reporter:
            Catherine Hope
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development