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

Semicolon is missing when you define any functions like Supplier interface

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Anywhere. Not environment specific

      A DESCRIPTION OF THE PROBLEM :
              Supplier<Integer> integerSupplier = new Supplier<Integer>() {
                  @Override
                  public Integer get() {
                      return 1;
                  }
              };

      You need to add a semicolon at the end of the method. It should be by default present when you implement any interface.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.Implement any interface.
      2. For example, I am implementing supplier interface. When you implement this it will give you error as a semicolon is missing at the end of the method.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Semicolon should also come when you implement any interface.

      ---------- BEGIN SOURCE ----------
      Actual:

      Supplier<Integer> integerSupplier = new Supplier<Integer>() {
                  @Override
                  public Integer get() {
                      return 1;
                  }
              }

      Expected:

              Supplier<Integer> integerSupplier = new Supplier<Integer>() {
                  @Override
                  public Integer get() {
                      return 1;
                  }
              };
      ---------- END SOURCE ----------

      FREQUENCY : always


            smarks Stuart Marks
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: