Convert Java model to Kotlin, put in several files
Also move JavaPropertyInitializerEvaluator to ../components/
This commit is contained in:
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 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.
|
||||
@@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.load.java.structure
|
||||
package org.jetbrains.kotlin.load.java.components
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaField
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
|
||||
interface JavaPropertyInitializerEvaluator {
|
||||
@@ -23,13 +23,9 @@ import org.jetbrains.kotlin.descriptors.PackagePartProvider
|
||||
import org.jetbrains.kotlin.descriptors.SupertypeLoopChecker
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.load.java.JavaClassFinder
|
||||
import org.jetbrains.kotlin.load.java.components.ExternalAnnotationResolver
|
||||
import org.jetbrains.kotlin.load.java.components.SignaturePropagator
|
||||
import org.jetbrains.kotlin.load.java.components.JavaResolverCache
|
||||
import org.jetbrains.kotlin.load.java.components.SamConversionResolver
|
||||
import org.jetbrains.kotlin.load.java.components.*
|
||||
import org.jetbrains.kotlin.load.java.lazy.types.LazyJavaTypeResolver
|
||||
import org.jetbrains.kotlin.load.java.sources.JavaSourceElementFactory
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaPropertyInitializerEvaluator
|
||||
import org.jetbrains.kotlin.load.java.structure.JavaTypeParameterListOwner
|
||||
import org.jetbrains.kotlin.load.kotlin.DeserializedDescriptorResolver
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinClassFinder
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
) : AnnotationDescriptor {
|
||||
|
||||
private val fqName = c.storageManager.createNullableLazyValue {
|
||||
javaAnnotation.getClassId()?.asSingleFqName()
|
||||
javaAnnotation.classId?.asSingleFqName()
|
||||
}
|
||||
|
||||
private val type = c.storageManager.createLazyValue {
|
||||
|
||||
+3
-3
@@ -75,7 +75,7 @@ class LazyJavaClassMemberScope(
|
||||
}
|
||||
|
||||
internal val constructors = c.storageManager.createLazyValue {
|
||||
val constructors = jClass.getConstructors()
|
||||
val constructors = jClass.constructors
|
||||
val result = ArrayList<JavaConstructorDescriptor>(constructors.size)
|
||||
for (constructor in constructors) {
|
||||
val descriptor = resolveConstructor(constructor)
|
||||
@@ -599,7 +599,7 @@ class LazyJavaClassMemberScope(
|
||||
method.name,
|
||||
// Parameters of annotation constructors in Java are never nullable
|
||||
TypeUtils.makeNotNullable(returnType),
|
||||
method.hasAnnotationParameterDefaultValue(),
|
||||
method.hasAnnotationParameterDefaultValue,
|
||||
/* isCrossinline = */ false,
|
||||
/* isNoinline = */ false,
|
||||
// Nulls are not allowed in annotation arguments in Java
|
||||
@@ -649,7 +649,7 @@ class LazyJavaClassMemberScope(
|
||||
= nestedClassIndex().keys + enumEntryIndex().keys
|
||||
|
||||
override fun getPropertyNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<Name> {
|
||||
if (jClass.isAnnotationType()) return memberIndex().getMethodNames(nameFilter)
|
||||
if (jClass.isAnnotationType) return memberIndex().getMethodNames(nameFilter)
|
||||
|
||||
return memberIndex().getAllFieldNames() +
|
||||
ownerDescriptor.getTypeConstructor().getSupertypes().flatMapTo(LinkedHashSet<Name>()) { supertype ->
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ import org.jetbrains.kotlin.storage.getValue
|
||||
class LazyJavaPackageFragment(
|
||||
private val c: LazyJavaResolverContext,
|
||||
private val jPackage: JavaPackage
|
||||
) : PackageFragmentDescriptorImpl(c.module, jPackage.getFqName()) {
|
||||
) : PackageFragmentDescriptorImpl(c.module, jPackage.fqName) {
|
||||
private val scope by c.storageManager.createLazyValue {
|
||||
LazyJavaPackageScope(c, jPackage, this)
|
||||
}
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ class LazyJavaPackageScope(
|
||||
|
||||
private val subPackages = c.storageManager.createRecursionTolerantLazyValue(
|
||||
{
|
||||
jPackage.getSubPackages().map { sp -> sp.getFqName() }
|
||||
jPackage.subPackages.map { sp -> sp.fqName }
|
||||
},
|
||||
// This breaks infinite recursion between loading Java descriptors and building light classes
|
||||
onRecursiveCall = listOf()
|
||||
|
||||
+1
-1
@@ -231,7 +231,7 @@ abstract class LazyJavaScope(protected val c: LazyJavaResolverContext) : MemberS
|
||||
val properties = ArrayList<PropertyDescriptor>()
|
||||
|
||||
val field = memberIndex().findFieldByName(name)
|
||||
if (field != null && !field.isEnumEntry()) {
|
||||
if (field != null && !field.isEnumEntry) {
|
||||
properties.add(resolveProperty(field))
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -62,10 +62,10 @@ open class ClassMemberIndex(val jClass: JavaClass, val memberFilter: (JavaMember
|
||||
|
||||
override fun findMethodsByName(name: Name): Collection<JavaMethod> = methods[name] ?: listOf()
|
||||
override fun getMethodNames(nameFilter: (Name) -> Boolean): Collection<Name> =
|
||||
jClass.getAllMemberNames(methodFilter) { getMethods() }
|
||||
jClass.getAllMemberNames(methodFilter) { methods }
|
||||
|
||||
override fun findFieldByName(name: Name): JavaField? = fields[name]
|
||||
override fun getAllFieldNames(): Collection<Name> = jClass.getAllMemberNames(memberFilter) { getFields() }
|
||||
override fun getAllFieldNames(): Collection<Name> = jClass.getAllMemberNames(memberFilter) { fields }
|
||||
}
|
||||
|
||||
private fun JavaClass.getNonDeclaredMethodNames(): List<Name> {
|
||||
|
||||
+3
-3
@@ -100,7 +100,7 @@ class LazyJavaTypeResolver(
|
||||
) : AbstractLazyType(c.storageManager) {
|
||||
private val annotations = CompositeAnnotations(listOf(LazyJavaAnnotations(c, javaType), attr.typeAnnotations))
|
||||
|
||||
private val classifier = c.storageManager.createNullableLazyValue { javaType.getClassifier() }
|
||||
private val classifier = c.storageManager.createNullableLazyValue { javaType.classifier }
|
||||
|
||||
override fun computeTypeConstructor(): TypeConstructor {
|
||||
val classifier = classifier()
|
||||
@@ -109,7 +109,7 @@ class LazyJavaTypeResolver(
|
||||
}
|
||||
return when (classifier) {
|
||||
is JavaClass -> {
|
||||
val fqName = classifier.getFqName().sure { "Class type should have a FQ name: $classifier" }
|
||||
val fqName = classifier.fqName.sure { "Class type should have a FQ name: $classifier" }
|
||||
|
||||
val classData = mapKotlinClass(fqName) ?: c.components.moduleClassResolver.resolveClass(classifier)
|
||||
|
||||
@@ -222,7 +222,7 @@ class LazyJavaTypeResolver(
|
||||
else {
|
||||
createProjection(
|
||||
type = transformJavaType(bound, UPPER_BOUND.toAttributes()),
|
||||
projectionKind = if (javaType.isExtends()) OUT_VARIANCE else IN_VARIANCE,
|
||||
projectionKind = if (javaType.isExtends) OUT_VARIANCE else IN_VARIANCE,
|
||||
typeParameterDescriptor = typeParameter
|
||||
)
|
||||
}
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface JavaAnnotation extends JavaElement {
|
||||
@NotNull
|
||||
Collection<JavaAnnotationArgument> getArguments();
|
||||
|
||||
@Nullable
|
||||
ClassId getClassId();
|
||||
|
||||
@Nullable
|
||||
JavaClass resolve();
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface JavaAnnotationOwner extends JavaElement {
|
||||
@NotNull
|
||||
Collection<JavaAnnotation> getAnnotations();
|
||||
|
||||
@Nullable
|
||||
JavaAnnotation findAnnotation(@NotNull FqName fqName);
|
||||
|
||||
boolean isDeprecatedInJavaDoc();
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface JavaArrayType extends JavaType {
|
||||
@NotNull
|
||||
JavaType getComponentType();
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface JavaClass extends JavaClassifier, JavaTypeParameterListOwner, JavaModifierListOwner {
|
||||
@NotNull
|
||||
Collection<JavaClass> getInnerClasses();
|
||||
|
||||
@Nullable
|
||||
FqName getFqName();
|
||||
|
||||
boolean isInterface();
|
||||
|
||||
boolean isAnnotationType();
|
||||
|
||||
boolean isEnum();
|
||||
|
||||
boolean isKotlinLightClass();
|
||||
|
||||
@Nullable
|
||||
JavaClass getOuterClass();
|
||||
|
||||
@NotNull
|
||||
Collection<JavaClassifierType> getSupertypes();
|
||||
|
||||
@NotNull
|
||||
Collection<JavaMethod> getMethods();
|
||||
|
||||
@NotNull
|
||||
Collection<JavaField> getFields();
|
||||
|
||||
@NotNull
|
||||
Collection<JavaConstructor> getConstructors();
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
public interface JavaClassifier extends JavaNamedElement, JavaAnnotationOwner {
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface JavaClassifierType extends JavaType, JavaAnnotationOwner {
|
||||
@Nullable
|
||||
JavaClassifier getClassifier();
|
||||
|
||||
@NotNull
|
||||
String getPresentableText();
|
||||
|
||||
boolean isRaw();
|
||||
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
List<JavaType> getTypeArguments();
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface JavaConstructor extends JavaMember, JavaTypeParameterListOwner {
|
||||
@NotNull
|
||||
List<JavaValueParameter> getValueParameters();
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
public interface JavaElement {
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface JavaField extends JavaMember {
|
||||
boolean isEnumEntry();
|
||||
|
||||
@NotNull
|
||||
JavaType getType();
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface JavaMember extends JavaModifierListOwner, JavaAnnotationOwner, JavaNamedElement {
|
||||
@NotNull
|
||||
JavaClass getContainingClass();
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface JavaMethod extends JavaMember, JavaTypeParameterListOwner {
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
List<JavaValueParameter> getValueParameters();
|
||||
|
||||
boolean hasAnnotationParameterDefaultValue();
|
||||
|
||||
@NotNull
|
||||
JavaType getReturnType();
|
||||
}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.Visibility;
|
||||
|
||||
public interface JavaModifierListOwner extends JavaElement {
|
||||
boolean isAbstract();
|
||||
|
||||
boolean isStatic();
|
||||
|
||||
boolean isFinal();
|
||||
|
||||
@NotNull
|
||||
Visibility getVisibility();
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
|
||||
public interface JavaNamedElement extends JavaElement {
|
||||
@NotNull
|
||||
Name getName();
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType;
|
||||
|
||||
public interface JavaPrimitiveType extends JavaType {
|
||||
/** {@code null} means the {@code void} type. */
|
||||
@Nullable
|
||||
PrimitiveType getType();
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
public interface JavaType {
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface JavaTypeParameter extends JavaClassifier {
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
Collection<JavaClassifierType> getUpperBounds();
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface JavaTypeParameterListOwner extends JavaElement {
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
List<JavaTypeParameter> getTypeParameters();
|
||||
}
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
|
||||
public interface JavaValueParameter extends JavaAnnotationOwner {
|
||||
@Nullable
|
||||
Name getName();
|
||||
|
||||
@NotNull
|
||||
JavaType getType();
|
||||
|
||||
boolean isVararg();
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface JavaWildcardType extends JavaType {
|
||||
@Nullable
|
||||
JavaType getBound();
|
||||
|
||||
boolean isExtends();
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.kotlin.load.java.structure
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
interface JavaElement
|
||||
|
||||
interface JavaNamedElement : JavaElement {
|
||||
val name: Name
|
||||
}
|
||||
|
||||
interface JavaAnnotationOwner : JavaElement {
|
||||
val annotations: Collection<JavaAnnotation>
|
||||
fun findAnnotation(fqName: FqName): JavaAnnotation?
|
||||
|
||||
val isDeprecatedInJavaDoc: Boolean
|
||||
}
|
||||
|
||||
interface JavaModifierListOwner : JavaElement {
|
||||
val isAbstract: Boolean
|
||||
val isStatic: Boolean
|
||||
val isFinal: Boolean
|
||||
val visibility: Visibility
|
||||
}
|
||||
|
||||
interface JavaTypeParameterListOwner : JavaElement {
|
||||
val typeParameters: List<JavaTypeParameter>
|
||||
}
|
||||
|
||||
interface JavaAnnotation : JavaElement {
|
||||
val arguments: Collection<JavaAnnotationArgument>
|
||||
val classId: ClassId?
|
||||
|
||||
fun resolve(): JavaClass?
|
||||
}
|
||||
|
||||
interface JavaPackage : JavaElement {
|
||||
val fqName: FqName
|
||||
val subPackages: Collection<JavaPackage>
|
||||
|
||||
fun getClasses(nameFilter: (Name) -> Boolean): Collection<JavaClass>
|
||||
}
|
||||
|
||||
interface JavaClassifier : JavaNamedElement, JavaAnnotationOwner
|
||||
|
||||
interface JavaClass : JavaClassifier, JavaTypeParameterListOwner, JavaModifierListOwner {
|
||||
val fqName: FqName?
|
||||
|
||||
val supertypes: Collection<JavaClassifierType>
|
||||
val innerClasses: Collection<JavaClass>
|
||||
val outerClass: JavaClass?
|
||||
|
||||
val isInterface: Boolean
|
||||
val isAnnotationType: Boolean
|
||||
val isEnum: Boolean
|
||||
val isKotlinLightClass: Boolean
|
||||
|
||||
val methods: Collection<JavaMethod>
|
||||
val fields: Collection<JavaField>
|
||||
val constructors: Collection<JavaConstructor>
|
||||
}
|
||||
|
||||
interface JavaMember : JavaModifierListOwner, JavaAnnotationOwner, JavaNamedElement {
|
||||
val containingClass: JavaClass
|
||||
}
|
||||
|
||||
interface JavaMethod : JavaMember, JavaTypeParameterListOwner {
|
||||
val valueParameters: List<JavaValueParameter>
|
||||
val returnType: JavaType
|
||||
|
||||
val hasAnnotationParameterDefaultValue: Boolean
|
||||
}
|
||||
|
||||
interface JavaField : JavaMember {
|
||||
val isEnumEntry: Boolean
|
||||
val type: JavaType
|
||||
}
|
||||
|
||||
interface JavaConstructor : JavaMember, JavaTypeParameterListOwner {
|
||||
val valueParameters: List<JavaValueParameter>
|
||||
}
|
||||
|
||||
interface JavaValueParameter : JavaAnnotationOwner {
|
||||
val name: Name?
|
||||
val type: JavaType
|
||||
val isVararg: Boolean
|
||||
}
|
||||
|
||||
interface JavaTypeParameter : JavaClassifier {
|
||||
val upperBounds: Collection<JavaClassifierType>
|
||||
}
|
||||
+24
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
* Copyright 2010-2016 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.
|
||||
@@ -16,13 +16,29 @@
|
||||
|
||||
package org.jetbrains.kotlin.load.java.structure
|
||||
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.builtins.PrimitiveType
|
||||
|
||||
interface JavaPackage : JavaElement {
|
||||
fun getClasses(nameFilter: (Name) -> Boolean): Collection<JavaClass>
|
||||
interface JavaType
|
||||
|
||||
fun getSubPackages(): Collection<JavaPackage>
|
||||
|
||||
fun getFqName(): FqName
|
||||
interface JavaArrayType : JavaType {
|
||||
val componentType: JavaType
|
||||
}
|
||||
|
||||
interface JavaClassifierType : JavaType, JavaAnnotationOwner {
|
||||
val classifier: JavaClassifier?
|
||||
val typeArguments: List<JavaType>
|
||||
|
||||
val isRaw: Boolean
|
||||
|
||||
val presentableText: String
|
||||
}
|
||||
|
||||
interface JavaPrimitiveType : JavaType {
|
||||
/** `null` means the `void` type. */
|
||||
val type: PrimitiveType?
|
||||
}
|
||||
|
||||
interface JavaWildcardType : JavaType {
|
||||
val bound: JavaType?
|
||||
val isExtends: Boolean
|
||||
}
|
||||
+1
-1
@@ -34,7 +34,7 @@ class KotlinJvmBinaryPackageSourceElement(
|
||||
result
|
||||
}
|
||||
|
||||
override fun toString(): String = "Binary package ${jPackage.getFqName()}: ${implClassNameToBinaryClass.keys}"
|
||||
override fun toString(): String = "Binary package ${jPackage.fqName}: ${implClassNameToBinaryClass.keys}"
|
||||
override fun getContainingFile(): SourceFile = SourceFile.NO_SOURCE_FILE
|
||||
|
||||
fun getRepresentativeBinaryClass(): KotlinJvmBinaryClass {
|
||||
|
||||
Reference in New Issue
Block a user