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);
}
}
}