How to disambiguate links to methods in scaladoc?

后端 未结 4 1460
梦谈多话
梦谈多话 2021-02-03 19:57

I\'m documenting a Scala class with overloaded methods. How can I distinguish them when referring to them in scaladoc comments? For example, if I have

/**
 * The         


        
4条回答
  •  野的像风
    2021-02-03 20:43

    I found a solution (apparently the unique solution) for complex signatures, by studying the doc of scaladoc.

    • Don't use space in the signature
    • Use the arguments name
    • For argument types as well as return types, prefix all dots with a single backslash \
    • Use the star * at the end of the signature
    • Use the complete signature (as the ambiguous signatures are proposed to you). This step is optional, you may be able to stop the signature earlier, as long as you finish it with *

    Example:

    package org.my.stuff
    
    class ReturnType
    
    object Foo {
      class Bar {
        def lara(s: String): String = ???
        def lara(s: Foo.Bar): ReturnType= ???
      }
    }
    
    /** [[org.my.stuff.Foo$.Bar.lara(s:org\.my\.stuff\.Foo\.Bar):org\.my\.stuff\.ReturnType* The link to the right lara method]]
      */
    object DocumentFooBarBingComplex {
    }
    

提交回复
热议问题