[groovy] get rid of duplicate code in GrClosureType inheritors

This commit is contained in:
Daniil Ovchinnikov
2018-06-04 21:43:37 +03:00
parent b86c59944e
commit 2fec26eada
6 changed files with 8 additions and 94 deletions
@@ -57,12 +57,6 @@ public class GrClosureType extends GrLiteralClassType {
myClosure = closure;
}
@Override
@NotNull
public String getClassName() {
return "Closure";
}
@Override
public int getParameterCount() {
PsiClass resolved = resolve();
@@ -13,6 +13,7 @@ import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import static com.intellij.openapi.util.RecursionManager.doPreventingRecursion;
import static com.intellij.openapi.util.text.StringUtil.getShortName;
/**
* @author peter
@@ -105,7 +106,9 @@ public abstract class GrLiteralClassType extends PsiClassType {
@Override
@NotNull
public abstract String getClassName() ;
public String getClassName() {
return getShortName(getJavaClassName());
}
@Override
@NotNull
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi.impl;
@@ -68,12 +54,6 @@ public abstract class GrMapType extends GrLiteralClassType {
return GroovyCommonClassNames.JAVA_UTIL_LINKED_HASH_MAP;
}
@Override
@NotNull
public String getClassName() {
return "LinkedHashMap";
}
@Nullable
public abstract PsiType getTypeByStringKey(String key);
@@ -1,21 +1,6 @@
/*
* Copyright 2000-2014 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi.impl;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
@@ -68,12 +53,6 @@ public class GrRangeType extends GrLiteralClassType {
return myQualifiedName;
}
@NotNull
@Override
public String getClassName() {
return StringUtil.getShortName(myQualifiedName);
}
@NotNull
@Override
public PsiType[] getParameters() {
@@ -1,24 +1,9 @@
/*
* Copyright 2000-2014 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi.impl;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.VolatileNotNullLazyValue;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.JavaPsiFacade;
@@ -68,12 +53,6 @@ public abstract class GrTupleType extends GrLiteralClassType {
return CommonClassNames.JAVA_UTIL_LIST;
}
@Override
@NotNull
public String getClassName() {
return StringUtil.getShortName(getJavaClassName());
}
@Override
@NotNull
public PsiType[] getParameters() {
@@ -1,21 +1,6 @@
/*
* Copyright 2000-2014 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.psi.impl;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClassType;
@@ -42,12 +27,6 @@ public class LazyFqnClassType extends GrLiteralClassType {
return myFqn;
}
@NotNull
@Override
public String getClassName() {
return StringUtil.getShortName(myFqn);
}
@NotNull
@Override
public PsiType[] getParameters() {