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

type arguments to non-generic methods

    Details

    • Subcomponent:
    • Introduced In Build:
      5.0
    • Introduced In Version:
      5.0
    • Resolved In Build:
      b03
    • CPU:
      generic, x86
    • OS:
      generic, linux, windows_7
    • Verification:
      Verified

      Description

      Giving Type argument to a method which does not take one compiles

      Tried with Beta3 buiold 59 on solaris

      Test Case:-
      /**Not a valid program, since one cannot pass a type argument to a method
        *that does not take one
        */
        
      class A {
        
         public <T> void callA() {
             System.out.println("Called callA method in class A");
         }

      }

      class B<T> {
         public <T> void callB() {
            System.out.println("Called callB method in class B");
         }
      }


      public class Test17 {
        
        public void check1() {
            A a_ref = new A();
            a_ref.<String>callA();
        }
        
        public void check2() {
             B<String> b_ref = new B<String>();
             b_ref.<String>callB();
        }
        
        public static void main(String args[]) {
            Test17 test17_ref = new Test17();
            test17_ref.check1();
            test17_ref.check2();
        }

      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ahe Peter Ahe
                Reporter:
                jsinghsunw Jit Singh (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: