collections changed to mutable in kdoc

This commit is contained in:
Svetlana Isakova
2012-09-08 00:33:51 +04:00
parent e059f8b650
commit 47b3d4edd4
3 changed files with 23 additions and 18 deletions
@@ -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 * 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 * 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 * 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 * 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 * 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 * Adds one or more package prefixes to the given javadoc URL
*/ */
fun addPackageLink(url: String, vararg packagePrefixes: String): Unit { fun addPackageLink(url: String, vararg packagePrefixes: String): Unit {
for (p in packagePrefixes) { for (p in packagePrefixes) {
packagePrefixToUrls.put(p, url) mutablePackagePrefixToUrls.put(p, url)
} }
} }
@@ -97,7 +99,7 @@ class KDocConfig() {
return url return url
} }
} }
if (warn && missingPackageUrls.add(packageName)) { if (warn && mutableMissingPackageUrls.add(packageName)) {
println("Warning: could not find external link to package: $packageName") println("Warning: could not find external link to package: $packageName")
} }
return "" return ""
@@ -438,7 +438,7 @@ class KModel(val context: BindingContext, val config: KDocConfig, val sourceDirs
return null return null
} }
fun addTypeParameters(answer: List<KTypeParameter>, descriptors: List<TypeParameterDescriptor?>): Unit { fun addTypeParameters(answer: MutableList<KTypeParameter>, descriptors: List<TypeParameterDescriptor?>): Unit {
for (typeParam in descriptors) { for (typeParam in descriptors) {
if (typeParam != null) { if (typeParam != null) {
val p = createTypeParameter(typeParam) val p = createTypeParameter(typeParam)
@@ -1045,7 +1045,7 @@ class KPackage(model: KModel, val descriptor: NamespaceDescriptor,
fun packageProperties() = properties.filter{ it.extensionClass == null && it.isPublic() } 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()) { : KNamed(klass?.name ?: jetType.toString().sure(), model, jetType.getConstructor().getDeclarationDescriptor().sure()) {
{ {
if (klass != null) { if (klass != null) {
@@ -1056,7 +1056,7 @@ class KType(val jetType: JetType, model: KModel, val klass: KClass?, val argumen
val argJetType = arg.getType() val argJetType = arg.getType()
val t = model.getType(argJetType) val t = model.getType(argJetType)
if (t != null) { if (t != null) {
$arguments.add(t) arguments.add(t)
} }
} }
} }
@@ -1077,10 +1077,10 @@ class KClass(
val simpleName = descriptor.getName().getName() val simpleName = descriptor.getName().getName()
var group: String = "Other" var group: String = "Other"
var annotations: List<KAnnotation> = arrayList<KAnnotation>() var annotations: List<KAnnotation> = arrayList<KAnnotation>()
var typeParameters: List<KTypeParameter> = arrayList<KTypeParameter>() var typeParameters: MutableList<KTypeParameter> = arrayList<KTypeParameter>()
var since: String = "" var since: String = ""
var authors: List<String> = arrayList<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>() var nestedClasses: List<KClass> = arrayList<KClass>()
public override fun compareTo(other: KClass): Int = name.compareTo(other.name) public override fun compareTo(other: KClass): Int = name.compareTo(other.name)
@@ -1143,7 +1143,7 @@ class KClass(
fun isInterface() = kind == "interface" fun isInterface() = kind == "interface"
/** Returns all of the base classes and all of their descendants */ /** 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) { for (b in baseClasses) {
val c = b.klass val c = b.klass
if (c != null) { if (c != null) {
@@ -1161,7 +1161,7 @@ class KFunction(val descriptor: CallableDescriptor, val owner: KClassOrPackage,
var receiverType: KType? = null, var receiverType: KType? = null,
var extensionClass: KClass? = null, var extensionClass: KClass? = null,
var modifiers: List<String> = arrayList<String>(), 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 exceptions: List<KClass> = arrayList<KClass>(),
var annotations: List<KAnnotation> = arrayList<KAnnotation>()): KAnnotated(owner.model, descriptor), Comparable<KFunction> { var annotations: List<KAnnotation> = arrayList<KAnnotation>()): KAnnotated(owner.model, descriptor), Comparable<KFunction> {
@@ -37,12 +37,15 @@ class KDocTest {
val config = args.docConfig val config = args.docConfig
config.docOutputDir = outDir.toString()!! config.docOutputDir = outDir.toString()!!
config.title = "Kotlin API" config.title = "Kotlin API"
config.ignorePackages.add("org.jetbrains.kotlin")
config.ignorePackages.add("java") //todo@svtk KT-2745
config.ignorePackages.add("jet") val ignorePackages = config.ignorePackages as MutableSet<String>
config.ignorePackages.add("junit") ignorePackages.add("org.jetbrains.kotlin")
config.ignorePackages.add("sun") ignorePackages.add("java")
config.ignorePackages.add("org") ignorePackages.add("jet")
ignorePackages.add("junit")
ignorePackages.add("sun")
ignorePackages.add("org")
val compiler = KDocCompiler() val compiler = KDocCompiler()
val r = compiler.exec(System.out, args) val r = compiler.exec(System.out, args)