Rewrite Java resolve to use static class scope instead of synthesized packages
#KT-4149 Fixed #KT-4839 Fixed
This commit is contained in:
@@ -43,7 +43,6 @@ import org.jetbrains.jet.lang.resolve.constants.StringValue;
|
|||||||
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
import org.jetbrains.jet.lang.resolve.java.AsmTypeConstants;
|
||||||
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
||||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFragmentDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterKind;
|
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterKind;
|
||||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterSignature;
|
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodParameterSignature;
|
||||||
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodSignature;
|
import org.jetbrains.jet.lang.resolve.java.jvmSignature.JvmMethodSignature;
|
||||||
@@ -110,10 +109,7 @@ public class JetTypeMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DeclarationDescriptor container = descriptor.getContainingDeclaration();
|
DeclarationDescriptor container = descriptor.getContainingDeclaration();
|
||||||
if (container instanceof JavaClassStaticsPackageFragmentDescriptor) {
|
if (container instanceof PackageFragmentDescriptor) {
|
||||||
return mapClass(((JavaClassStaticsPackageFragmentDescriptor) container).getCorrespondingClass());
|
|
||||||
}
|
|
||||||
else if (container instanceof PackageFragmentDescriptor) {
|
|
||||||
return Type.getObjectType(internalNameForPackage(
|
return Type.getObjectType(internalNameForPackage(
|
||||||
(PackageFragmentDescriptor) container,
|
(PackageFragmentDescriptor) container,
|
||||||
(CallableMemberDescriptor) descriptor,
|
(CallableMemberDescriptor) descriptor,
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// KT-4149 static members of Java private nested class are accessible from Kotlin
|
||||||
|
|
||||||
|
// FILE: javaPackage/Foo.java
|
||||||
|
|
||||||
|
package javaPackage;
|
||||||
|
|
||||||
|
public class Foo {
|
||||||
|
private static class Bar {
|
||||||
|
public static void doSmth() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 1.kt
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
javaPackage.Foo.Bar.<!INVISIBLE_MEMBER!>doSmth<!>()
|
||||||
|
}
|
||||||
@@ -2,30 +2,29 @@ package test
|
|||||||
|
|
||||||
public open class InnerOfGeneric {
|
public open class InnerOfGeneric {
|
||||||
public constructor InnerOfGeneric()
|
public constructor InnerOfGeneric()
|
||||||
|
|
||||||
public abstract inner class A</*0*/ K> {
|
public abstract inner class A</*0*/ K> {
|
||||||
public constructor A</*0*/ K>()
|
public constructor A</*0*/ K>()
|
||||||
|
|
||||||
public abstract inner class Inner : test.InnerOfGeneric.S<K> {
|
public abstract inner class Inner : test.InnerOfGeneric.S<K> {
|
||||||
public constructor Inner()
|
public constructor Inner()
|
||||||
public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.MutableIterator<K>?
|
public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.MutableIterator<K>?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public open inner class B</*0*/ L> : test.InnerOfGeneric.A<L> {
|
public open inner class B</*0*/ L> : test.InnerOfGeneric.A<L> {
|
||||||
public constructor B</*0*/ L>()
|
public constructor B</*0*/ L>()
|
||||||
|
|
||||||
public open inner class SubInner : test.InnerOfGeneric.A.Inner {
|
public open inner class SubInner : test.InnerOfGeneric.A.Inner {
|
||||||
public constructor SubInner()
|
public constructor SubInner()
|
||||||
public open override /*1*/ fun iterator(): kotlin.MutableIterator<L>?
|
public open override /*1*/ fun iterator(): kotlin.MutableIterator<L>?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait S</*0*/ E> {
|
public trait S</*0*/ E> {
|
||||||
public abstract fun iterator(): kotlin.MutableIterator<E>?
|
public abstract fun iterator(): kotlin.MutableIterator<E>?
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.InnerOfGeneric {
|
public final /*synthesized*/ fun </*0*/ E> S(/*0*/ function: () -> kotlin.MutableIterator<E>?): test.InnerOfGeneric.S<E>
|
||||||
public /*synthesized*/ fun </*0*/ E> S(/*0*/ function: () -> kotlin.MutableIterator<E>?): test.InnerOfGeneric.S<E>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,26 +6,24 @@ public open class PrivateMembers {
|
|||||||
private open fun method(): kotlin.Unit
|
private open fun method(): kotlin.Unit
|
||||||
private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
private final /*synthesized*/ fun samAdapter(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
private open fun samAdapter(/*0*/ p0: test.PrivateMembers.SamInterface?): kotlin.Unit
|
private open fun samAdapter(/*0*/ p0: test.PrivateMembers.SamInterface?): kotlin.Unit
|
||||||
|
|
||||||
private open inner class Inner {
|
private open inner class Inner {
|
||||||
private constructor Inner()
|
private constructor Inner()
|
||||||
}
|
}
|
||||||
|
|
||||||
private open class Nested {
|
private open class Nested {
|
||||||
private constructor Nested()
|
private constructor Nested()
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
private open fun staticMethodInNested(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
private trait SamInterface {
|
private trait SamInterface {
|
||||||
public abstract fun foo(): kotlin.Unit
|
public abstract fun foo(): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.PrivateMembers {
|
private final var staticField: kotlin.Int
|
||||||
private var staticField: kotlin.Int
|
private final /*synthesized*/ fun SamInterface(/*0*/ function: () -> kotlin.Unit): test.PrivateMembers.SamInterface
|
||||||
private /*synthesized*/ fun SamInterface(/*0*/ function: () -> kotlin.Unit): test.PrivateMembers.SamInterface
|
|
||||||
private open fun staticMethod(): kotlin.Unit
|
private open fun staticMethod(): kotlin.Unit
|
||||||
|
|
||||||
package test.PrivateMembers.Nested {
|
|
||||||
private open fun staticMethodInNested(): kotlin.Unit
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait RawTypeWithUpperBound {
|
public trait RawTypeWithUpperBound {
|
||||||
|
|
||||||
public trait Bar {
|
public trait Bar {
|
||||||
public abstract fun f(/*0*/ p0: test.RawTypeWithUpperBound.Foo<out kotlin.CharSequence?>?): kotlin.Unit
|
public abstract fun f(/*0*/ p0: test.RawTypeWithUpperBound.Foo<out kotlin.CharSequence?>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Foo</*0*/ T : kotlin.CharSequence?> {
|
public trait Foo</*0*/ T : kotlin.CharSequence?> {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.RawTypeWithUpperBound {
|
public final /*synthesized*/ fun Bar(/*0*/ function: (test.RawTypeWithUpperBound.Foo<out kotlin.CharSequence?>?) -> kotlin.Unit): test.RawTypeWithUpperBound.Bar
|
||||||
public /*synthesized*/ fun Bar(/*0*/ function: (test.RawTypeWithUpperBound.Foo<out kotlin.CharSequence?>?) -> kotlin.Unit): test.RawTypeWithUpperBound.Bar
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait StringConstantInParam {
|
public trait StringConstantInParam {
|
||||||
|
|
||||||
public final annotation class Anno : kotlin.Annotation {
|
public final annotation class Anno : kotlin.Annotation {
|
||||||
public constructor Anno(/*0*/ value: kotlin.String)
|
public constructor Anno(/*0*/ value: kotlin.String)
|
||||||
public abstract fun value(): kotlin.String
|
public abstract fun value(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
test.StringConstantInParam.Anno(value = "hello": kotlin.String) public open class Class {
|
test.StringConstantInParam.Anno(value = "hello": kotlin.String) public open class Class {
|
||||||
public constructor Class()
|
public constructor Class()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.StringConstantInParam {
|
public final val HEL: kotlin.String = "hel"
|
||||||
public val HEL: kotlin.String = "hel"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,29 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait Nested {
|
public trait Nested {
|
||||||
|
|
||||||
public trait Deeper1 {
|
public trait Deeper1 {
|
||||||
|
|
||||||
public trait Runnable {
|
public trait Runnable {
|
||||||
public abstract fun run(): kotlin.Unit
|
public abstract fun run(): kotlin.Unit
|
||||||
public abstract fun run2(): kotlin.Unit
|
public abstract fun run2(): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Deeper2 {
|
public trait Deeper2 {
|
||||||
|
|
||||||
public trait Runnable {
|
public trait Runnable {
|
||||||
public abstract fun run(): kotlin.Unit
|
public abstract fun run(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public final /*synthesized*/ fun Runnable(/*0*/ function: () -> kotlin.Unit): test.Nested.Deeper2.Runnable
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Runnable {
|
public trait Runnable {
|
||||||
public abstract fun run(): kotlin.Unit
|
public abstract fun run(): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.Nested {
|
public final /*synthesized*/ fun Runnable(/*0*/ function: () -> kotlin.Unit): test.Nested.Runnable
|
||||||
public /*synthesized*/ fun Runnable(/*0*/ function: () -> kotlin.Unit): test.Nested.Runnable
|
|
||||||
|
|
||||||
package test.Nested.Deeper2 {
|
|
||||||
public /*synthesized*/ fun Runnable(/*0*/ function: () -> kotlin.Unit): test.Nested.Deeper2.Runnable
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait SamSubinterfaceOfTwo {
|
public trait SamSubinterfaceOfTwo {
|
||||||
|
|
||||||
public trait Sub : test.SamSubinterfaceOfTwo.Super1, test.SamSubinterfaceOfTwo.Super2<kotlin.String> {
|
public trait Sub : test.SamSubinterfaceOfTwo.Super1, test.SamSubinterfaceOfTwo.Super2<kotlin.String> {
|
||||||
public abstract override /*2*/ /*fake_override*/ fun f(): kotlin.String?
|
public abstract override /*2*/ /*fake_override*/ fun f(): kotlin.String?
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super1 {
|
public trait Super1 {
|
||||||
public abstract fun f(): kotlin.CharSequence?
|
public abstract fun f(): kotlin.CharSequence?
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super2</*0*/ T> {
|
public trait Super2</*0*/ T> {
|
||||||
public abstract fun f(): T?
|
public abstract fun f(): T?
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.SamSubinterfaceOfTwo {
|
public final /*synthesized*/ fun Sub(/*0*/ function: () -> kotlin.String?): test.SamSubinterfaceOfTwo.Sub
|
||||||
public /*synthesized*/ fun Sub(/*0*/ function: () -> kotlin.String?): test.SamSubinterfaceOfTwo.Sub
|
public final /*synthesized*/ fun Super1(/*0*/ function: () -> kotlin.CharSequence?): test.SamSubinterfaceOfTwo.Super1
|
||||||
public /*synthesized*/ fun Super1(/*0*/ function: () -> kotlin.CharSequence?): test.SamSubinterfaceOfTwo.Super1
|
public final /*synthesized*/ fun </*0*/ T> Super2(/*0*/ function: () -> T?): test.SamSubinterfaceOfTwo.Super2<T>
|
||||||
public /*synthesized*/ fun </*0*/ T> Super2(/*0*/ function: () -> T?): test.SamSubinterfaceOfTwo.Super2<T>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ public open class Basic {
|
|||||||
public constructor Basic()
|
public constructor Basic()
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public open fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public open fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
|
||||||
|
|
||||||
package test.Basic {
|
// Static members
|
||||||
public /*synthesized*/ fun bar(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun bar(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public open fun bar(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public open fun bar(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait DeepSamLoop {
|
public trait DeepSamLoop {
|
||||||
|
|
||||||
public trait Bar {
|
public trait Bar {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Bar?) -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Bar?) -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Foo?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Foo?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Foo {
|
public trait Foo {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Foo?) -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((test.DeepSamLoop.Foo?) -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Bar?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: test.DeepSamLoop.Bar?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.DeepSamLoop {
|
public final /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo?) -> kotlin.Unit): test.DeepSamLoop.Bar
|
||||||
public /*synthesized*/ fun Bar(/*0*/ function: (test.DeepSamLoop.Foo?) -> kotlin.Unit): test.DeepSamLoop.Bar
|
public final /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar?) -> kotlin.Unit): test.DeepSamLoop.Foo
|
||||||
public /*synthesized*/ fun Foo(/*0*/ function: (test.DeepSamLoop.Bar?) -> kotlin.Unit): test.DeepSamLoop.Foo
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,8 @@ package test
|
|||||||
|
|
||||||
public open class SeveralSamParameters {
|
public open class SeveralSamParameters {
|
||||||
public constructor SeveralSamParameters()
|
public constructor SeveralSamParameters()
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.SeveralSamParameters {
|
public final /*synthesized*/ fun findMaxAndInvokeCallback(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?, /*1*/ p1: kotlin.String?, /*2*/ p2: kotlin.String?, /*3*/ p3: (() -> kotlin.Unit)?): kotlin.String?
|
||||||
public /*synthesized*/ fun findMaxAndInvokeCallback(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?, /*1*/ p1: kotlin.String?, /*2*/ p2: kotlin.String?, /*3*/ p3: (() -> kotlin.Unit)?): kotlin.String?
|
|
||||||
public open fun findMaxAndInvokeCallback(/*0*/ p0: java.util.Comparator<kotlin.String>?, /*1*/ p1: kotlin.String?, /*2*/ p2: kotlin.String?, /*3*/ p3: java.lang.Runnable?): kotlin.String?
|
public open fun findMaxAndInvokeCallback(/*0*/ p0: java.util.Comparator<kotlin.String>?, /*1*/ p1: kotlin.String?, /*2*/ p2: kotlin.String?, /*3*/ p3: java.lang.Runnable?): kotlin.String?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,12 @@ package test
|
|||||||
|
|
||||||
public open class TypeParameterOfMethod {
|
public open class TypeParameterOfMethod {
|
||||||
public constructor TypeParameterOfMethod()
|
public constructor TypeParameterOfMethod()
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.TypeParameterOfMethod {
|
public final /*synthesized*/ fun </*0*/ T> max(/*0*/ p0: ((T, T) -> kotlin.Int)?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
||||||
public /*synthesized*/ fun </*0*/ T> max(/*0*/ p0: ((T, T) -> kotlin.Int)?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
|
||||||
public open fun </*0*/ T> max(/*0*/ p0: java.util.Comparator<T>?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
public open fun </*0*/ T> max(/*0*/ p0: java.util.Comparator<T>?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
||||||
public /*synthesized*/ fun </*0*/ T : kotlin.CharSequence?> max2(/*0*/ p0: ((T, T) -> kotlin.Int)?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
public final /*synthesized*/ fun </*0*/ T : kotlin.CharSequence?> max2(/*0*/ p0: ((T, T) -> kotlin.Int)?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
||||||
public open fun </*0*/ T : kotlin.CharSequence?> max2(/*0*/ p0: java.util.Comparator<T>?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
public open fun </*0*/ T : kotlin.CharSequence?> max2(/*0*/ p0: java.util.Comparator<T>?, /*1*/ p1: T?, /*2*/ p2: T?): T?
|
||||||
public /*synthesized*/ fun </*0*/ A : kotlin.CharSequence?, /*1*/ B : kotlin.List<A>?> method(/*0*/ p0: ((A, A) -> kotlin.Int)?, /*1*/ p1: B?): kotlin.Unit
|
public final /*synthesized*/ fun </*0*/ A : kotlin.CharSequence?, /*1*/ B : kotlin.List<A>?> method(/*0*/ p0: ((A, A) -> kotlin.Int)?, /*1*/ p1: B?): kotlin.Unit
|
||||||
public open fun </*0*/ A : kotlin.CharSequence?, /*1*/ B : kotlin.List<A>?> method(/*0*/ p0: java.util.Comparator<A>?, /*1*/ p1: B?): kotlin.Unit
|
public open fun </*0*/ A : kotlin.CharSequence?, /*1*/ B : kotlin.List<A>?> method(/*0*/ p0: java.util.Comparator<A>?, /*1*/ p1: B?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -1,18 +1,17 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait AdapterDoesntOverrideDeclaration {
|
public trait AdapterDoesntOverrideDeclaration {
|
||||||
|
|
||||||
public trait Sub : test.AdapterDoesntOverrideDeclaration.Super {
|
public trait Sub : test.AdapterDoesntOverrideDeclaration.Super {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.AdapterDoesntOverrideDeclaration {
|
public final /*synthesized*/ fun Super(/*0*/ function: ((() -> kotlin.Unit)?) -> kotlin.Unit): test.AdapterDoesntOverrideDeclaration.Super
|
||||||
public /*synthesized*/ fun Super(/*0*/ function: ((() -> kotlin.Unit)?) -> kotlin.Unit): test.AdapterDoesntOverrideDeclaration.Super
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-9
@@ -1,25 +1,24 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait InheritedSameAdapters {
|
public trait InheritedSameAdapters {
|
||||||
|
|
||||||
public trait Sub : test.InheritedSameAdapters.Super1, test.InheritedSameAdapters.Super2 {
|
public trait Sub : test.InheritedSameAdapters.Super1, test.InheritedSameAdapters.Super2 {
|
||||||
public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super1 {
|
public trait Super1 {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super2 {
|
public trait Super2 {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.InheritedSameAdapters {
|
public final /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Sub
|
||||||
public /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Sub
|
public final /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super1
|
||||||
public /*synthesized*/ fun Super1(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super1
|
public final /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super2
|
||||||
public /*synthesized*/ fun Super2(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSameAdapters.Super2
|
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-11
@@ -1,31 +1,30 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait InheritedSameAdaptersWithSubstitution {
|
public trait InheritedSameAdaptersWithSubstitution {
|
||||||
|
|
||||||
public trait Sub : test.InheritedSameAdaptersWithSubstitution.Super1, test.InheritedSameAdaptersWithSubstitution.Super2Substituted {
|
public trait Sub : test.InheritedSameAdaptersWithSubstitution.Super1, test.InheritedSameAdaptersWithSubstitution.Super2Substituted {
|
||||||
public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
public final override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
||||||
public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.util.Comparator<kotlin.String>?): kotlin.Unit
|
public abstract override /*2*/ /*fake_override*/ fun foo(/*0*/ p0: java.util.Comparator<kotlin.String>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super1 {
|
public trait Super1 {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.util.Comparator<kotlin.String>?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.util.Comparator<kotlin.String>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super2</*0*/ T> {
|
public trait Super2</*0*/ T> {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: ((T, T) -> kotlin.Int)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: ((T, T) -> kotlin.Int)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.util.Comparator<T>?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.util.Comparator<T>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super2Substituted : test.InheritedSameAdaptersWithSubstitution.Super2<kotlin.String> {
|
public trait Super2Substituted : test.InheritedSameAdaptersWithSubstitution.Super2<kotlin.String> {
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: ((kotlin.String, kotlin.String) -> kotlin.Int)?): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.util.Comparator<kotlin.String>?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.util.Comparator<kotlin.String>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.InheritedSameAdaptersWithSubstitution {
|
public final /*synthesized*/ fun Sub(/*0*/ function: (java.util.Comparator<kotlin.String>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Sub
|
||||||
public /*synthesized*/ fun Sub(/*0*/ function: (java.util.Comparator<kotlin.String>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Sub
|
public final /*synthesized*/ fun Super1(/*0*/ function: (java.util.Comparator<kotlin.String>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Super1
|
||||||
public /*synthesized*/ fun Super1(/*0*/ function: (java.util.Comparator<kotlin.String>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Super1
|
public final /*synthesized*/ fun </*0*/ T> Super2(/*0*/ function: (java.util.Comparator<T>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Super2<T>
|
||||||
public /*synthesized*/ fun </*0*/ T> Super2(/*0*/ function: (java.util.Comparator<T>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Super2<T>
|
public final /*synthesized*/ fun Super2Substituted(/*0*/ function: (java.util.Comparator<kotlin.String>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Super2Substituted
|
||||||
public /*synthesized*/ fun Super2Substituted(/*0*/ function: (java.util.Comparator<kotlin.String>?) -> kotlin.Unit): test.InheritedSameAdaptersWithSubstitution.Super2Substituted
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-7
@@ -1,19 +1,18 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait InheritedSimple {
|
public trait InheritedSimple {
|
||||||
|
|
||||||
public trait Sub : test.InheritedSimple.Super {
|
public trait Sub : test.InheritedSimple.Super {
|
||||||
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super {
|
public trait Super {
|
||||||
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
public final /*synthesized*/ fun foo(/*0*/ p0: (() -> kotlin.Unit)?): kotlin.Unit
|
||||||
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: java.lang.Runnable?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.InheritedSimple {
|
public final /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSimple.Sub
|
||||||
public /*synthesized*/ fun Sub(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSimple.Sub
|
public final /*synthesized*/ fun Super(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSimple.Super
|
||||||
public /*synthesized*/ fun Super(/*0*/ function: (java.lang.Runnable?) -> kotlin.Unit): test.InheritedSimple.Super
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,16 @@ package test
|
|||||||
|
|
||||||
public open class RawSuperType {
|
public open class RawSuperType {
|
||||||
public constructor RawSuperType()
|
public constructor RawSuperType()
|
||||||
|
|
||||||
public open inner class Derived : test.RawSuperType.Super<kotlin.Any?> {
|
public open inner class Derived : test.RawSuperType.Super<kotlin.Any?> {
|
||||||
public constructor Derived()
|
public constructor Derived()
|
||||||
public open override /*1*/ fun foo(/*0*/ p0: kotlin.Any?): kotlin.Unit
|
public open override /*1*/ fun foo(/*0*/ p0: kotlin.Any?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super</*0*/ T> {
|
public trait Super</*0*/ T> {
|
||||||
public abstract fun foo(/*0*/ p0: T?): kotlin.Unit
|
public abstract fun foo(/*0*/ p0: T?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.RawSuperType {
|
public final /*synthesized*/ fun </*0*/ T> Super(/*0*/ function: (T?) -> kotlin.Unit): test.RawSuperType.Super<T>
|
||||||
public /*synthesized*/ fun </*0*/ T> Super(/*0*/ function: (T?) -> kotlin.Unit): test.RawSuperType.Super<T>
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-6
@@ -4,17 +4,16 @@ public /*synthesized*/ fun TwoSuperclassesInconsistentGenericTypes(/*0*/ functio
|
|||||||
|
|
||||||
public trait TwoSuperclassesInconsistentGenericTypes {
|
public trait TwoSuperclassesInconsistentGenericTypes {
|
||||||
public abstract fun foo(): kotlin.MutableList<kotlin.String?>
|
public abstract fun foo(): kotlin.MutableList<kotlin.String?>
|
||||||
|
|
||||||
public trait Other {
|
public trait Other {
|
||||||
public abstract fun foo(): kotlin.MutableList<kotlin.String>?
|
public abstract fun foo(): kotlin.MutableList<kotlin.String>?
|
||||||
}
|
}
|
||||||
|
|
||||||
public open class Sub : test.TwoSuperclassesInconsistentGenericTypes, test.TwoSuperclassesInconsistentGenericTypes.Other {
|
public open class Sub : test.TwoSuperclassesInconsistentGenericTypes, test.TwoSuperclassesInconsistentGenericTypes.Other {
|
||||||
public constructor Sub()
|
public constructor Sub()
|
||||||
public open override /*2*/ fun foo(): kotlin.MutableList<kotlin.String>
|
public open override /*2*/ fun foo(): kotlin.MutableList<kotlin.String>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.TwoSuperclassesInconsistentGenericTypes {
|
public final /*synthesized*/ fun Other(/*0*/ function: () -> kotlin.MutableList<kotlin.String>?): test.TwoSuperclassesInconsistentGenericTypes.Other
|
||||||
public /*synthesized*/ fun Other(/*0*/ function: () -> kotlin.MutableList<kotlin.String>?): test.TwoSuperclassesInconsistentGenericTypes.Other
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-8
@@ -1,22 +1,21 @@
|
|||||||
package test
|
package test
|
||||||
|
|
||||||
public trait TwoSuperclassesVarargAndNot {
|
public trait TwoSuperclassesVarargAndNot {
|
||||||
|
|
||||||
public trait Sub : test.TwoSuperclassesVarargAndNot.Super1, test.TwoSuperclassesVarargAndNot.Super2 {
|
public trait Sub : test.TwoSuperclassesVarargAndNot.Super1, test.TwoSuperclassesVarargAndNot.Super2 {
|
||||||
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ vararg p0: kotlin.String? /*kotlin.Array<kotlin.String?>*/): kotlin.Unit
|
public abstract override /*1*/ /*fake_override*/ fun foo(/*0*/ vararg p0: kotlin.String? /*kotlin.Array<kotlin.String?>*/): kotlin.Unit
|
||||||
public abstract override /*1*/ fun foo(/*0*/ s: kotlin.Array<out kotlin.String?>?): kotlin.Unit
|
public abstract override /*1*/ fun foo(/*0*/ s: kotlin.Array<out kotlin.String?>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super1 {
|
public trait Super1 {
|
||||||
public abstract fun foo(/*0*/ vararg p0: kotlin.String? /*kotlin.Array<kotlin.String?>*/): kotlin.Unit
|
public abstract fun foo(/*0*/ vararg p0: kotlin.String? /*kotlin.Array<kotlin.String?>*/): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public trait Super2 {
|
public trait Super2 {
|
||||||
public abstract fun foo(/*0*/ s: kotlin.Array<out kotlin.String?>?): kotlin.Unit
|
public abstract fun foo(/*0*/ s: kotlin.Array<out kotlin.String?>?): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.TwoSuperclassesVarargAndNot {
|
public final /*synthesized*/ fun Super1(/*0*/ function: (kotlin.Array<kotlin.String?>) -> kotlin.Unit): test.TwoSuperclassesVarargAndNot.Super1
|
||||||
public /*synthesized*/ fun Super1(/*0*/ function: (kotlin.Array<kotlin.String?>) -> kotlin.Unit): test.TwoSuperclassesVarargAndNot.Super1
|
public final /*synthesized*/ fun Super2(/*0*/ function: (kotlin.Array<out kotlin.String?>?) -> kotlin.Unit): test.TwoSuperclassesVarargAndNot.Super2
|
||||||
public /*synthesized*/ fun Super2(/*0*/ function: (kotlin.Array<out kotlin.String?>?) -> kotlin.Unit): test.TwoSuperclassesVarargAndNot.Super2
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,21 +2,14 @@ package test
|
|||||||
|
|
||||||
public open class DeeplyNestedStatic {
|
public open class DeeplyNestedStatic {
|
||||||
public constructor DeeplyNestedStatic()
|
public constructor DeeplyNestedStatic()
|
||||||
|
|
||||||
public open class Foo {
|
public open class Foo {
|
||||||
public constructor Foo()
|
public constructor Foo()
|
||||||
|
|
||||||
public open class Bar {
|
public open class Bar {
|
||||||
public constructor Bar()
|
public constructor Bar()
|
||||||
}
|
|
||||||
}
|
// Static members
|
||||||
}
|
|
||||||
|
|
||||||
package test.DeeplyNestedStatic {
|
|
||||||
|
|
||||||
package test.DeeplyNestedStatic.Foo {
|
|
||||||
|
|
||||||
package test.DeeplyNestedStatic.Foo.Bar {
|
|
||||||
public open fun method(): kotlin.Unit
|
public open fun method(): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ package test
|
|||||||
public open class Simple {
|
public open class Simple {
|
||||||
public constructor Simple()
|
public constructor Simple()
|
||||||
public open fun foo(): kotlin.Unit
|
public open fun foo(): kotlin.Unit
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.Simple {
|
|
||||||
public open fun bar(): kotlin.Unit
|
public open fun bar(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ package test
|
|||||||
|
|
||||||
public open class StaticFinal {
|
public open class StaticFinal {
|
||||||
public constructor StaticFinal()
|
public constructor StaticFinal()
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.StaticFinal {
|
public final val foo: kotlin.String = "aaa"
|
||||||
public val foo: kotlin.String = "aaa"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,29 +4,28 @@ public final enum class StaticMembersInEnum : kotlin.Enum<test.StaticMembersInEn
|
|||||||
private constructor StaticMembersInEnum()
|
private constructor StaticMembersInEnum()
|
||||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||||
|
|
||||||
public class object <class-object-for-StaticMembersInEnum> {
|
public class object <class-object-for-StaticMembersInEnum> {
|
||||||
private constructor <class-object-for-StaticMembersInEnum>()
|
private constructor <class-object-for-StaticMembersInEnum>()
|
||||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): test.StaticMembersInEnum
|
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): test.StaticMembersInEnum
|
||||||
public final /*synthesized*/ fun values(): kotlin.Array<test.StaticMembersInEnum>
|
public final /*synthesized*/ fun values(): kotlin.Array<test.StaticMembersInEnum>
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum entry ENTRY : test.StaticMembersInEnum {
|
public enum entry ENTRY : test.StaticMembersInEnum {
|
||||||
private constructor ENTRY()
|
private constructor ENTRY()
|
||||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||||
|
|
||||||
public class object <class-object-for-ENTRY> : test.StaticMembersInEnum.ENTRY {
|
public class object <class-object-for-ENTRY> : test.StaticMembersInEnum.ENTRY {
|
||||||
private constructor <class-object-for-ENTRY>()
|
private constructor <class-object-for-ENTRY>()
|
||||||
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
|
||||||
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.StaticMembersInEnum {
|
public final val CONSTANT: test.StaticMembersInEnum
|
||||||
public val CONSTANT: test.StaticMembersInEnum
|
public final var STATIC_FIELD: kotlin.Int
|
||||||
public var STATIC_FIELD: kotlin.Int
|
|
||||||
public open fun foo(): kotlin.Unit
|
public open fun foo(): kotlin.Unit
|
||||||
public open fun valueOf(/*0*/ p0: kotlin.Int): kotlin.Unit
|
public open fun valueOf(/*0*/ p0: kotlin.Int): kotlin.Unit
|
||||||
public open fun values(/*0*/ p0: kotlin.Int): kotlin.Unit
|
public open fun values(/*0*/ p0: kotlin.Int): kotlin.Unit
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ public fun topLevelFunction(): kotlin.Unit
|
|||||||
public open class JavaClass {
|
public open class JavaClass {
|
||||||
public constructor JavaClass()
|
public constructor JavaClass()
|
||||||
public open fun instanceMethod(): kotlin.Unit
|
public open fun instanceMethod(): kotlin.Unit
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public open fun staticMethod(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class KotlinClass {
|
public final class KotlinClass {
|
||||||
@@ -16,18 +19,13 @@ public trait SamInterface {
|
|||||||
public abstract fun instanceMethod(): kotlin.Unit
|
public abstract fun instanceMethod(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
package test.JavaClass {
|
|
||||||
public open fun staticMethod(): kotlin.Unit
|
|
||||||
}
|
|
||||||
|
|
||||||
package test.sub {
|
package test.sub {
|
||||||
|
|
||||||
public open class JavaClassInSubpackage {
|
public open class JavaClassInSubpackage {
|
||||||
public constructor JavaClassInSubpackage()
|
public constructor JavaClassInSubpackage()
|
||||||
public open fun instanceMethod(): kotlin.Unit
|
public open fun instanceMethod(): kotlin.Unit
|
||||||
}
|
|
||||||
|
// Static members
|
||||||
package test.sub.JavaClassInSubpackage {
|
|
||||||
public open fun staticMethod(): kotlin.Unit
|
public open fun staticMethod(): kotlin.Unit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6151,6 +6151,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("privateNestedClassStaticMember.kt")
|
||||||
|
public void testPrivateNestedClassStaticMember() throws Exception {
|
||||||
|
doTest("compiler/testData/diagnostics/tests/j+k/privateNestedClassStaticMember.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("protectedStaticSamePackage.kt")
|
@TestMetadata("protectedStaticSamePackage.kt")
|
||||||
public void testProtectedStaticSamePackage() throws Exception {
|
public void testProtectedStaticSamePackage() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/protectedStaticSamePackage.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/protectedStaticSamePackage.kt");
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import com.google.common.collect.Lists;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFragmentDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||||
@@ -170,13 +168,6 @@ public class DescriptorValidator {
|
|||||||
public Boolean visitPackageFragmentDescriptor(
|
public Boolean visitPackageFragmentDescriptor(
|
||||||
PackageFragmentDescriptor descriptor, DiagnosticCollector collector
|
PackageFragmentDescriptor descriptor, DiagnosticCollector collector
|
||||||
) {
|
) {
|
||||||
if (descriptor instanceof JavaClassStaticsPackageFragmentDescriptor) {
|
|
||||||
JavaClassDescriptor correspondingClass = ((JavaClassStaticsPackageFragmentDescriptor) descriptor).getCorrespondingClass();
|
|
||||||
JavaClassStaticsPackageFragmentDescriptor correspondingPackageFragment = correspondingClass.getCorrespondingPackageFragment();
|
|
||||||
if (correspondingPackageFragment != descriptor) {
|
|
||||||
report(collector, descriptor, "Corresponding class bound to another descriptor: " + correspondingPackageFragment);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
validateScope(descriptor.getMemberScope(), collector);
|
validateScope(descriptor.getMemberScope(), collector);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -251,17 +242,6 @@ public class DescriptorValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor instanceof JavaClassDescriptor) {
|
|
||||||
JavaClassStaticsPackageFragmentDescriptor
|
|
||||||
correspondingPackageFragment = ((JavaClassDescriptor) descriptor).getCorrespondingPackageFragment();
|
|
||||||
if (correspondingPackageFragment != null) {
|
|
||||||
JavaClassDescriptor correspondingClass = correspondingPackageFragment.getCorrespondingClass();
|
|
||||||
if (correspondingClass != descriptor) {
|
|
||||||
report(collector, descriptor, "Corresponding package bound to another descriptor: " + correspondingClass);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,12 @@ public class RecursiveDescriptorComparator {
|
|||||||
if (descriptor instanceof ClassDescriptor) {
|
if (descriptor instanceof ClassDescriptor) {
|
||||||
ClassDescriptor klass = (ClassDescriptor) descriptor;
|
ClassDescriptor klass = (ClassDescriptor) descriptor;
|
||||||
appendSubDescriptors(klass.getDefaultType().getMemberScope(), getConstructorsAndClassObject(klass), printer);
|
appendSubDescriptors(klass.getDefaultType().getMemberScope(), getConstructorsAndClassObject(klass), printer);
|
||||||
|
JetScope staticScope = klass.getStaticScope();
|
||||||
|
if (!staticScope.getAllDescriptors().isEmpty()) {
|
||||||
|
printer.println();
|
||||||
|
printer.println("// Static members");
|
||||||
|
appendSubDescriptors(staticScope, Collections.<DeclarationDescriptor>emptyList(), printer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (descriptor instanceof PackageFragmentDescriptor) {
|
else if (descriptor instanceof PackageFragmentDescriptor) {
|
||||||
appendSubDescriptors(((PackageFragmentDescriptor) descriptor).getMemberScope(),
|
appendSubDescriptors(((PackageFragmentDescriptor) descriptor).getMemberScope(),
|
||||||
|
|||||||
+7
-20
@@ -16,29 +16,16 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.java
|
package org.jetbrains.jet.lang.resolve.java
|
||||||
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
import org.jetbrains.jet.lang.descriptors.*
|
||||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor
|
import org.jetbrains.jet.lang.resolve.java.structure.*
|
||||||
import org.jetbrains.jet.lang.descriptors.PackageFragmentDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaPackageFragmentProvider
|
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaPackageFragmentProvider
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod
|
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaField
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaMember
|
|
||||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.sources.JavaSourceElement
|
import org.jetbrains.jet.lang.resolve.java.sources.JavaSourceElement
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaElement
|
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorWithSource
|
|
||||||
|
|
||||||
public class JavaDescriptorResolver(public val packageFragmentProvider: LazyJavaPackageFragmentProvider, private val module: ModuleDescriptor) {
|
public class JavaDescriptorResolver(public val packageFragmentProvider: LazyJavaPackageFragmentProvider, private val module: ModuleDescriptor) {
|
||||||
public fun resolveClass(javaClass: JavaClass): ClassDescriptor? {
|
public fun resolveClass(javaClass: JavaClass): ClassDescriptor? {
|
||||||
return packageFragmentProvider.getClass(javaClass)
|
return packageFragmentProvider.getClass(javaClass)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getPackageFragment(javaClass: JavaClass): PackageFragmentDescriptor? {
|
|
||||||
return packageFragmentProvider.getPackageFragment(javaClass)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun JavaDescriptorResolver.resolveMethod(method: JavaMethod): FunctionDescriptor? {
|
public fun JavaDescriptorResolver.resolveMethod(method: JavaMethod): FunctionDescriptor? {
|
||||||
@@ -54,12 +41,12 @@ public fun JavaDescriptorResolver.resolveField(field: JavaField): PropertyDescri
|
|||||||
return getContainingScope(field)?.getProperties(field.getName())?.findByJavaElement(field) as? PropertyDescriptor
|
return getContainingScope(field)?.getProperties(field.getName())?.findByJavaElement(field) as? PropertyDescriptor
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun JavaDescriptorResolver.getContainingScope(method: JavaMember): JetScope? {
|
private fun JavaDescriptorResolver.getContainingScope(member: JavaMember): JetScope? {
|
||||||
val containingClass = method.getContainingClass()
|
val containingClass = resolveClass(member.getContainingClass())
|
||||||
return if (method.isStatic())
|
return if (member.isStatic())
|
||||||
getPackageFragment(containingClass)?.getMemberScope()
|
containingClass?.getStaticScope()
|
||||||
else
|
else
|
||||||
resolveClass(containingClass)?.getDefaultType()?.getMemberScope()
|
containingClass?.getDefaultType()?.getMemberScope()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun <T : DeclarationDescriptorWithSource> Collection<T>.findByJavaElement(javaElement: JavaElement): T? {
|
private fun <T : DeclarationDescriptorWithSource> Collection<T>.findByJavaElement(javaElement: JavaElement): T? {
|
||||||
|
|||||||
+5
-28
@@ -17,10 +17,8 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.java;
|
package org.jetbrains.jet.lang.resolve.java;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFragmentDescriptor;
|
|
||||||
|
|
||||||
public class JavaVisibilities {
|
public class JavaVisibilities {
|
||||||
private JavaVisibilities() {
|
private JavaVisibilities() {
|
||||||
@@ -61,20 +59,9 @@ public class JavaVisibilities {
|
|||||||
ClassDescriptor fromClass = DescriptorUtils.getParentOfType(from, ClassDescriptor.class, false);
|
ClassDescriptor fromClass = DescriptorUtils.getParentOfType(from, ClassDescriptor.class, false);
|
||||||
if (fromClass == null) return false;
|
if (fromClass == null) return false;
|
||||||
|
|
||||||
ClassDescriptor whatClass;
|
DeclarationDescriptor containingDeclaration = what.getContainingDeclaration();
|
||||||
// protected static class
|
assert containingDeclaration instanceof ClassDescriptor : "Only class members can have protected_static visibility";
|
||||||
if (what instanceof ClassDescriptor) {
|
ClassDescriptor whatClass = (ClassDescriptor) containingDeclaration;
|
||||||
DeclarationDescriptor containingDeclaration = what.getContainingDeclaration();
|
|
||||||
assert containingDeclaration instanceof ClassDescriptor : "Only static nested classes can have protected_static visibility";
|
|
||||||
whatClass = (ClassDescriptor) containingDeclaration;
|
|
||||||
}
|
|
||||||
// protected static function or property
|
|
||||||
else {
|
|
||||||
DeclarationDescriptor whatDeclarationDescriptor = what.getContainingDeclaration();
|
|
||||||
assert whatDeclarationDescriptor instanceof JavaClassStaticsPackageFragmentDescriptor
|
|
||||||
: "Only static declarations can have protected_static visibility";
|
|
||||||
whatClass = ((JavaClassStaticsPackageFragmentDescriptor) whatDeclarationDescriptor).getCorrespondingClass();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DescriptorUtils.isSubclass(fromClass, whatClass)) {
|
if (DescriptorUtils.isSubclass(fromClass, whatClass)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -134,18 +121,8 @@ public class JavaVisibilities {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private static boolean areInSamePackage(@NotNull DeclarationDescriptor first, @NotNull DeclarationDescriptor second) {
|
private static boolean areInSamePackage(@NotNull DeclarationDescriptor first, @NotNull DeclarationDescriptor second) {
|
||||||
PackageFragmentDescriptor whatPackage = getPackageStaticsAware(first);
|
PackageFragmentDescriptor whatPackage = DescriptorUtils.getParentOfType(first, PackageFragmentDescriptor.class, false);
|
||||||
PackageFragmentDescriptor fromPackage = getPackageStaticsAware(second);
|
PackageFragmentDescriptor fromPackage = DescriptorUtils.getParentOfType(second, PackageFragmentDescriptor.class, false);
|
||||||
return fromPackage != null && whatPackage != null && whatPackage.getFqName().equals(fromPackage.getFqName());
|
return fromPackage != null && whatPackage != null && whatPackage.getFqName().equals(fromPackage.getFqName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private static PackageFragmentDescriptor getPackageStaticsAware(@NotNull DeclarationDescriptor member) {
|
|
||||||
PackageFragmentDescriptor packageFragment = DescriptorUtils.getParentOfType(member, PackageFragmentDescriptor.class, false);
|
|
||||||
if (packageFragment instanceof JavaClassStaticsPackageFragmentDescriptor) {
|
|
||||||
ClassDescriptor classForPackage = ((JavaClassStaticsPackageFragmentDescriptor) packageFragment).getCorrespondingClass();
|
|
||||||
return DescriptorUtils.getParentOfType(classForPackage, PackageFragmentDescriptor.class, false);
|
|
||||||
}
|
|
||||||
return packageFragment;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-3
@@ -23,7 +23,4 @@ import org.jetbrains.jet.lang.types.JetType;
|
|||||||
public interface JavaClassDescriptor extends ClassDescriptor {
|
public interface JavaClassDescriptor extends ClassDescriptor {
|
||||||
@Nullable
|
@Nullable
|
||||||
JetType getFunctionTypeForSamInterface();
|
JetType getFunctionTypeForSamInterface();
|
||||||
|
|
||||||
@Nullable
|
|
||||||
JavaClassStaticsPackageFragmentDescriptor getCorrespondingPackageFragment();
|
|
||||||
}
|
}
|
||||||
|
|||||||
-4
@@ -19,7 +19,3 @@ package org.jetbrains.jet.lang.resolve.java.descriptor
|
|||||||
import org.jetbrains.jet.lang.descriptors.PackageFragmentDescriptor
|
import org.jetbrains.jet.lang.descriptors.PackageFragmentDescriptor
|
||||||
|
|
||||||
public trait JavaPackageFragmentDescriptor : PackageFragmentDescriptor
|
public trait JavaPackageFragmentDescriptor : PackageFragmentDescriptor
|
||||||
|
|
||||||
public trait JavaClassStaticsPackageFragmentDescriptor : JavaPackageFragmentDescriptor {
|
|
||||||
public fun getCorrespondingClass(): JavaClassDescriptor
|
|
||||||
}
|
|
||||||
|
|||||||
+11
-30
@@ -21,13 +21,9 @@ import org.jetbrains.jet.storage.MemoizedFunctionToNullable
|
|||||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyPackageFragmentForJavaPackage
|
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.*
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyPackageFragmentForJavaClass
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaPackageFragmentProvider
|
import org.jetbrains.jet.lang.resolve.java.resolver.JavaPackageFragmentProvider
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyJavaPackageFragment
|
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass
|
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyJavaClassDescriptor
|
|
||||||
|
|
||||||
public class LazyJavaPackageFragmentProvider(
|
public class LazyJavaPackageFragmentProvider(
|
||||||
outerContext: GlobalJavaResolverContext,
|
outerContext: GlobalJavaResolverContext,
|
||||||
@@ -53,20 +49,15 @@ public class LazyJavaPackageFragmentProvider(
|
|||||||
|
|
||||||
override fun getModule() = _module
|
override fun getModule() = _module
|
||||||
|
|
||||||
private val _packageFragments: MemoizedFunctionToNullable<FqName, LazyJavaPackageFragment> = c.storageManager.createMemoizedFunctionWithNullableValues {
|
private val _packageFragments: MemoizedFunctionToNullable<FqName, LazyJavaPackageFragment> =
|
||||||
fqName ->
|
c.storageManager.createMemoizedFunctionWithNullableValues {
|
||||||
val jPackage = c.finder.findPackage(fqName)
|
fqName ->
|
||||||
if (jPackage != null) {
|
val jPackage = c.finder.findPackage(fqName)
|
||||||
LazyPackageFragmentForJavaPackage(c, _module, jPackage)
|
if (jPackage != null) {
|
||||||
}
|
LazyJavaPackageFragment(c, _module, jPackage)
|
||||||
else {
|
}
|
||||||
val jClass = c.findJavaClass(fqName)
|
else null
|
||||||
if (jClass != null) {
|
|
||||||
packageFragmentsForClasses(jClass)
|
|
||||||
}
|
}
|
||||||
else null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val topLevelClasses = c.storageManager.createMemoizedFunctionWithNullableValues @lambda {
|
private val topLevelClasses = c.storageManager.createMemoizedFunctionWithNullableValues @lambda {
|
||||||
(jClass: JavaClass): LazyJavaClassDescriptor? ->
|
(jClass: JavaClass): LazyJavaClassDescriptor? ->
|
||||||
@@ -84,17 +75,7 @@ public class LazyJavaPackageFragmentProvider(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val packageFragmentsForClasses: MemoizedFunctionToNullable<JavaClass, LazyPackageFragmentForJavaClass> = c.storageManager.createMemoizedFunctionWithNullableValues {
|
fun getPackageFragment(fqName: FqName) = _packageFragments(fqName)
|
||||||
jClass ->
|
|
||||||
if (DescriptorResolverUtils.hasStaticMembers(jClass)) {
|
|
||||||
val correspondingClass = c.javaClassResolver.resolveClass(jClass)
|
|
||||||
if (correspondingClass != null) LazyPackageFragmentForJavaClass(c, _module, jClass) else null
|
|
||||||
}
|
|
||||||
else null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getPackageFragment(fqName: FqName) = _packageFragments(fqName)
|
|
||||||
fun getPackageFragment(javaClass: JavaClass) = packageFragmentsForClasses(javaClass)
|
|
||||||
|
|
||||||
override fun getPackageFragments(fqName: FqName) = getPackageFragment(fqName)?.let {listOf(it)}.orEmpty()
|
override fun getPackageFragments(fqName: FqName) = getPackageFragment(fqName)?.let {listOf(it)}.orEmpty()
|
||||||
|
|
||||||
@@ -120,4 +101,4 @@ public class LazyJavaPackageFragmentProvider(
|
|||||||
return outerClassScope?.getClassifier(javaClass.getName()) as? ClassDescriptor
|
return outerClassScope?.getClassifier(javaClass.getName()) as? ClassDescriptor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-13
@@ -16,16 +16,13 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.lang.resolve.java.lazy.descriptors
|
package org.jetbrains.jet.lang.resolve.java.lazy.descriptors
|
||||||
|
|
||||||
|
import org.jetbrains.jet.lang.descriptors.*
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
|
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorBase
|
import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorBase
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor
|
|
||||||
import org.jetbrains.jet.lang.types.JetType
|
import org.jetbrains.jet.lang.types.JetType
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
|
||||||
import org.jetbrains.jet.lang.types.TypeConstructor
|
import org.jetbrains.jet.lang.types.TypeConstructor
|
||||||
import org.jetbrains.jet.lang.descriptors.TypeParameterDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContextWithTypes
|
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContextWithTypes
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.child
|
import org.jetbrains.jet.lang.resolve.java.lazy.child
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
import org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage
|
||||||
@@ -36,18 +33,13 @@ import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
|
|||||||
import org.jetbrains.jet.utils.*
|
import org.jetbrains.jet.utils.*
|
||||||
import org.jetbrains.jet.lang.resolve.java.sam.SingleAbstractMethodUtils
|
import org.jetbrains.jet.lang.resolve.java.sam.SingleAbstractMethodUtils
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod
|
||||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor
|
|
||||||
import org.jetbrains.jet.lang.types.TypeUtils
|
import org.jetbrains.jet.lang.types.TypeUtils
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor
|
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor
|
||||||
import org.jetbrains.jet.lang.descriptors.Modality
|
|
||||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
import org.jetbrains.jet.lang.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassKind
|
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import org.jetbrains.jet.lang.types.checker.JetTypeChecker
|
import org.jetbrains.jet.lang.types.checker.JetTypeChecker
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFragmentDescriptor
|
|
||||||
import org.jetbrains.jet.lang.types.AbstractClassTypeConstructor
|
import org.jetbrains.jet.lang.types.AbstractClassTypeConstructor
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.EnumClassObjectDescriptor
|
import org.jetbrains.jet.lang.descriptors.impl.EnumClassObjectDescriptor
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.StaticScopeForKotlinClass
|
|
||||||
|
|
||||||
class LazyJavaClassDescriptor(
|
class LazyJavaClassDescriptor(
|
||||||
private val outerC: LazyJavaResolverContextWithTypes,
|
private val outerC: LazyJavaResolverContextWithTypes,
|
||||||
@@ -91,7 +83,8 @@ class LazyJavaClassDescriptor(
|
|||||||
private val _innerClassesScope = InnerClassesScopeWrapper(getScopeForMemberLookup())
|
private val _innerClassesScope = InnerClassesScopeWrapper(getScopeForMemberLookup())
|
||||||
override fun getUnsubstitutedInnerClassesScope(): JetScope = _innerClassesScope
|
override fun getUnsubstitutedInnerClassesScope(): JetScope = _innerClassesScope
|
||||||
|
|
||||||
override fun getStaticScope(): JetScope = StaticScopeForKotlinClass(this) // TODO
|
private val _staticScope = LazyJavaStaticClassScope(c, jClass, this)
|
||||||
|
override fun getStaticScope(): JetScope = _staticScope
|
||||||
|
|
||||||
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = null
|
override fun getUnsubstitutedPrimaryConstructor(): ConstructorDescriptor? = null
|
||||||
|
|
||||||
@@ -102,9 +95,6 @@ class LazyJavaClassDescriptor(
|
|||||||
else null
|
else null
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCorrespondingPackageFragment() =
|
|
||||||
c.packageFragmentProvider.getPackageFragment(fqName) as? JavaClassStaticsPackageFragmentDescriptor
|
|
||||||
|
|
||||||
override fun getClassObjectDescriptor(): ClassDescriptor? = _classObjectDescriptor()
|
override fun getClassObjectDescriptor(): ClassDescriptor? = _classObjectDescriptor()
|
||||||
override fun getClassObjectType(): JetType? = getClassObjectDescriptor()?.let { d -> d.getDefaultType() }
|
override fun getClassObjectType(): JetType? = getClassObjectDescriptor()?.let { d -> d.getDefaultType() }
|
||||||
|
|
||||||
|
|||||||
+9
-43
@@ -18,55 +18,21 @@ package org.jetbrains.jet.lang.resolve.java.lazy.descriptors
|
|||||||
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContext
|
import org.jetbrains.jet.lang.resolve.java.lazy.LazyJavaResolverContext
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaPackage
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaPackage
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
|
||||||
import org.jetbrains.kotlin.util.sure
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaPackageFragmentDescriptor
|
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaPackageFragmentDescriptor
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassStaticsPackageFragmentDescriptor
|
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor
|
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.PackageFragmentDescriptorImpl
|
import org.jetbrains.jet.lang.descriptors.impl.PackageFragmentDescriptorImpl
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
class LazyPackageFragmentForJavaPackage(
|
class LazyJavaPackageFragment(
|
||||||
c: LazyJavaResolverContext,
|
private val c: LazyJavaResolverContext,
|
||||||
containingDeclaration: ModuleDescriptor,
|
module: ModuleDescriptor,
|
||||||
private val jPackage: JavaPackage
|
private val jPackage: JavaPackage
|
||||||
) : LazyJavaPackageFragment(c, containingDeclaration, jPackage.getFqName()) {
|
) : PackageFragmentDescriptorImpl(module, jPackage.getFqName()),
|
||||||
override fun createMemberScope() = LazyPackageFragmentScopeForJavaPackage(c, jPackage, this)
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LazyPackageFragmentForJavaClass(
|
|
||||||
c: LazyJavaResolverContext,
|
|
||||||
containingDeclaration: ModuleDescriptor,
|
|
||||||
private val jClass: JavaClass
|
|
||||||
) : JavaClassStaticsPackageFragmentDescriptor,
|
|
||||||
LazyJavaPackageFragment(c, containingDeclaration,
|
|
||||||
jClass.getFqName().sure("Attempt to build a package of an anonymous/local class: $jClass")) {
|
|
||||||
|
|
||||||
override fun createMemberScope() = LazyPackageFragmentScopeForJavaClass(c, jClass, this)
|
|
||||||
|
|
||||||
override fun getCorrespondingClass(): JavaClassDescriptor {
|
|
||||||
val classDescriptor = c.javaClassResolver.resolveClass(jClass)
|
|
||||||
if (classDescriptor !is JavaClassDescriptor) {
|
|
||||||
throw AssertionError("Corresponding class not found for package with static members: $this")
|
|
||||||
}
|
|
||||||
return classDescriptor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class LazyJavaPackageFragment(
|
|
||||||
protected val c: LazyJavaResolverContext,
|
|
||||||
containingDeclaration: ModuleDescriptor,
|
|
||||||
fqName: FqName
|
|
||||||
) : PackageFragmentDescriptorImpl(containingDeclaration, fqName),
|
|
||||||
JavaPackageFragmentDescriptor, LazyJavaDescriptor
|
JavaPackageFragmentDescriptor, LazyJavaDescriptor
|
||||||
{
|
{
|
||||||
private val _memberScope by Delegates.lazy { createMemberScope() }
|
private val _memberScope by Delegates.lazy { LazyPackageFragmentScopeForJavaPackage(c, jPackage, this) }
|
||||||
|
|
||||||
abstract fun createMemberScope(): LazyJavaPackageFragmentScope
|
override fun getMemberScope() = _memberScope
|
||||||
|
|
||||||
override fun getMemberScope(): LazyJavaPackageFragmentScope = _memberScope
|
override fun toString() = "lazy java package fragment: $fqName"
|
||||||
|
}
|
||||||
override fun toString() = "lazy java package fragment: " + fqName
|
|
||||||
}
|
|
||||||
|
|||||||
+17
-20
@@ -28,7 +28,6 @@ import org.jetbrains.jet.utils.flatten
|
|||||||
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass
|
||||||
import org.jetbrains.kotlin.util.inn
|
import org.jetbrains.kotlin.util.inn
|
||||||
import org.jetbrains.kotlin.util.sure
|
import org.jetbrains.kotlin.util.sure
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.findJavaClass
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.findClassInJava
|
import org.jetbrains.jet.lang.resolve.java.lazy.findClassInJava
|
||||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils
|
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||||
@@ -40,16 +39,16 @@ import org.jetbrains.jet.lang.resolve.java.descriptor.SamConstructorDescriptor
|
|||||||
import org.jetbrains.jet.lang.resolve.name.SpecialNames
|
import org.jetbrains.jet.lang.resolve.name.SpecialNames
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass
|
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass
|
||||||
|
|
||||||
public abstract class LazyJavaPackageFragmentScope(
|
public abstract class LazyJavaStaticScope(
|
||||||
c: LazyJavaResolverContext,
|
c: LazyJavaResolverContext,
|
||||||
packageFragment: LazyJavaPackageFragment
|
descriptor: ClassOrPackageFragmentDescriptor
|
||||||
) : LazyJavaMemberScope(c.withTypes(), packageFragment) {
|
) : LazyJavaMemberScope(c.withTypes(), descriptor) {
|
||||||
|
|
||||||
protected val fqName: FqName = DescriptorUtils.getFqName(packageFragment).toSafe()
|
protected val fqName: FqName = DescriptorUtils.getFqName(descriptor).toSafe()
|
||||||
|
|
||||||
protected fun computeMemberIndexForSamConstructors(delegate: MemberIndex): MemberIndex = object : MemberIndex by delegate {
|
protected fun computeMemberIndexForSamConstructors(delegate: MemberIndex): MemberIndex = object : MemberIndex by delegate {
|
||||||
override fun getAllMethodNames(): Collection<Name> {
|
override fun getAllMethodNames(): Collection<Name> {
|
||||||
val jClass = c.findJavaClass(fqName)
|
val jClass = c.findClassInJava(fqName).jClass
|
||||||
return delegate.getAllMethodNames() +
|
return delegate.getAllMethodNames() +
|
||||||
// For SAM-constructors
|
// For SAM-constructors
|
||||||
getAllClassNames() +
|
getAllClassNames() +
|
||||||
@@ -76,11 +75,11 @@ public abstract class LazyJavaPackageFragmentScope(
|
|||||||
//no undeclared properties
|
//no undeclared properties
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContainingDeclaration() = super.getContainingDeclaration() as LazyJavaPackageFragment
|
override fun getContainingDeclaration() = super.getContainingDeclaration() as ClassOrPackageFragmentDescriptor
|
||||||
|
|
||||||
fun ClassifierDescriptor.createSamConstructor(): SamConstructorDescriptor? {
|
fun ClassifierDescriptor.createSamConstructor(): SamConstructorDescriptor? {
|
||||||
if (this is LazyJavaClassDescriptor && this.getFunctionTypeForSamInterface() != null) {
|
if (this is LazyJavaClassDescriptor && this.getFunctionTypeForSamInterface() != null) {
|
||||||
return SingleAbstractMethodUtils.createSamConstructorFunction(this@LazyJavaPackageFragmentScope.getContainingDeclaration(), this)
|
return SingleAbstractMethodUtils.createSamConstructorFunction(this@LazyJavaStaticScope.getContainingDeclaration(), this)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -89,8 +88,8 @@ public abstract class LazyJavaPackageFragmentScope(
|
|||||||
public class LazyPackageFragmentScopeForJavaPackage(
|
public class LazyPackageFragmentScopeForJavaPackage(
|
||||||
c: LazyJavaResolverContext,
|
c: LazyJavaResolverContext,
|
||||||
private val jPackage: JavaPackage,
|
private val jPackage: JavaPackage,
|
||||||
packageFragment: LazyPackageFragmentForJavaPackage
|
packageFragment: LazyJavaPackageFragment
|
||||||
) : LazyJavaPackageFragmentScope(c, packageFragment) {
|
) : LazyJavaStaticScope(c, packageFragment) {
|
||||||
|
|
||||||
// TODO: Storing references is a temporary hack until modules infrastructure is implemented.
|
// TODO: Storing references is a temporary hack until modules infrastructure is implemented.
|
||||||
// See JetTypeMapperWithOutDirectories for details
|
// See JetTypeMapperWithOutDirectories for details
|
||||||
@@ -143,7 +142,7 @@ public class LazyPackageFragmentScopeForJavaPackage(
|
|||||||
listOf(
|
listOf(
|
||||||
// We do not filter by hasStaticMembers() because it's slow (e.g. it triggers light class generation),
|
// We do not filter by hasStaticMembers() because it's slow (e.g. it triggers light class generation),
|
||||||
// and there's no harm in having some names in the result that can not be resolved
|
// and there's no harm in having some names in the result that can not be resolved
|
||||||
jPackage.getClasses().map { c -> c.getFqName().sure("Toplevel class has no fqName: $c}") },
|
jPackage.getClasses().map { c -> c.getFqName().sure("Toplevel class has no fqName: $c") },
|
||||||
jPackage.getSubPackages().map { sp -> sp.getFqName() }
|
jPackage.getSubPackages().map { sp -> sp.getFqName() }
|
||||||
).flatten()
|
).flatten()
|
||||||
},
|
},
|
||||||
@@ -162,32 +161,30 @@ public class LazyPackageFragmentScopeForJavaPackage(
|
|||||||
override fun getAllPropertyNames() = Collections.emptyList<Name>()
|
override fun getAllPropertyNames() = Collections.emptyList<Name>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LazyPackageFragmentScopeForJavaClass(
|
public class LazyJavaStaticClassScope(
|
||||||
c: LazyJavaResolverContext,
|
c: LazyJavaResolverContext,
|
||||||
private val jClass: JavaClass,
|
private val jClass: JavaClass,
|
||||||
packageFragment: LazyPackageFragmentForJavaClass
|
descriptor: LazyJavaClassDescriptor
|
||||||
) : LazyJavaPackageFragmentScope(c, packageFragment) {
|
) : LazyJavaStaticScope(c, descriptor) {
|
||||||
|
|
||||||
override fun computeMemberIndex(): MemberIndex = computeMemberIndexForSamConstructors(ClassMemberIndex(jClass, { m -> m.isStatic() }))
|
override fun computeMemberIndex(): MemberIndex = computeMemberIndexForSamConstructors(ClassMemberIndex(jClass, { m -> m.isStatic() }))
|
||||||
|
|
||||||
// nested classes are loaded as members of their outer classes, not packages
|
|
||||||
override fun getAllClassNames(): Collection<Name> = listOf()
|
override fun getAllClassNames(): Collection<Name> = listOf()
|
||||||
override fun getClassifier(name: Name): ClassifierDescriptor? = null
|
override fun getClassifier(name: Name): ClassifierDescriptor? = null
|
||||||
|
|
||||||
// We do not filter by hasStaticMembers() because it's slow (e.g. it triggers light class generation),
|
// We do not filter by hasStaticMembers() because it's slow (e.g. it triggers light class generation),
|
||||||
// and there's no harm in having some names in the result that can not be resolved
|
// and there's no harm in having some names in the result that can not be resolved
|
||||||
override fun getSubPackages(): Collection<FqName> = jClass.getInnerClasses().stream()
|
override fun getSubPackages(): Collection<FqName> = jClass.getInnerClasses().stream()
|
||||||
.filter { c -> c.isStatic() }
|
.filter { c -> c.isStatic() }
|
||||||
.map { c -> c.getFqName().sure("Nested class has no fqName: $c}") }.toList()
|
.map { c -> c.getFqName().sure("Nested class has no fqName: $c") }.toList()
|
||||||
|
|
||||||
override fun computeNonDeclaredFunctions(result: MutableCollection<SimpleFunctionDescriptor>, name: Name) {
|
override fun computeNonDeclaredFunctions(result: MutableCollection<SimpleFunctionDescriptor>, name: Name) {
|
||||||
//NOTE: assuming that all sam constructors are created for interfaces which are static and should be placed in this scope
|
//NOTE: assuming that all sam constructors are created for interfaces which are static and should be placed in this scope
|
||||||
val samConstructor = getContainingDeclaration().getCorrespondingClass().getUnsubstitutedInnerClassesScope().getClassifier(name)
|
val samConstructor = getContainingDeclaration().getUnsubstitutedInnerClassesScope().getClassifier(name)?.createSamConstructor()
|
||||||
?.createSamConstructor()
|
|
||||||
if (samConstructor != null) {
|
if (samConstructor != null) {
|
||||||
result.add(samConstructor)
|
result.add(samConstructor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContainingDeclaration() = super.getContainingDeclaration() as LazyPackageFragmentForJavaClass
|
override fun getContainingDeclaration() = super.getContainingDeclaration() as LazyJavaClassDescriptor
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyJavaTypeParamete
|
|||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
|
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName
|
import org.jetbrains.jet.lang.resolve.name.FqName
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader
|
import org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.jet.lang.resolve.java.resolver.DescriptorResolverUtils
|
|
||||||
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass
|
import org.jetbrains.jet.lang.resolve.kotlin.KotlinJvmBinaryClass
|
||||||
import org.jetbrains.jet.lang.resolve.resolveTopLevelClass
|
import org.jetbrains.jet.lang.resolve.resolveTopLevelClass
|
||||||
|
|
||||||
@@ -65,8 +64,6 @@ class LazyJavaTypeParameterResolver(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun LazyJavaResolverContext.findJavaClass(fqName: FqName): JavaClass? = findClassInJava(fqName).jClass
|
|
||||||
|
|
||||||
data class JavaClassLookupResult(val jClass: JavaClass? = null, val kClass: ClassDescriptor? = null)
|
data class JavaClassLookupResult(val jClass: JavaClass? = null, val kClass: ClassDescriptor? = null)
|
||||||
|
|
||||||
fun LazyJavaResolverContext.lookupBinaryClass(javaClass: JavaClass): ClassDescriptor? {
|
fun LazyJavaResolverContext.lookupBinaryClass(javaClass: JavaClass): ClassDescriptor? {
|
||||||
|
|||||||
-28
@@ -23,16 +23,13 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import org.jetbrains.jet.lang.descriptors.*;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
import org.jetbrains.jet.lang.descriptors.impl.TypeParameterDescriptorImpl;
|
||||||
import org.jetbrains.jet.lang.resolve.OverridingUtil;
|
import org.jetbrains.jet.lang.resolve.OverridingUtil;
|
||||||
import org.jetbrains.jet.lang.resolve.java.sam.SingleAbstractMethodUtils;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.structure.*;
|
import org.jetbrains.jet.lang.resolve.java.structure.*;
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
|
||||||
import org.jetbrains.jet.lang.types.TypeConstructor;
|
import org.jetbrains.jet.lang.types.TypeConstructor;
|
||||||
import org.jetbrains.jet.lang.types.TypeProjection;
|
import org.jetbrains.jet.lang.types.TypeProjection;
|
||||||
import org.jetbrains.jet.lang.types.TypeProjectionImpl;
|
import org.jetbrains.jet.lang.types.TypeProjectionImpl;
|
||||||
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -262,29 +259,4 @@ public final class DescriptorResolverUtils {
|
|||||||
}
|
}
|
||||||
return TypeSubstitutor.create(typeSubstitutionContext);
|
return TypeSubstitutor.create(typeSubstitutionContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasStaticMembers(@NotNull JavaClass javaClass) {
|
|
||||||
for (JavaMethod method : javaClass.getMethods()) {
|
|
||||||
if (method.isStatic() && !shouldBeInEnumClassObject(method)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (JavaField field : javaClass.getFields()) {
|
|
||||||
if (field.isStatic() && !field.isEnumEntry()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (JavaClass nestedClass : javaClass.getInnerClasses()) {
|
|
||||||
if (SingleAbstractMethodUtils.isSamInterface(nestedClass)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (nestedClass.isStatic() && hasStaticMembers(nestedClass)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-6
@@ -17,16 +17,10 @@
|
|||||||
package org.jetbrains.jet.lang.resolve.java.resolver;
|
package org.jetbrains.jet.lang.resolve.java.resolver;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||||
import org.jetbrains.jet.lang.descriptors.PackageFragmentProvider;
|
import org.jetbrains.jet.lang.descriptors.PackageFragmentProvider;
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaPackageFragmentDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
|
||||||
|
|
||||||
public interface JavaPackageFragmentProvider extends PackageFragmentProvider {
|
public interface JavaPackageFragmentProvider extends PackageFragmentProvider {
|
||||||
@Nullable
|
|
||||||
JavaPackageFragmentDescriptor getPackageFragment(@NotNull FqName fqName);
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
ModuleDescriptor getModule();
|
ModuleDescriptor getModule();
|
||||||
}
|
}
|
||||||
|
|||||||
-4
@@ -280,10 +280,6 @@ public class SingleAbstractMethodUtils {
|
|||||||
return new TypeParameters(typeParameters, typeParametersSubstitutor);
|
return new TypeParameters(typeParameters, typeParametersSubstitutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSamInterface(@NotNull JavaClass javaClass) {
|
|
||||||
return getSamInterfaceMethod(javaClass) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns null if not SAM interface
|
// Returns null if not SAM interface
|
||||||
@Nullable
|
@Nullable
|
||||||
public static JavaMethod getSamInterfaceMethod(@NotNull JavaClass javaClass) {
|
public static JavaMethod getSamInterfaceMethod(@NotNull JavaClass javaClass) {
|
||||||
|
|||||||
@@ -24,14 +24,10 @@ import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
|||||||
import org.jetbrains.jet.plugin.project.ResolveSessionForBodies;
|
import org.jetbrains.jet.plugin.project.ResolveSessionForBodies;
|
||||||
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
|
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
|
||||||
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import com.intellij.psi.util.PsiTreeUtil
|
import com.intellij.psi.util.PsiTreeUtil
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import org.jetbrains.jet.lang.psi.psiUtil.getParentByType
|
import org.jetbrains.jet.lang.psi.psiUtil.getParentByType
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaPropertyDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.lazy.descriptors.LazyPackageFragmentForJavaClass
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaMethodDescriptor
|
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import org.jetbrains.jet.plugin.caches.resolve.getLazyResolveSession
|
import org.jetbrains.jet.plugin.caches.resolve.getLazyResolveSession
|
||||||
@@ -245,19 +241,9 @@ public object ShortenReferences {
|
|||||||
refExpression: JetReferenceExpression,
|
refExpression: JetReferenceExpression,
|
||||||
bindingContext: BindingContext
|
bindingContext: BindingContext
|
||||||
): PsiElement {
|
): PsiElement {
|
||||||
val receiverExpression = qualifiedExpression.getReceiverExpression()
|
|
||||||
val target = bindingContext[BindingContext.REFERENCE_TARGET, refExpression]
|
val target = bindingContext[BindingContext.REFERENCE_TARGET, refExpression]
|
||||||
if (target != null) {
|
if (target == null) return qualifiedExpression
|
||||||
if ((target is JavaPropertyDescriptor || target is JavaMethodDescriptor) && receiverExpression is JetDotQualifiedExpression) {
|
return shortenIfPossibleByDescriptor(qualifiedExpression, target, bindingContext)
|
||||||
val containingDescriptor = target.getContainingDeclaration()
|
|
||||||
if (containingDescriptor is LazyPackageFragmentForJavaClass) {
|
|
||||||
return shortenIfPossibleByDescriptor(receiverExpression, containingDescriptor.getCorrespondingClass(), bindingContext)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return shortenIfPossibleByDescriptor(qualifiedExpression, target, bindingContext)
|
|
||||||
}
|
|
||||||
return qualifiedExpression
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun instantiatedClass(calleeExpression: JetReferenceExpression): ClassDescriptor? {
|
private fun instantiatedClass(calleeExpression: JetReferenceExpression): ClassDescriptor? {
|
||||||
|
|||||||
@@ -18,16 +18,9 @@ package org.jetbrains.jet.plugin.completion.smart
|
|||||||
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElement
|
import com.intellij.codeInsight.lookup.LookupElement
|
||||||
import org.jetbrains.jet.lang.types.TypeUtils
|
import org.jetbrains.jet.lang.types.TypeUtils
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor
|
import org.jetbrains.jet.lang.descriptors.*
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
import org.jetbrains.jet.lang.resolve.scopes.JetScope
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
|
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptorWithVisibility
|
|
||||||
import org.jetbrains.jet.lang.descriptors.Visibilities
|
|
||||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor
|
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassKind
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.descriptor.JavaClassDescriptor
|
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor
|
|
||||||
import com.intellij.codeInsight.lookup.LookupElementDecorator
|
import com.intellij.codeInsight.lookup.LookupElementDecorator
|
||||||
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
import com.intellij.codeInsight.lookup.LookupElementPresentation
|
||||||
import org.jetbrains.jet.renderer.DescriptorRenderer
|
import org.jetbrains.jet.renderer.DescriptorRenderer
|
||||||
@@ -95,12 +88,7 @@ class StaticMembers(val bindingContext: BindingContext, val resolveSession: Reso
|
|||||||
collection.addLookupElements(expectedInfos, classifier, { createLookupElement(descriptor, classDescriptor) })
|
collection.addLookupElements(expectedInfos, classifier, { createLookupElement(descriptor, classDescriptor) })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (classDescriptor is JavaClassDescriptor) {
|
classDescriptor.getStaticScope().getAllDescriptors().forEach(::processMember)
|
||||||
val pseudoPackage = classDescriptor.getCorrespondingPackageFragment()
|
|
||||||
if (pseudoPackage != null) {
|
|
||||||
pseudoPackage.getMemberScope().getAllDescriptors().forEach(::processMember)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val classObject = classDescriptor.getClassObjectDescriptor()
|
val classObject = classDescriptor.getClassObjectDescriptor()
|
||||||
if (classObject != null) {
|
if (classObject != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user