diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationArgumentImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationArgumentImpl.java deleted file mode 100644 index 77e802e9c4f..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationArgumentImpl.java +++ /dev/null @@ -1,63 +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.impl; - -import com.intellij.psi.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.lang.resolve.java.structure.JavaAnnotationArgument; -import org.jetbrains.jet.lang.resolve.name.Name; - -public abstract class JavaAnnotationArgumentImpl extends JavaElementImpl - implements JavaAnnotationArgument { - private final Name name; - - protected JavaAnnotationArgumentImpl(@NotNull Psi psiAnnotationMemberValue, @Nullable Name name) { - super(psiAnnotationMemberValue); - this.name = name; - } - - @NotNull - /* package */ static JavaAnnotationArgument create(@NotNull PsiAnnotationMemberValue argument, @Nullable Name name) { - Object value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument); - if (value != null || argument instanceof PsiLiteralExpression) { - return new JavaLiteralAnnotationArgumentImpl(name, value); - } - - if (argument instanceof PsiReferenceExpression) { - return new JavaEnumValueAnnotationArgumentImpl((PsiReferenceExpression) argument, name); - } - else if (argument instanceof PsiArrayInitializerMemberValue) { - return new JavaArrayAnnotationArgumentImpl((PsiArrayInitializerMemberValue) argument, name); - } - else if (argument instanceof PsiAnnotation) { - return new JavaAnnotationAsAnnotationArgumentImpl((PsiAnnotation) argument, name); - } - else if (argument instanceof PsiClassObjectAccessExpression) { - return new JavaClassObjectAnnotationArgumentImpl((PsiClassObjectAccessExpression) argument, name); - } - else { - throw new UnsupportedOperationException("Unsupported annotation argument type: " + argument); - } - } - - @Override - @Nullable - public Name getName() { - return name; - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationAsAnnotationArgumentImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationAsAnnotationArgumentImpl.java deleted file mode 100644 index 0f82cdebab7..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationAsAnnotationArgumentImpl.java +++ /dev/null @@ -1,37 +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.impl; - -import com.intellij.psi.PsiAnnotation; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.lang.resolve.java.structure.JavaAnnotation; -import org.jetbrains.jet.lang.resolve.java.structure.JavaAnnotationAsAnnotationArgument; -import org.jetbrains.jet.lang.resolve.name.Name; - -public class JavaAnnotationAsAnnotationArgumentImpl extends JavaAnnotationArgumentImpl - implements JavaAnnotationAsAnnotationArgument { - protected JavaAnnotationAsAnnotationArgumentImpl(@NotNull PsiAnnotation psiAnnotation, @Nullable Name name) { - super(psiAnnotation, name); - } - - @Override - @NotNull - public JavaAnnotation getAnnotation() { - return new JavaAnnotationImpl(getPsi()); - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationImpl.java index 015ef71f027..22f5ab1dd12 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationImpl.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaAnnotationImpl.java @@ -38,7 +38,7 @@ public class JavaAnnotationImpl extends JavaElementImpl implement @Nullable public JavaAnnotationArgument findArgument(@NotNull Name name) { PsiAnnotationMemberValue attribute = getPsi().findAttributeValue(name.asString()); - return attribute == null ? null : JavaAnnotationArgumentImpl.create(attribute, name); + return attribute == null ? null : JavaAnnotationArgumentImpl.OBJECT$.create(attribute, name); } @Override diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaArrayAnnotationArgumentImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaArrayAnnotationArgumentImpl.java deleted file mode 100644 index 9f51839dfdf..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaArrayAnnotationArgumentImpl.java +++ /dev/null @@ -1,41 +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.impl; - -import com.intellij.psi.PsiArrayInitializerMemberValue; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.lang.resolve.java.structure.JavaAnnotationArgument; -import org.jetbrains.jet.lang.resolve.java.structure.JavaArrayAnnotationArgument; -import org.jetbrains.jet.lang.resolve.name.Name; - -import java.util.List; - -import static org.jetbrains.jet.lang.resolve.java.structure.impl.JavaElementCollectionFromPsiArrayUtil.namelessAnnotationArguments; - -public class JavaArrayAnnotationArgumentImpl extends JavaAnnotationArgumentImpl - implements JavaArrayAnnotationArgument { - protected JavaArrayAnnotationArgumentImpl(@NotNull PsiArrayInitializerMemberValue psiArrayInitializerMemberValue, @Nullable Name name) { - super(psiArrayInitializerMemberValue, name); - } - - @Override - @NotNull - public List getElements() { - return namelessAnnotationArguments(getPsi().getInitializers()); - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaClassObjectAnnotationArgumentImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaClassObjectAnnotationArgumentImpl.java deleted file mode 100644 index cdee33a431a..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaClassObjectAnnotationArgumentImpl.java +++ /dev/null @@ -1,37 +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.impl; - -import com.intellij.psi.PsiClassObjectAccessExpression; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.lang.resolve.java.structure.JavaClassObjectAnnotationArgument; -import org.jetbrains.jet.lang.resolve.java.structure.JavaType; -import org.jetbrains.jet.lang.resolve.name.Name; - -public class JavaClassObjectAnnotationArgumentImpl extends JavaAnnotationArgumentImpl - implements JavaClassObjectAnnotationArgument { - public JavaClassObjectAnnotationArgumentImpl(@NotNull PsiClassObjectAccessExpression expression, @Nullable Name name) { - super(expression, name); - } - - @NotNull - @Override - public JavaType getReferencedType() { - return JavaTypeImpl.create(getPsi().getOperand().getType()); - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java index cb3861eb992..ba1b80d81fa 100644 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaElementCollectionFromPsiArrayUtil.java @@ -111,15 +111,6 @@ public class JavaElementCollectionFromPsiArrayUtil { } }; - private static final Factory NAMELESS_ANNOTATION_ARGUMENTS = - new Factory() { - @NotNull - @Override - public JavaAnnotationArgument create(@NotNull PsiAnnotationMemberValue psiAnnotationMemberValue) { - return JavaAnnotationArgumentImpl.create(psiAnnotationMemberValue, null); - } - }; - private static final Factory NAMED_ANNOTATION_ARGUMENTS = new Factory() { @NotNull @@ -128,7 +119,7 @@ public class JavaElementCollectionFromPsiArrayUtil { String name = psiNameValuePair.getName(); PsiAnnotationMemberValue value = psiNameValuePair.getValue(); assert value != null : "Annotation argument value cannot be null: " + name; - return JavaAnnotationArgumentImpl.create(value, name == null ? null : Name.identifier(name)); + return JavaAnnotationArgumentImpl.OBJECT$.create(value, name == null ? null : Name.identifier(name)); } }; } @@ -204,11 +195,6 @@ public class JavaElementCollectionFromPsiArrayUtil { return convert(annotations, Factories.ANNOTATIONS); } - @NotNull - public static List namelessAnnotationArguments(@NotNull PsiAnnotationMemberValue[] memberValues) { - return convert(memberValues, Factories.NAMELESS_ANNOTATION_ARGUMENTS); - } - @NotNull public static Collection namedAnnotationArguments(@NotNull PsiNameValuePair[] nameValuePairs) { return convert(nameValuePairs, Factories.NAMED_ANNOTATION_ARGUMENTS); diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaEnumValueAnnotationArgumentImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaEnumValueAnnotationArgumentImpl.java deleted file mode 100644 index 05ab5cdce85..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaEnumValueAnnotationArgumentImpl.java +++ /dev/null @@ -1,45 +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.impl; - -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiEnumConstant; -import com.intellij.psi.PsiField; -import com.intellij.psi.PsiReferenceExpression; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.lang.resolve.java.structure.JavaEnumValueAnnotationArgument; -import org.jetbrains.jet.lang.resolve.java.structure.JavaField; -import org.jetbrains.jet.lang.resolve.name.Name; - -public class JavaEnumValueAnnotationArgumentImpl extends JavaAnnotationArgumentImpl - implements JavaEnumValueAnnotationArgument { - protected JavaEnumValueAnnotationArgumentImpl(@NotNull PsiReferenceExpression psiReferenceExpression, @Nullable Name name) { - super(psiReferenceExpression, name); - } - - @Override - @Nullable - public JavaField resolve() { - PsiElement element = getPsi().resolve(); - if (element == null) return null; - if (!(element instanceof PsiEnumConstant)) { - throw new IllegalStateException("Reference argument should be an enum value, but was " + element + ": " + element.getText()); - } - return new JavaFieldImpl((PsiField) element); - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaLiteralAnnotationArgumentImpl.java b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaLiteralAnnotationArgumentImpl.java deleted file mode 100644 index 0453afe1b4f..00000000000 --- a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/JavaLiteralAnnotationArgumentImpl.java +++ /dev/null @@ -1,43 +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.impl; - -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.lang.resolve.java.structure.JavaLiteralAnnotationArgument; -import org.jetbrains.jet.lang.resolve.name.Name; - -public class JavaLiteralAnnotationArgumentImpl implements JavaLiteralAnnotationArgument { - private final Name name; - private final Object value; - - public JavaLiteralAnnotationArgumentImpl(@Nullable Name name, @Nullable Object value) { - this.name = name; - this.value = value; - } - - @Override - @Nullable - public Name getName() { - return name; - } - - @Override - @Nullable - public Object getValue() { - return value; - } -} diff --git a/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt new file mode 100644 index 00000000000..d3ba290aaf9 --- /dev/null +++ b/compiler/frontend.java/src/org/jetbrains/jet/lang/resolve/java/structure/impl/annotationArgumentsImpl.kt @@ -0,0 +1,83 @@ +/* + * Copyright 2010-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. + */ + +package org.jetbrains.jet.lang.resolve.java.structure.impl + +import com.intellij.psi.* +import org.jetbrains.jet.lang.resolve.java.structure.* +import org.jetbrains.jet.lang.resolve.name.Name + +abstract class JavaAnnotationArgumentImpl( + psiAnnotationMemberValue: Psi, + override val name: Name? +) : JavaElementImpl(psiAnnotationMemberValue), JavaAnnotationArgument { + class object { + fun create(argument: PsiAnnotationMemberValue, name: Name?): JavaAnnotationArgument { + val value = JavaPsiFacade.getInstance(argument.getProject()).getConstantEvaluationHelper().computeConstantExpression(argument) + if (value != null || argument is PsiLiteralExpression) { + return JavaLiteralAnnotationArgumentImpl(name, value) + } + + return when (argument) { + is PsiReferenceExpression -> JavaEnumValueAnnotationArgumentImpl(argument as PsiReferenceExpression, name) + is PsiArrayInitializerMemberValue -> JavaArrayAnnotationArgumentImpl(argument as PsiArrayInitializerMemberValue, name) + is PsiAnnotation -> JavaAnnotationAsAnnotationArgumentImpl(argument as PsiAnnotation, name) + is PsiClassObjectAccessExpression -> JavaClassObjectAnnotationArgumentImpl(argument as PsiClassObjectAccessExpression, name) + else -> throw UnsupportedOperationException("Unsupported annotation argument type: " + argument) + } + } + } +} + +class JavaLiteralAnnotationArgumentImpl( + override val name: Name?, + override val value: Any? +) : JavaLiteralAnnotationArgument + +class JavaArrayAnnotationArgumentImpl( + psiValue: PsiArrayInitializerMemberValue, + name: Name? +) : JavaAnnotationArgumentImpl(psiValue, name), JavaArrayAnnotationArgument { + override fun getElements() = getPsi().getInitializers().map { JavaAnnotationArgumentImpl.create(it, null) } +} + +class JavaEnumValueAnnotationArgumentImpl( + psiReference: PsiReferenceExpression, + name: Name? +) : JavaAnnotationArgumentImpl(psiReference, name), JavaEnumValueAnnotationArgument { + override fun resolve(): JavaField? { + val element = getPsi().resolve() + return when (element) { + null -> null + is PsiEnumConstant -> JavaFieldImpl(element) + else -> throw IllegalStateException("Reference argument should be an enum value, but was $element: ${element.getText()}") + } + } +} + +class JavaClassObjectAnnotationArgumentImpl( + psiExpression: PsiClassObjectAccessExpression, + name: Name? +) : JavaAnnotationArgumentImpl(psiExpression, name), JavaClassObjectAnnotationArgument { + override fun getReferencedType() = JavaTypeImpl.create(getPsi().getOperand().getType()) +} + +class JavaAnnotationAsAnnotationArgumentImpl( + psiAnnotation: PsiAnnotation, + name: Name? +) : JavaAnnotationArgumentImpl(psiAnnotation, name), JavaAnnotationAsAnnotationArgument { + override fun getAnnotation() = JavaAnnotationImpl(getPsi()) +} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt index e89adc7fdc4..1de15c7eb83 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/descriptors/LazyJavaAnnotationDescriptor.kt @@ -41,8 +41,8 @@ import org.jetbrains.jet.lang.types.TypeUtils import org.jetbrains.jet.lang.resolve.resolveTopLevelClass private object DEPRECATED_IN_JAVA : JavaLiteralAnnotationArgument { - override fun getName(): Name? = null - override fun getValue(): Any? = "Deprecated in Java" + override val name: Name? = null + override val value: Any? = "Deprecated in Java" } class LazyJavaAnnotationDescriptor( @@ -66,7 +66,7 @@ class LazyJavaAnnotationDescriptor( if (arguments.isEmpty() && _fqName()?.asString() == "java.lang.Deprecated") { arguments = listOf(DEPRECATED_IN_JAVA) } - arguments.valuesToMap { a -> a.getName() } + arguments.valuesToMap { it.name } } private val _valueArguments = c.storageManager.createMemoizedFunctionWithNullableValues> { @@ -99,9 +99,9 @@ class LazyJavaAnnotationDescriptor( private fun resolveAnnotationArgument(argument: JavaAnnotationArgument?): CompileTimeConstant<*>? { return when (argument) { - is JavaLiteralAnnotationArgument -> createCompileTimeConstant(argument.getValue(), true, false, false, null) + is JavaLiteralAnnotationArgument -> createCompileTimeConstant(argument.value, true, false, false, null) is JavaEnumValueAnnotationArgument -> resolveFromEnumValue(argument.resolve()) - is JavaArrayAnnotationArgument -> resolveFromArray(argument.getName() ?: DEFAULT_ANNOTATION_MEMBER_NAME, argument.getElements()) + is JavaArrayAnnotationArgument -> resolveFromArray(argument.name ?: DEFAULT_ANNOTATION_MEMBER_NAME, argument.getElements()) is JavaAnnotationAsAnnotationArgument -> resolveFromAnnotation(argument.getAnnotation()) is JavaClassObjectAnnotationArgument -> resolveFromJavaClassObjectType(argument.getReferencedType()) else -> null diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaAnnotationArgument.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaAnnotationArgument.java deleted file mode 100644 index c339bc613a5..00000000000 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaAnnotationArgument.java +++ /dev/null @@ -1,25 +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.Nullable; -import org.jetbrains.jet.lang.resolve.name.Name; - -public interface JavaAnnotationArgument extends JavaElement { - @Nullable - Name getName(); -} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaAnnotationAsAnnotationArgument.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaAnnotationAsAnnotationArgument.java deleted file mode 100644 index 41d3a3c1500..00000000000 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaAnnotationAsAnnotationArgument.java +++ /dev/null @@ -1,24 +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; - -public interface JavaAnnotationAsAnnotationArgument extends JavaAnnotationArgument { - @NotNull - JavaAnnotation getAnnotation(); -} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaArrayAnnotationArgument.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaArrayAnnotationArgument.java deleted file mode 100644 index 793a99e62cb..00000000000 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaArrayAnnotationArgument.java +++ /dev/null @@ -1,26 +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.List; - -public interface JavaArrayAnnotationArgument extends JavaAnnotationArgument { - @NotNull - List getElements(); -} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaClassObjectAnnotationArgument.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaClassObjectAnnotationArgument.java deleted file mode 100644 index 691f84e5537..00000000000 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaClassObjectAnnotationArgument.java +++ /dev/null @@ -1,24 +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; - -public interface JavaClassObjectAnnotationArgument extends JavaAnnotationArgument { - @NotNull - JavaType getReferencedType(); -} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaEnumValueAnnotationArgument.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaEnumValueAnnotationArgument.java deleted file mode 100644 index ff8742f0859..00000000000 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaEnumValueAnnotationArgument.java +++ /dev/null @@ -1,24 +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.Nullable; - -public interface JavaEnumValueAnnotationArgument extends JavaAnnotationArgument { - @Nullable - JavaField resolve(); -} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaLiteralAnnotationArgument.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaLiteralAnnotationArgument.java deleted file mode 100644 index 6ab89787318..00000000000 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/JavaLiteralAnnotationArgument.java +++ /dev/null @@ -1,24 +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.Nullable; - -public interface JavaLiteralAnnotationArgument extends JavaAnnotationArgument { - @Nullable - Object getValue(); -} diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt new file mode 100644 index 00000000000..197de0b1680 --- /dev/null +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/structure/annotationArguments.kt @@ -0,0 +1,43 @@ +/* + * Copyright 2010-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. + */ + +package org.jetbrains.jet.lang.resolve.java.structure + +import org.jetbrains.jet.lang.resolve.name.Name + +public trait JavaAnnotationArgument : JavaElement { + public val name: Name? +} + +public trait JavaLiteralAnnotationArgument : JavaAnnotationArgument { + public val value: Any? +} + +public trait JavaArrayAnnotationArgument : JavaAnnotationArgument { + public fun getElements(): List +} + +public trait JavaEnumValueAnnotationArgument : JavaAnnotationArgument { + public fun resolve(): JavaField? +} + +public trait JavaClassObjectAnnotationArgument : JavaAnnotationArgument { + public fun getReferencedType(): JavaType +} + +public trait JavaAnnotationAsAnnotationArgument : JavaAnnotationArgument { + public fun getAnnotation(): JavaAnnotation +}