diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetNamedDeclarationStub.java b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetNamedDeclarationStub.java index e8236a4d6de..dedc8188887 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetNamedDeclarationStub.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetNamedDeclarationStub.java @@ -85,7 +85,7 @@ abstract class JetNamedDeclarationStub> extend JetModifierList modifierList = getModifierList(); if (modifierList != null && modifierList.hasModifier(JetTokens.OPERATOR_KEYWORD) && - !OperatorConventions.isConventionName(Name.identifierNoValidate(name))) { + !OperatorConventions.isConventionName(Name.identifier(name))) { removeModifier(JetTokens.OPERATOR_KEYWORD); } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSimpleNameExpression.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSimpleNameExpression.kt index 3223f76655e..cd27067605f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSimpleNameExpression.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/JetSimpleNameExpression.kt @@ -57,7 +57,7 @@ abstract class JetSimpleNameExpressionImpl(node: ASTNode) : JetExpressionImpl(no fun getReferencedNameAsNameImpl(expresssion: JetSimpleNameExpression): Name { val name = expresssion.getReferencedName() - return Name.identifierNoValidate(name) + return Name.identifier(name) } fun getReferencedNameImpl(expression: JetSimpleNameExpression): String { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java index 6e2ef62d877..c7396e14b5e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/types/expressions/ControlStructureTypingUtils.java @@ -100,7 +100,7 @@ public class ControlStructureTypingUtils { ) { assert argumentNames.size() == isArgumentNullable.size(); - Name specialFunctionName = Name.identifierNoValidate(""); + Name specialFunctionName = Name.identifier(""); SimpleFunctionDescriptorImpl function = SimpleFunctionDescriptorImpl.create( moduleDescriptor, Annotations.Companion.getEMPTY(), specialFunctionName, CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE @@ -108,7 +108,7 @@ public class ControlStructureTypingUtils { TypeParameterDescriptor typeParameter = TypeParameterDescriptorImpl.createWithDefaultBound( function, Annotations.Companion.getEMPTY(), false, Variance.INVARIANT, - Name.identifierNoValidate(""), 0); + Name.identifier(""), 0); JetType type = typeParameter.getDefaultType(); JetType nullableType = TypeUtils.makeNullable(type); diff --git a/core/descriptors/src/org/jetbrains/kotlin/name/Name.java b/core/descriptors/src/org/jetbrains/kotlin/name/Name.java index c5a6efb933c..48b5e2c433d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/name/Name.java +++ b/core/descriptors/src/org/jetbrains/kotlin/name/Name.java @@ -52,9 +52,6 @@ public final class Name implements Comparable { @NotNull public static Name identifier(@NotNull String name) { - if (!isValidIdentifier(name)) { - throw new IllegalArgumentException("invalid identifier: " + name); - } return new Name(name, false); } @@ -62,12 +59,6 @@ public final class Name implements Comparable { return !name.isEmpty() && !name.startsWith("<") && !name.contains(".") && !name.contains("/"); } - /** Must be validated by caller */ - @NotNull - public static Name identifierNoValidate(@NotNull String name) { - return new Name(name, false); - } - @NotNull public static Name special(@NotNull String name) { if (!name.startsWith("<")) { diff --git a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt index 53d02b9094b..e1413acc632 100644 --- a/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/highlighter/KotlinRecursiveCallLineMarkerProvider.kt @@ -137,7 +137,7 @@ private fun getCallNameFromPsi(element: JetElement): Name? { is JetSimpleNameExpression -> { val elementParent = element.getParent() when (elementParent) { - is JetCallExpression -> return Name.identifierNoValidate(element.getText()) + is JetCallExpression -> return Name.identifier(element.getText()) is JetOperationExpression -> { val operationReference = elementParent.getOperationReference() if (element == operationReference) { @@ -148,10 +148,10 @@ private fun getCallNameFromPsi(element: JetElement): Name? { else OperatorConventions.getNameForOperationSymbol(node) - conventionName ?: Name.identifierNoValidate(element.getText()) + conventionName ?: Name.identifier(element.getText()) } else { - Name.identifierNoValidate(element.getText()) + Name.identifier(element.getText()) } } }