collections changed to mutable in kdoc
This commit is contained in:
@@ -27,12 +27,13 @@ class KDocConfig() {
|
||||
* Returns a map of the package prefix to the HTML URL for the root of the apidoc using javadoc/kdoc style
|
||||
* directory layouts so that this API doc report can link to external packages
|
||||
*/
|
||||
public val packagePrefixToUrls: Map<String, String> = TreeMap<String, String>(LongestFirstStringComparator())
|
||||
private val mutablePackagePrefixToUrls: MutableMap<String, String> = TreeMap<String, String>(LongestFirstStringComparator())
|
||||
public val packagePrefixToUrls: Map<String, String> = mutablePackagePrefixToUrls
|
||||
|
||||
/**
|
||||
* Returns a Set of the package name prefixes to ignore from the KDoc report
|
||||
*/
|
||||
public val ignorePackages: Set<String> = HashSet<String>()
|
||||
public val ignorePackages: MutableSet<String> = HashSet<String>()
|
||||
|
||||
/**
|
||||
* Returns true if a warning should be generated if there are no comments
|
||||
@@ -75,14 +76,15 @@ class KDocConfig() {
|
||||
/**
|
||||
* Returns a set of all the package which have been warned that were missing an external URL
|
||||
*/
|
||||
public val missingPackageUrls: Set<String> = TreeSet<String>()
|
||||
private val mutableMissingPackageUrls: MutableSet<String> = TreeSet<String>()
|
||||
public val missingPackageUrls: Set<String> = mutableMissingPackageUrls
|
||||
|
||||
/**
|
||||
* Adds one or more package prefixes to the given javadoc URL
|
||||
*/
|
||||
fun addPackageLink(url: String, vararg packagePrefixes: String): Unit {
|
||||
for (p in packagePrefixes) {
|
||||
packagePrefixToUrls.put(p, url)
|
||||
mutablePackagePrefixToUrls.put(p, url)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +99,7 @@ class KDocConfig() {
|
||||
return url
|
||||
}
|
||||
}
|
||||
if (warn && missingPackageUrls.add(packageName)) {
|
||||
if (warn && mutableMissingPackageUrls.add(packageName)) {
|
||||
println("Warning: could not find external link to package: $packageName")
|
||||
}
|
||||
return ""
|
||||
|
||||
@@ -438,7 +438,7 @@ class KModel(val context: BindingContext, val config: KDocConfig, val sourceDirs
|
||||
return null
|
||||
}
|
||||
|
||||
fun addTypeParameters(answer: List<KTypeParameter>, descriptors: List<TypeParameterDescriptor?>): Unit {
|
||||
fun addTypeParameters(answer: MutableList<KTypeParameter>, descriptors: List<TypeParameterDescriptor?>): Unit {
|
||||
for (typeParam in descriptors) {
|
||||
if (typeParam != null) {
|
||||
val p = createTypeParameter(typeParam)
|
||||
@@ -1045,7 +1045,7 @@ class KPackage(model: KModel, val descriptor: NamespaceDescriptor,
|
||||
fun packageProperties() = properties.filter{ it.extensionClass == null && it.isPublic() }
|
||||
}
|
||||
|
||||
class KType(val jetType: JetType, model: KModel, val klass: KClass?, val arguments: List<KType> = ArrayList<KType>())
|
||||
class KType(val jetType: JetType, model: KModel, val klass: KClass?, val arguments: MutableList<KType> = ArrayList<KType>())
|
||||
: KNamed(klass?.name ?: jetType.toString().sure(), model, jetType.getConstructor().getDeclarationDescriptor().sure()) {
|
||||
{
|
||||
if (klass != null) {
|
||||
@@ -1056,7 +1056,7 @@ class KType(val jetType: JetType, model: KModel, val klass: KClass?, val argumen
|
||||
val argJetType = arg.getType()
|
||||
val t = model.getType(argJetType)
|
||||
if (t != null) {
|
||||
$arguments.add(t)
|
||||
arguments.add(t)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1077,10 +1077,10 @@ class KClass(
|
||||
val simpleName = descriptor.getName().getName()
|
||||
var group: String = "Other"
|
||||
var annotations: List<KAnnotation> = arrayList<KAnnotation>()
|
||||
var typeParameters: List<KTypeParameter> = arrayList<KTypeParameter>()
|
||||
var typeParameters: MutableList<KTypeParameter> = arrayList<KTypeParameter>()
|
||||
var since: String = ""
|
||||
var authors: List<String> = arrayList<String>()
|
||||
var baseClasses: List<KType> = arrayList<KType>()
|
||||
var baseClasses: MutableList<KType> = arrayList<KType>()
|
||||
var nestedClasses: List<KClass> = arrayList<KClass>()
|
||||
|
||||
public override fun compareTo(other: KClass): Int = name.compareTo(other.name)
|
||||
@@ -1143,7 +1143,7 @@ class KClass(
|
||||
fun isInterface() = kind == "interface"
|
||||
|
||||
/** Returns all of the base classes and all of their descendants */
|
||||
fun descendants(answer: Set<KClass> = LinkedHashSet<KClass>()): Set<KClass> {
|
||||
fun descendants(answer: MutableSet<KClass> = LinkedHashSet<KClass>()): Set<KClass> {
|
||||
for (b in baseClasses) {
|
||||
val c = b.klass
|
||||
if (c != null) {
|
||||
@@ -1161,7 +1161,7 @@ class KFunction(val descriptor: CallableDescriptor, val owner: KClassOrPackage,
|
||||
var receiverType: KType? = null,
|
||||
var extensionClass: KClass? = null,
|
||||
var modifiers: List<String> = arrayList<String>(),
|
||||
var typeParameters: List<KTypeParameter> = arrayList<KTypeParameter>(),
|
||||
var typeParameters: MutableList<KTypeParameter> = arrayList<KTypeParameter>(),
|
||||
var exceptions: List<KClass> = arrayList<KClass>(),
|
||||
var annotations: List<KAnnotation> = arrayList<KAnnotation>()): KAnnotated(owner.model, descriptor), Comparable<KFunction> {
|
||||
|
||||
|
||||
@@ -37,12 +37,15 @@ class KDocTest {
|
||||
val config = args.docConfig
|
||||
config.docOutputDir = outDir.toString()!!
|
||||
config.title = "Kotlin API"
|
||||
config.ignorePackages.add("org.jetbrains.kotlin")
|
||||
config.ignorePackages.add("java")
|
||||
config.ignorePackages.add("jet")
|
||||
config.ignorePackages.add("junit")
|
||||
config.ignorePackages.add("sun")
|
||||
config.ignorePackages.add("org")
|
||||
|
||||
//todo@svtk KT-2745
|
||||
val ignorePackages = config.ignorePackages as MutableSet<String>
|
||||
ignorePackages.add("org.jetbrains.kotlin")
|
||||
ignorePackages.add("java")
|
||||
ignorePackages.add("jet")
|
||||
ignorePackages.add("junit")
|
||||
ignorePackages.add("sun")
|
||||
ignorePackages.add("org")
|
||||
|
||||
val compiler = KDocCompiler()
|
||||
val r = compiler.exec(System.out, args)
|
||||
|
||||
Reference in New Issue
Block a user