Remove unused classes and methods in org.jetbrains.lang.resolve.java.kt package
This commit is contained in:
-77
@@ -1,77 +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.kt;
|
||||
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import com.intellij.psi.PsiParameter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver;
|
||||
|
||||
public class JetValueParameterAnnotation extends PsiAnnotationWrapper {
|
||||
private static final JetValueParameterAnnotation NULL_ANNOTATION = new JetValueParameterAnnotation(null);
|
||||
|
||||
static {
|
||||
NULL_ANNOTATION.checkInitialized();
|
||||
}
|
||||
|
||||
private String name;
|
||||
private String type;
|
||||
private boolean receiver;
|
||||
private boolean vararg;
|
||||
|
||||
private JetValueParameterAnnotation(@Nullable PsiAnnotation psiAnnotation) {
|
||||
super(psiAnnotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
name = getStringAttribute(JvmStdlibNames.JET_VALUE_PARAMETER_NAME_FIELD, "");
|
||||
type = getStringAttribute(JvmStdlibNames.JET_VALUE_PARAMETER_TYPE_FIELD, "");
|
||||
receiver = getBooleanAttribute(JvmStdlibNames.JET_VALUE_PARAMETER_RECEIVER_FIELD, false);
|
||||
vararg = getBooleanAttribute(JvmStdlibNames.JET_VALUE_PARAMETER_VARARG, false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String name() {
|
||||
checkInitialized();
|
||||
return name;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String type() {
|
||||
checkInitialized();
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean receiver() {
|
||||
checkInitialized();
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public boolean vararg() {
|
||||
checkInitialized();
|
||||
return vararg;
|
||||
}
|
||||
|
||||
public static JetValueParameterAnnotation get(PsiParameter psiParameter) {
|
||||
PsiAnnotation annotation =
|
||||
JavaAnnotationResolver.findOwnAnnotation(psiParameter, JvmStdlibNames.JET_VALUE_PARAMETER.getFqName().asString());
|
||||
return annotation != null ? new JetValueParameterAnnotation(annotation) : NULL_ANNOTATION;
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -26,6 +26,7 @@ import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver;
|
||||
|
||||
public class KotlinSignatureAnnotation extends PsiAnnotationWrapper {
|
||||
private static final KotlinSignatureAnnotation NULL_ANNOTATION = new KotlinSignatureAnnotation(null);
|
||||
|
||||
static {
|
||||
NULL_ANNOTATION.checkInitialized();
|
||||
}
|
||||
@@ -50,7 +51,8 @@ public class KotlinSignatureAnnotation extends PsiAnnotationWrapper {
|
||||
@NotNull
|
||||
public static KotlinSignatureAnnotation get(PsiModifierListOwner psiModifierListOwner) {
|
||||
PsiAnnotation annotation =
|
||||
JavaAnnotationResolver.findAnnotationWithExternal(psiModifierListOwner, JvmStdlibNames.KOTLIN_SIGNATURE.getFqName().asString());
|
||||
JavaAnnotationResolver
|
||||
.findAnnotationWithExternal(psiModifierListOwner, JvmStdlibNames.KOTLIN_SIGNATURE.getFqName().asString());
|
||||
return annotation != null ? new KotlinSignatureAnnotation(annotation) : NULL_ANNOTATION;
|
||||
}
|
||||
}
|
||||
|
||||
-8
@@ -32,14 +32,6 @@ public class PsiAnnotationUtils {
|
||||
return getAttribute(annotation, field, defaultValue);
|
||||
}
|
||||
|
||||
public static boolean getBooleanAttribute(@Nullable PsiAnnotation annotation, @NotNull String field, boolean defaultValue) {
|
||||
return getAttribute(annotation, field, defaultValue);
|
||||
}
|
||||
|
||||
public static int getIntAttribute(@Nullable PsiAnnotation annotation, @NotNull String field, int defaultValue) {
|
||||
return getAttribute(annotation, field, defaultValue);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static <T> T getAttribute(@Nullable PsiAnnotation annotation, @NotNull String field, @NotNull T defaultValue) {
|
||||
if (annotation == null) {
|
||||
|
||||
-31
@@ -1,31 +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.kt;
|
||||
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
|
||||
public abstract class PsiAnnotationWithAbiVersion extends PsiAnnotationWithFlags {
|
||||
protected PsiAnnotationWithAbiVersion(@Nullable PsiAnnotation psiAnnotation) {
|
||||
super(psiAnnotation);
|
||||
}
|
||||
|
||||
public int getAbiVersion() {
|
||||
return getIntAttribute(JvmStdlibNames.ABI_VERSION_NAME, -1);
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +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.kt;
|
||||
|
||||
import com.intellij.psi.PsiAnnotation;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
|
||||
public abstract class PsiAnnotationWithFlags extends PsiAnnotationWrapper {
|
||||
private int flags;
|
||||
|
||||
protected PsiAnnotationWithFlags(@Nullable PsiAnnotation psiAnnotation) {
|
||||
super(psiAnnotation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
flags = getIntAttribute(JvmStdlibNames.JET_FLAGS_FIELD, JvmStdlibNames.FLAGS_DEFAULT_VALUE);
|
||||
}
|
||||
|
||||
public final int flags() {
|
||||
checkInitialized();
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
-12
@@ -31,10 +31,6 @@ public abstract class PsiAnnotationWrapper {
|
||||
this.psiAnnotation = psiAnnotation;
|
||||
}
|
||||
|
||||
public boolean isDefined() {
|
||||
return psiAnnotation != null;
|
||||
}
|
||||
|
||||
protected abstract void initialize();
|
||||
|
||||
protected void checkInitialized () {
|
||||
@@ -48,12 +44,4 @@ public abstract class PsiAnnotationWrapper {
|
||||
protected String getStringAttribute(String name, String defaultValue) {
|
||||
return PsiAnnotationUtils.getStringAttribute(psiAnnotation, name, defaultValue);
|
||||
}
|
||||
|
||||
protected boolean getBooleanAttribute(String name, boolean defaultValue) {
|
||||
return PsiAnnotationUtils.getBooleanAttribute(psiAnnotation, name, defaultValue);
|
||||
}
|
||||
|
||||
protected int getIntAttribute(String name, int defaultValue) {
|
||||
return PsiAnnotationUtils.getIntAttribute(psiAnnotation, name, defaultValue);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user