Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4413358

could "does not define <method>" message include return type, param. names?



    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
    • OS:


      Name: ssT124754 Date: 02/08/2001

      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      When the compiler reports the following message about required but unimplemented

        Test.java:7: Test should be declared abstract; it does not define method(int)
      in Test
        public class Test

      it would be convenient if the message also included the return type of the
      method, and also the original parameter names, as your earlier compilers did.

      This probably isn't a principal use case, but having that information in the
      error message would make it easier to create the missing methods by copying
      from the error message and pasting directly into the source code.

      Consider this usage pattern of using the compiler to find out what all you
      need to implement:

      1. You declare that a class implements an interface.
      2. You try to compile.
      3. The compiler reports some missing required method.
      4. You define that method by cutting from the compiler message, pasting into
         the source, and editing as necessary.
      5. You repeat from step 2 as necessary.

      (And look--you don't even need a fancy IDE to find out the methods you need
      to implement for the interface; you can get the info. from the compiler. )

      This probably doesn't _sound_ like a clean way to develop code (implying not
      looking at the documentation). However, nothing says you can't be
      looking at the documentation to check the contracts of interface methods
      you're adding by cutting and pasting.

      Your earlier compiler used to report the return type and the parameter names,
      so it was easy to simply cut and paste all of that.

      Your current compiler provides less information, requiring looking at other
      sources for original parameter names.

      I realize that the current error message is printing the offical identity
      of the method (its name and parameter type signature, which uniquely identifies
      it). However, could you consider restoring the return type and original
      parameter names as your earlier compiler did?

      Here's a test case:
      interface Interface
          void method( int x );
      } // interface Interface

      public class Test
             implements Interface
      } // class Test
      Test.java:7: Test should be declared abstract; it does not define method(int) in
      public class Test
      1 error

      (Review ID: 116556)




            gafter Neal Gafter
            ssultanasunw Shaheen Sultana (Inactive)
            0 Vote for this issue
            0 Start watching this issue