Workaround for compilation issue: don't use a Java shim to access token name, use toString() instead (for all relevant tokens, it will return the name, and for all others, the return value won't match the Java keyword filter regexp)
This commit is contained in:
+2
-3
@@ -28,7 +28,6 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.kapt3.*
|
||||
import org.jetbrains.kotlin.kapt3.javac.KaptTreeMaker
|
||||
import org.jetbrains.kotlin.kapt3.javac.KaptJavaFileObject
|
||||
import org.jetbrains.kotlin.kapt3.stubs.Kapt3StubUtils.*
|
||||
import org.jetbrains.kotlin.kapt3.util.*
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
@@ -75,8 +74,8 @@ class ClassFileToSourceStubConverter(
|
||||
private val JAVA_KEYWORD_FILTER_REGEX = "[a-z]+".toRegex()
|
||||
|
||||
private val JAVA_KEYWORDS = Tokens.TokenKind.values()
|
||||
.filter { JAVA_KEYWORD_FILTER_REGEX.matches(getTokenName(it)) }
|
||||
.mapTo(hashSetOf(), ::getTokenName)
|
||||
.filter { JAVA_KEYWORD_FILTER_REGEX.matches(it.toString().orEmpty()) }
|
||||
.mapTo(hashSetOf(), Any::toString)
|
||||
}
|
||||
|
||||
private val _bindings = mutableMapOf<String, KaptJavaFileObject>()
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.kapt3.stubs;
|
||||
|
||||
import com.sun.tools.javac.parser.Tokens;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Kapt3StubUtils {
|
||||
@NotNull
|
||||
public static String getTokenName(@NotNull Tokens.TokenKind kind) {
|
||||
// This is a work-around. `name` can't be called from Kotlin, as it clashes with the `name` enum property.
|
||||
String name = kind.name;
|
||||
return (name == null) ? "" : name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user