Move method createArrayType to JavaType and drop JavaElementFactory

This commit is contained in:
zarechenskiy
2014-03-28 19:27:25 +04:00
committed by Alexander Udalov
parent 735df2e340
commit 2e4028ba3a
7 changed files with 13 additions and 73 deletions
@@ -183,7 +183,7 @@ public final class DescriptorResolverUtils {
}
else if (type instanceof JavaArrayType) {
JavaType erasure = erasure(((JavaArrayType) type).getComponentType(), substitutor);
return erasure == null ? null : JavaElementFactory.getInstance().createArrayType(erasure);
return erasure == null ? null : erasure.createArrayType();
}
else if (type instanceof JavaWildcardType) {
JavaWildcardType wildcardType = (JavaWildcardType) type;
@@ -1,40 +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.java.structure;
import org.jetbrains.annotations.NotNull;
import java.util.Iterator;
import java.util.ServiceLoader;
public abstract class JavaElementFactory {
private static JavaElementFactory instance;
@NotNull
public static JavaElementFactory getInstance() {
if (instance == null) {
Iterator<JavaElementFactory> iterator =
ServiceLoader.load(JavaElementFactory.class, JavaElementFactory.class.getClassLoader()).iterator();
assert iterator.hasNext() : "No service found: " + JavaElementFactory.class.getName();
instance = iterator.next();
}
return instance;
}
@NotNull
public abstract JavaArrayType createArrayType(@NotNull JavaType elementType);
}
@@ -16,5 +16,9 @@
package org.jetbrains.jet.lang.resolve.java.structure;
import org.jetbrains.annotations.NotNull;
public interface JavaType {
@NotNull
JavaArrayType createArrayType();
}