Convert compile constant classes to kotlin: j2k
This commit is contained in:
@@ -63,7 +63,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.NOT_AN_ANNOTATION_CLASS;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.ANNOTATION_DESCRIPTOR_TO_PSI_ELEMENT;
|
||||
import static org.jetbrains.kotlin.types.TypeUtils.NO_EXPECTED_TYPE;
|
||||
|
||||
public class AnnotationResolver {
|
||||
|
||||
@@ -99,7 +99,7 @@ public object AnnotationTargetChecker {
|
||||
?: return DEFAULT_TARGET_LIST
|
||||
val valueArguments = targetEntryDescriptor.getAllValueArguments()
|
||||
val valueArgument = valueArguments.entrySet().firstOrNull()?.getValue() as? ArrayValue ?: return DEFAULT_TARGET_LIST
|
||||
return valueArgument.getValue().filterIsInstance<EnumValue>().map { it.getValue().getName().asString() }
|
||||
return valueArgument.value.filterIsInstance<EnumValue>().map { it.value.getName().asString() }
|
||||
}
|
||||
|
||||
private fun checkAnnotationEntry(entry: JetAnnotationEntry, actualTargets: List<Target>, trace: BindingTrace) {
|
||||
|
||||
@@ -59,5 +59,5 @@ private fun CallableDescriptor.isPlatformStaticIn(predicate: (DeclarationDescrip
|
||||
public fun AnnotationDescriptor.argumentValue(parameterName: String): Any? {
|
||||
return getAllValueArguments().entrySet()
|
||||
.singleOrNull { it.key.getName().asString() == parameterName }
|
||||
?.value?.getValue()
|
||||
?.value?.value
|
||||
}
|
||||
|
||||
+6
-6
@@ -151,7 +151,7 @@ public class ConstantExpressionEvaluator private constructor(val trace: BindingT
|
||||
else {
|
||||
if (!constant.canBeUsedInAnnotations()) canBeUsedInAnnotation = false
|
||||
if (constant.usesVariableAsConstant()) usesVariableAsConstant = true
|
||||
sb.append(constant.getValue())
|
||||
sb.append(constant.value)
|
||||
}
|
||||
}
|
||||
return if (!interupted)
|
||||
@@ -180,8 +180,8 @@ public class ConstantExpressionEvaluator private constructor(val trace: BindingT
|
||||
val rightConstant = evaluate(rightExpression, booleanType)
|
||||
if (rightConstant == null) return null
|
||||
|
||||
val leftValue = leftConstant.getValue()
|
||||
val rightValue = rightConstant.getValue()
|
||||
val leftValue = leftConstant.value
|
||||
val rightValue = rightConstant.value
|
||||
|
||||
if (leftValue !is Boolean || rightValue !is Boolean) return null
|
||||
val result = when(operationToken) {
|
||||
@@ -341,7 +341,7 @@ public class ConstantExpressionEvaluator private constructor(val trace: BindingT
|
||||
if (compileTimeConstant is IntegerValueTypeConstant)
|
||||
compileTimeConstant.getValue(expectedType ?: TypeUtils.NO_EXPECTED_TYPE)
|
||||
else
|
||||
compileTimeConstant.getValue()
|
||||
compileTimeConstant.value
|
||||
return createCompileTimeConstant(value, expectedType, isPure = false,
|
||||
canBeUsedInAnnotation = isPropertyCompileTimeConstant(callableDescriptor),
|
||||
usesVariableAsConstant = true)
|
||||
@@ -462,7 +462,7 @@ public class ConstantExpressionEvaluator private constructor(val trace: BindingT
|
||||
return OperationArgument(evaluationResultWithNewType, compileTimeType, expression)
|
||||
}
|
||||
|
||||
val evaluationResult = evaluatedConstant.getValue()
|
||||
val evaluationResult = evaluatedConstant.value
|
||||
if (evaluationResult == null) return null
|
||||
|
||||
return OperationArgument(evaluationResult, compileTimeType, expression)
|
||||
@@ -580,7 +580,7 @@ private fun createStringConstant(value: CompileTimeConstant<*>?): StringValue? {
|
||||
is CharValue,
|
||||
is DoubleValue, is FloatValue,
|
||||
is BooleanValue,
|
||||
is NullValue -> StringValue("${value.getValue()}", value.canBeUsedInAnnotations(), value.usesVariableAsConstant())
|
||||
is NullValue -> StringValue("${value.value}", value.canBeUsedInAnnotations(), value.usesVariableAsConstant())
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user