Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-3723

Reconsider using Optional<String> as the parameter for getRequiredPermissions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • security
    • None

    Description

      The new method on function, getRequiredPermissions takes an Optional<String> as parameter.

      At point point, we added a parameterized type to the function interface (Function<T>). However, if someone tries to implement Function without the type (eg implements Function instead of implemments Function<Object>), then they get the below compilation error:

      Error:(85, 41) java: name clash: getRequiredPermissions(java.util.Optional<java.lang.String>) in org.apache.geode.cache.lucene.internal.distributed.WaitUntilFlushedFunction and getRequiredPermissions(java.util.Optional<java.lang.String>) in org.apache.geode.cache.execute.Function have the same erasure, yet neither overrides the other
      

      In addition to this annoyance Optional is generally discouraged as a parameter to a method in favor of method overloading. At least my IDE is providing a warning to that effect. Maybe having an overloaded method for getRequiredPermissions would be better?

      Attachments

        Activity

          People

            jens.deppe Jens Deppe
            upthewaterspout Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: