Minor, delete useless class

This commit is contained in:
Alexander Udalov
2013-09-16 15:10:37 +04:00
parent 215a5f46b6
commit bab8fafd7b
3 changed files with 8 additions and 39 deletions
@@ -52,10 +52,16 @@ public final class Name implements Comparable<Name> {
@NotNull
public static Name identifier(@NotNull String name) {
NameUtils.requireIdentifier(name);
if (!isValidIdentifier(name)) {
throw new IllegalArgumentException("invalid identifier: " + name);
}
return new Name(name, false);
}
public static boolean isValidIdentifier(@NotNull String name) {
return !name.isEmpty() && !name.startsWith("<") && !name.contains(".") && !name.contains("/");
}
/** Must be validated by caller */
@NotNull
public static Name identifierNoValidate(@NotNull String name) {
@@ -1,36 +0,0 @@
/*
* Copyright 2010-2013 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.jet.lang.resolve.name;
import org.jetbrains.annotations.NotNull;
public class NameUtils {
private NameUtils() {
}
public static boolean isValidIdentified(@NotNull String name) {
return name.length() > 0 && !name.startsWith("<") && !name.contains(".") && !name.contains("/");
}
public static void requireIdentifier(@NotNull String name) {
if (!isValidIdentified(name)) {
throw new IllegalArgumentException("invalid identifier: " + name);
}
}
}
@@ -42,7 +42,6 @@ import org.jetbrains.jet.lang.resolve.lazy.storage.MemoizedFunctionToNotNull;
import org.jetbrains.jet.lang.resolve.lazy.storage.StorageManager;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.name.NameUtils;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
import org.jetbrains.jet.lang.types.TypeConstructor;
@@ -178,7 +177,7 @@ public class ResolveElementCache {
}
Name name = packageNameExpression.getReferencedNameAsName();
if (NameUtils.isValidIdentified(name.asString())) {
if (Name.isValidIdentifier(name.asString())) {
if (trace.getBindingContext().get(BindingContext.REFERENCE_TARGET, packageNameExpression) == null) {
FqName fqName = header.getParentFqName(packageNameExpression).child(name);
NamespaceDescriptor packageDescriptor = resolveSession.getPackageDescriptorByFqName(fqName);