@@ -10,13 +10,14 @@ import java.lang.reflect.Constructor
10
10
import java.lang.reflect.Executable
11
11
import java.lang.reflect.Field
12
12
import java.lang.reflect.Method
13
+ import java.net.URL
13
14
import java.net.URLClassLoader
14
15
import kotlin.reflect.KFunction
15
16
import kotlin.reflect.KVisibility
16
17
import kotlin.reflect.jvm.kotlinFunction
17
18
import kotlin.reflect.jvm.kotlinProperty
18
19
19
- class Processor (xmlFile : File , jarFiles : List <File >, outputFile : File ? , ignoreFile : File ? ) {
20
+ class Processor (xmlFile : File , jarFiles : List <File >, outputFile : File ? ) {
20
21
21
22
private fun expressionClasses () =
22
23
" /api/package/*[local-name()='class' or local-name()='interface']"
@@ -47,8 +48,6 @@ class Processor(xmlFile: File, jarFiles: List<File>, outputFile: File?, ignoreFi
47
48
private val outputFile: File ?
48
49
private val xtransformsdoc: Document
49
50
50
- private val ignored: List <String >
51
-
52
51
init {
53
52
val urls = jarFiles.map { file -> file.toURI().toURL() }
54
53
loader = URLClassLoader (urls.toTypedArray())
@@ -58,12 +57,6 @@ class Processor(xmlFile: File, jarFiles: List<File>, outputFile: File?, ignoreFi
58
57
59
58
xtransformsdoc = Document (Element (" metadata" ))
60
59
this .outputFile = outputFile
61
-
62
- if (ignoreFile != null ) {
63
- ignored = ignoreFile.readLines()
64
- } else {
65
- ignored = emptyList()
66
- }
67
60
}
68
61
69
62
fun process () {
@@ -203,13 +196,13 @@ class Processor(xmlFile: File, jarFiles: List<File>, outputFile: File?, ignoreFi
203
196
204
197
// remove the members that are not meant to be used
205
198
processMembers(xclass, " constructor" ) {
206
- shouldRemoveMember(it, jclass.declaredConstructors + jclass.constructors )
199
+ shouldRemoveMember(it, jclass.declaredConstructors)
207
200
}
208
201
processMembers(xclass, " method" ) {
209
- shouldRemoveMember(it, jclass.declaredMethods + jclass.methods )
202
+ shouldRemoveMember(it, jclass.declaredMethods)
210
203
}
211
204
processMembers(xclass, " field" ) {
212
- shouldRemoveField(it, jclass.declaredFields + jclass.fields )
205
+ shouldRemoveField(it, jclass.declaredFields)
213
206
}
214
207
}
215
208
@@ -260,12 +253,6 @@ class Processor(xmlFile: File, jarFiles: List<File>, outputFile: File?, ignoreFi
260
253
261
254
logVerbose(" Checking the class \" ${xpackage} .${xname} \" ..." )
262
255
263
- // make sure we haven't been told to ignore this
264
- if (ignored.contains(" ${xpackage} .${xname} " )) {
265
- logVerbose(" Ignoring class \" ${xpackage} .${xname} \" because it was found in the ignore file..." )
266
- return ProcessResult .Ignore
267
- }
268
-
269
256
// before we check anything, make sure that the parent class is visible
270
257
var lastPeriod = xname.lastIndexOf(" ." )
271
258
while (lastPeriod != - 1 ) {
@@ -332,12 +319,6 @@ class Processor(xmlFile: File, jarFiles: List<File>, outputFile: File?, ignoreFi
332
319
val xtype = xmember.localName
333
320
val xfullname = " ${xpackage} .${xclassname} .${xname} "
334
321
335
- // make sure we haven't been told to ignore this
336
- if (ignored.contains(xfullname)) {
337
- logVerbose(" Ignoring member \" ${xfullname} \" because it was found in the ignore file..." )
338
- return ProcessResult .Ignore
339
- }
340
-
341
322
// before doing any complex checks, make sure it is not an invalid member
342
323
if (invalidKeywords.any { check -> check(xname) })
343
324
return ProcessResult .RemoveGenerated
@@ -429,12 +410,6 @@ class Processor(xmlFile: File, jarFiles: List<File>, outputFile: File?, ignoreFi
429
410
val xtype = xmember.getAttributeValue(" type" )
430
411
val xfullname = " ${xpackage} .${xclassname} .${xname} "
431
412
432
- // make sure we haven't been told to ignore this
433
- if (ignored.contains(xfullname)) {
434
- logVerbose(" Ignoring field \" ${xfullname} \" because it was found in the ignore file..." )
435
- return ProcessResult .Ignore
436
- }
437
-
438
413
// before doing any complex checks, make sure it is not an invalid member
439
414
if (invalidKeywords.any { check -> check(xname) }) {
440
415
return ProcessResult .RemoveGenerated
@@ -792,14 +767,14 @@ private val Element.parentElement: Element
792
767
793
768
private val KmPackage .functionOverloads: List <Pair <KmFunction , List <KmValueParameter >>>
794
769
get() = this .functions.map {
795
- it to it.valueParameters.getOverloads(it.receiverParameterType )
770
+ it to it.valueParameters.getOverloads()
796
771
}.flatMap { overload ->
797
772
overload.second.map { params -> overload.first to params }
798
773
}
799
774
800
775
private val KmClass .functionOverloads: List <Pair <KmFunction , List <KmValueParameter >>>
801
776
get() = this .functions.map {
802
- it to it.valueParameters.getOverloads(it.receiverParameterType )
777
+ it to it.valueParameters.getOverloads()
803
778
}.flatMap { overload ->
804
779
overload.second.map { params -> overload.first to params }
805
780
}
@@ -811,15 +786,9 @@ private val KmClass.constructorOverloads: List<Pair<KmConstructor, List<KmValueP
811
786
overload.second.map { params -> overload.first to params }
812
787
}
813
788
814
- private fun List<KmValueParameter>.getOverloads (receiverParameterType : KmType ? = null ): List <List <KmValueParameter >> {
789
+ private fun List<KmValueParameter>.getOverloads (): List <List <KmValueParameter >> {
815
790
val overloads = mutableListOf<List <KmValueParameter >>()
816
- if (receiverParameterType == null ) {
817
- overloads.add(this )
818
- } else {
819
- val t = KmValueParameter (0 , " this" )
820
- t.type = receiverParameterType
821
- overloads.add(listOf (t) + this )
822
- }
791
+ overloads.add(this )
823
792
while (Flag .ValueParameter .DECLARES_DEFAULT_VALUE (overloads.last().lastOrNull()?.flags ? : 0 )) {
824
793
val l = overloads.last()
825
794
overloads.add(l.take(l.size - 1 ))
0 commit comments