diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetValueParameterAnnotation.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetValueParameterAnnotation.java deleted file mode 100644 index f64e5e3e1ee..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/JetValueParameterAnnotation.java +++ /dev/null @@ -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; - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java index e27d70f5b31..319144d5198 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/KotlinSignatureAnnotation.java @@ -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; } } diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java index 03961242b7b..13df8bc2416 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationUtils.java @@ -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 getAttribute(@Nullable PsiAnnotation annotation, @NotNull String field, @NotNull T defaultValue) { if (annotation == null) { diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWithAbiVersion.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWithAbiVersion.java deleted file mode 100644 index e0d41130963..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWithAbiVersion.java +++ /dev/null @@ -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); - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWithFlags.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWithFlags.java deleted file mode 100644 index a7e33ec4bc0..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWithFlags.java +++ /dev/null @@ -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; - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWrapper.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWrapper.java index 97783fdce93..a2468d62cc5 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWrapper.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/kt/PsiAnnotationWrapper.java @@ -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); - } }