Serialization of star projections fixed
This commit is contained in:
@@ -99,7 +99,9 @@ public class ForceResolveUtil {
|
|||||||
else {
|
else {
|
||||||
forceResolveAllContents(type.getConstructor());
|
forceResolveAllContents(type.getConstructor());
|
||||||
for (TypeProjection projection : type.getArguments()) {
|
for (TypeProjection projection : type.getArguments()) {
|
||||||
forceResolveAllContents(projection.getType());
|
if (!projection.isStarProjection()) {
|
||||||
|
forceResolveAllContents(projection.getType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
trait Rec<R, out T: Rec<R, T>> {
|
||||||
|
fun t(): T
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Super {
|
||||||
|
fun foo(p: Rec<*, *>) = p.t()
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import a.*
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
val declaredMethod = javaClass<Super>().getDeclaredMethod("foo", javaClass<Rec<*, *>>())
|
||||||
|
val genericString = declaredMethod.toGenericString()
|
||||||
|
if (genericString != "public abstract a.Rec<?, ?> a.Super.foo(a.Rec<?, ?>)") throw AssertionError(genericString)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test(s: Super, p: Rec<*, *>) {
|
||||||
|
s.foo(p).t().t().t()
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
//ALLOW_AST_ACCESS
|
||||||
|
package test
|
||||||
|
|
||||||
|
trait Rec<R, out T: Rec<R, T>> {
|
||||||
|
fun t(): T
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Super {
|
||||||
|
fun foo(p: Rec<*, *>) = p.t()
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
internal trait Rec</*0*/ R, /*1*/ out T : test.Rec<R, T>> {
|
||||||
|
internal abstract fun t(): T
|
||||||
|
}
|
||||||
|
|
||||||
|
internal trait Super {
|
||||||
|
internal open fun foo(/*0*/ p: test.Rec<*, *>): test.Rec<*, *>
|
||||||
|
}
|
||||||
+6
@@ -150,6 +150,12 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RecursiveGeneric.A.kt")
|
||||||
|
public void testRecursiveGeneric() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/RecursiveGeneric.A.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("Simple.A.kt")
|
@TestMetadata("Simple.A.kt")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/Simple.A.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/Simple.A.kt");
|
||||||
|
|||||||
@@ -2492,6 +2492,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
doTestCompiledKotlin(fileName);
|
doTestCompiledKotlin(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RecursiveGeneric.kt")
|
||||||
|
public void testRecursiveGeneric() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/RecursiveGeneric.kt");
|
||||||
|
doTestCompiledKotlin(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SingleAbstractMethod.kt")
|
@TestMetadata("SingleAbstractMethod.kt")
|
||||||
public void testSingleAbstractMethod() throws Exception {
|
public void testSingleAbstractMethod() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
|
||||||
|
|||||||
+24
@@ -642,6 +642,12 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RecursiveGeneric.kt")
|
||||||
|
public void testRecursiveGeneric() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/RecursiveGeneric.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SingleAbstractMethod.kt")
|
@TestMetadata("SingleAbstractMethod.kt")
|
||||||
public void testSingleAbstractMethod() throws Exception {
|
public void testSingleAbstractMethod() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
|
||||||
@@ -4066,6 +4072,24 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RawSuperTypeWithBound.java")
|
||||||
|
public void testRawSuperTypeWithBound() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RawSuperTypeWithRecursiveBound.java")
|
||||||
|
public void testRawSuperTypeWithRecursiveBound() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RawSuperTypeWithRecursiveBoundMultipleParameters.java")
|
||||||
|
public void testRawSuperTypeWithRecursiveBoundMultipleParameters() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("ReturnInnerSubclassOfSupersInner.java")
|
@TestMetadata("ReturnInnerSubclassOfSupersInner.java")
|
||||||
public void testReturnInnerSubclassOfSupersInner() throws Exception {
|
public void testReturnInnerSubclassOfSupersInner() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation/ReturnInnerSubclassOfSupersInner.java");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledJava/signaturePropagation/ReturnInnerSubclassOfSupersInner.java");
|
||||||
|
|||||||
@@ -6226,17 +6226,17 @@ public final class DebugProtoBuf {
|
|||||||
*/
|
*/
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Argument.Projection getProjection();
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Argument.Projection getProjection();
|
||||||
|
|
||||||
// required .org.jetbrains.kotlin.serialization.Type type = 2;
|
// optional .org.jetbrains.kotlin.serialization.Type type = 2;
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
boolean hasType();
|
boolean hasType();
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getType();
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getType();
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getTypeOrBuilder();
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getTypeOrBuilder();
|
||||||
}
|
}
|
||||||
@@ -6471,23 +6471,23 @@ public final class DebugProtoBuf {
|
|||||||
return projection_;
|
return projection_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required .org.jetbrains.kotlin.serialization.Type type = 2;
|
// optional .org.jetbrains.kotlin.serialization.Type type = 2;
|
||||||
public static final int TYPE_FIELD_NUMBER = 2;
|
public static final int TYPE_FIELD_NUMBER = 2;
|
||||||
private org.jetbrains.kotlin.serialization.DebugProtoBuf.Type type_;
|
private org.jetbrains.kotlin.serialization.DebugProtoBuf.Type type_;
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public boolean hasType() {
|
public boolean hasType() {
|
||||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getType() {
|
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getType() {
|
||||||
return type_;
|
return type_;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getTypeOrBuilder() {
|
public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getTypeOrBuilder() {
|
||||||
return type_;
|
return type_;
|
||||||
@@ -6502,13 +6502,11 @@ public final class DebugProtoBuf {
|
|||||||
byte isInitialized = memoizedIsInitialized;
|
byte isInitialized = memoizedIsInitialized;
|
||||||
if (isInitialized != -1) return isInitialized == 1;
|
if (isInitialized != -1) return isInitialized == 1;
|
||||||
|
|
||||||
if (!hasType()) {
|
if (hasType()) {
|
||||||
memoizedIsInitialized = 0;
|
if (!getType().isInitialized()) {
|
||||||
return false;
|
memoizedIsInitialized = 0;
|
||||||
}
|
return false;
|
||||||
if (!getType().isInitialized()) {
|
}
|
||||||
memoizedIsInitialized = 0;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
memoizedIsInitialized = 1;
|
memoizedIsInitialized = 1;
|
||||||
return true;
|
return true;
|
||||||
@@ -6732,13 +6730,11 @@ public final class DebugProtoBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isInitialized() {
|
public final boolean isInitialized() {
|
||||||
if (!hasType()) {
|
if (hasType()) {
|
||||||
|
if (!getType().isInitialized()) {
|
||||||
return false;
|
|
||||||
}
|
return false;
|
||||||
if (!getType().isInitialized()) {
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -6798,18 +6794,18 @@ public final class DebugProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required .org.jetbrains.kotlin.serialization.Type type = 2;
|
// optional .org.jetbrains.kotlin.serialization.Type type = 2;
|
||||||
private org.jetbrains.kotlin.serialization.DebugProtoBuf.Type type_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
|
private org.jetbrains.kotlin.serialization.DebugProtoBuf.Type type_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
|
||||||
private com.google.protobuf.SingleFieldBuilder<
|
private com.google.protobuf.SingleFieldBuilder<
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder> typeBuilder_;
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder> typeBuilder_;
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public boolean hasType() {
|
public boolean hasType() {
|
||||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getType() {
|
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type getType() {
|
||||||
if (typeBuilder_ == null) {
|
if (typeBuilder_ == null) {
|
||||||
@@ -6819,7 +6815,7 @@ public final class DebugProtoBuf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder setType(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type value) {
|
public Builder setType(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type value) {
|
||||||
if (typeBuilder_ == null) {
|
if (typeBuilder_ == null) {
|
||||||
@@ -6835,7 +6831,7 @@ public final class DebugProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder setType(
|
public Builder setType(
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder builderForValue) {
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder builderForValue) {
|
||||||
@@ -6849,7 +6845,7 @@ public final class DebugProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder mergeType(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type value) {
|
public Builder mergeType(org.jetbrains.kotlin.serialization.DebugProtoBuf.Type value) {
|
||||||
if (typeBuilder_ == null) {
|
if (typeBuilder_ == null) {
|
||||||
@@ -6868,7 +6864,7 @@ public final class DebugProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder clearType() {
|
public Builder clearType() {
|
||||||
if (typeBuilder_ == null) {
|
if (typeBuilder_ == null) {
|
||||||
@@ -6881,7 +6877,7 @@ public final class DebugProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder getTypeBuilder() {
|
public org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder getTypeBuilder() {
|
||||||
bitField0_ |= 0x00000002;
|
bitField0_ |= 0x00000002;
|
||||||
@@ -6889,7 +6885,7 @@ public final class DebugProtoBuf {
|
|||||||
return getTypeFieldBuilder().getBuilder();
|
return getTypeFieldBuilder().getBuilder();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getTypeOrBuilder() {
|
public org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder getTypeOrBuilder() {
|
||||||
if (typeBuilder_ != null) {
|
if (typeBuilder_ != null) {
|
||||||
@@ -6899,7 +6895,7 @@ public final class DebugProtoBuf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
private com.google.protobuf.SingleFieldBuilder<
|
private com.google.protobuf.SingleFieldBuilder<
|
||||||
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder>
|
org.jetbrains.kotlin.serialization.DebugProtoBuf.Type, org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.kotlin.serialization.DebugProtoBuf.TypeOrBuilder>
|
||||||
@@ -16960,7 +16956,7 @@ public final class DebugProtoBuf {
|
|||||||
"\n\016TYPE_PARAMETER\020\001\032\313\001\n\010Argument\022U\n\nproje" +
|
"\n\016TYPE_PARAMETER\020\001\032\313\001\n\010Argument\022U\n\nproje" +
|
||||||
"ction\030\001 \001(\0162<.org.jetbrains.kotlin.seria" +
|
"ction\030\001 \001(\0162<.org.jetbrains.kotlin.seria" +
|
||||||
"lization.Type.Argument.Projection:\003INV\0226" +
|
"lization.Type.Argument.Projection:\003INV\0226" +
|
||||||
"\n\004type\030\002 \002(\0132(.org.jetbrains.kotlin.seri" +
|
"\n\004type\030\002 \001(\0132(.org.jetbrains.kotlin.seri" +
|
||||||
"alization.Type\"0\n\nProjection\022\006\n\002IN\020\000\022\007\n\003" +
|
"alization.Type\"0\n\nProjection\022\006\n\002IN\020\000\022\007\n\003" +
|
||||||
"OUT\020\001\022\007\n\003INV\020\002\022\010\n\004STAR\020\003\"\371\001\n\rTypeParamet" +
|
"OUT\020\001\022\007\n\003INV\020\002\022\010\n\004STAR\020\003\"\371\001\n\rTypeParamet" +
|
||||||
"er\022\n\n\002id\030\001 \002(\005\022\014\n\004name\030\002 \002(\005\022\026\n\007reified\030" +
|
"er\022\n\n\002id\030\001 \002(\005\022\014\n\004name\030\002 \002(\005\022\026\n\007reified\030" +
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ message Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
optional Projection projection = 1 [default = INV];
|
optional Projection projection = 1 [default = INV];
|
||||||
required Type type = 2;
|
optional Type type = 2; // when projection is STAR, no type is written, otherwise type must be specified
|
||||||
}
|
}
|
||||||
|
|
||||||
repeated Argument argument = 2;
|
repeated Argument argument = 2;
|
||||||
|
|||||||
@@ -350,9 +350,9 @@ public class DescriptorSerializer {
|
|||||||
if (projection != ProtoBuf.Type.Argument.Projection.INV) {
|
if (projection != ProtoBuf.Type.Argument.Projection.INV) {
|
||||||
builder.setProjection(projection);
|
builder.setProjection(projection);
|
||||||
}
|
}
|
||||||
|
builder.setType(type(typeProjection.getType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setType(type(typeProjection.getType()));
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5004,13 +5004,13 @@ public final class ProtoBuf {
|
|||||||
*/
|
*/
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Type.Argument.Projection getProjection();
|
org.jetbrains.kotlin.serialization.ProtoBuf.Type.Argument.Projection getProjection();
|
||||||
|
|
||||||
// required .org.jetbrains.kotlin.serialization.Type type = 2;
|
// optional .org.jetbrains.kotlin.serialization.Type type = 2;
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
boolean hasType();
|
boolean hasType();
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Type getType();
|
org.jetbrains.kotlin.serialization.ProtoBuf.Type getType();
|
||||||
}
|
}
|
||||||
@@ -5196,17 +5196,17 @@ public final class ProtoBuf {
|
|||||||
return projection_;
|
return projection_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required .org.jetbrains.kotlin.serialization.Type type = 2;
|
// optional .org.jetbrains.kotlin.serialization.Type type = 2;
|
||||||
public static final int TYPE_FIELD_NUMBER = 2;
|
public static final int TYPE_FIELD_NUMBER = 2;
|
||||||
private org.jetbrains.kotlin.serialization.ProtoBuf.Type type_;
|
private org.jetbrains.kotlin.serialization.ProtoBuf.Type type_;
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public boolean hasType() {
|
public boolean hasType() {
|
||||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.ProtoBuf.Type getType() {
|
public org.jetbrains.kotlin.serialization.ProtoBuf.Type getType() {
|
||||||
return type_;
|
return type_;
|
||||||
@@ -5221,13 +5221,11 @@ public final class ProtoBuf {
|
|||||||
byte isInitialized = memoizedIsInitialized;
|
byte isInitialized = memoizedIsInitialized;
|
||||||
if (isInitialized != -1) return isInitialized == 1;
|
if (isInitialized != -1) return isInitialized == 1;
|
||||||
|
|
||||||
if (!hasType()) {
|
if (hasType()) {
|
||||||
memoizedIsInitialized = 0;
|
if (!getType().isInitialized()) {
|
||||||
return false;
|
memoizedIsInitialized = 0;
|
||||||
}
|
return false;
|
||||||
if (!getType().isInitialized()) {
|
}
|
||||||
memoizedIsInitialized = 0;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
memoizedIsInitialized = 1;
|
memoizedIsInitialized = 1;
|
||||||
return true;
|
return true;
|
||||||
@@ -5400,13 +5398,11 @@ public final class ProtoBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isInitialized() {
|
public final boolean isInitialized() {
|
||||||
if (!hasType()) {
|
if (hasType()) {
|
||||||
|
if (!getType().isInitialized()) {
|
||||||
return false;
|
|
||||||
}
|
return false;
|
||||||
if (!getType().isInitialized()) {
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -5466,22 +5462,22 @@ public final class ProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// required .org.jetbrains.kotlin.serialization.Type type = 2;
|
// optional .org.jetbrains.kotlin.serialization.Type type = 2;
|
||||||
private org.jetbrains.kotlin.serialization.ProtoBuf.Type type_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
|
private org.jetbrains.kotlin.serialization.ProtoBuf.Type type_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public boolean hasType() {
|
public boolean hasType() {
|
||||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public org.jetbrains.kotlin.serialization.ProtoBuf.Type getType() {
|
public org.jetbrains.kotlin.serialization.ProtoBuf.Type getType() {
|
||||||
return type_;
|
return type_;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder setType(org.jetbrains.kotlin.serialization.ProtoBuf.Type value) {
|
public Builder setType(org.jetbrains.kotlin.serialization.ProtoBuf.Type value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@@ -5493,7 +5489,7 @@ public final class ProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder setType(
|
public Builder setType(
|
||||||
org.jetbrains.kotlin.serialization.ProtoBuf.Type.Builder builderForValue) {
|
org.jetbrains.kotlin.serialization.ProtoBuf.Type.Builder builderForValue) {
|
||||||
@@ -5503,7 +5499,7 @@ public final class ProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder mergeType(org.jetbrains.kotlin.serialization.ProtoBuf.Type value) {
|
public Builder mergeType(org.jetbrains.kotlin.serialization.ProtoBuf.Type value) {
|
||||||
if (((bitField0_ & 0x00000002) == 0x00000002) &&
|
if (((bitField0_ & 0x00000002) == 0x00000002) &&
|
||||||
@@ -5518,7 +5514,7 @@ public final class ProtoBuf {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <code>required .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
* <code>optional .org.jetbrains.kotlin.serialization.Type type = 2;</code>
|
||||||
*/
|
*/
|
||||||
public Builder clearType() {
|
public Builder clearType() {
|
||||||
type_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
|
type_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
|
||||||
|
|||||||
+12
-2
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
import org.jetbrains.kotlin.resolve.scopes.JetScope
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
|
import org.jetbrains.kotlin.utils.toReadOnlyList
|
||||||
|
|
||||||
class DeserializedType(
|
class DeserializedType(
|
||||||
c: DeserializationContext,
|
c: DeserializationContext,
|
||||||
@@ -33,7 +34,12 @@ class DeserializedType(
|
|||||||
typeDeserializer.typeConstructor(typeProto)
|
typeDeserializer.typeConstructor(typeProto)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val arguments = typeDeserializer.typeArguments(typeProto.getArgumentList())
|
private val arguments = c.storageManager.createLazyValue {
|
||||||
|
typeProto.getArgumentList().mapIndexed {
|
||||||
|
index, proto ->
|
||||||
|
typeDeserializer.typeArgument(getConstructor().getParameters().getOrNull(index), proto)
|
||||||
|
}.toReadOnlyList()
|
||||||
|
}
|
||||||
|
|
||||||
private val memberScope = c.storageManager.createLazyValue {
|
private val memberScope = c.storageManager.createLazyValue {
|
||||||
computeMemberScope()
|
computeMemberScope()
|
||||||
@@ -41,7 +47,7 @@ class DeserializedType(
|
|||||||
|
|
||||||
override fun getConstructor(): TypeConstructor = constructor()
|
override fun getConstructor(): TypeConstructor = constructor()
|
||||||
|
|
||||||
override fun getArguments(): List<TypeProjection> = arguments
|
override fun getArguments(): List<TypeProjection> = arguments()
|
||||||
|
|
||||||
override fun isMarkedNullable(): Boolean = typeProto.getNullable()
|
override fun isMarkedNullable(): Boolean = typeProto.getNullable()
|
||||||
|
|
||||||
@@ -70,4 +76,8 @@ class DeserializedType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getAnnotations(): Annotations = Annotations.EMPTY
|
override fun getAnnotations(): Annotations = Annotations.EMPTY
|
||||||
|
|
||||||
|
private fun <E: Any> List<E>.getOrNull(index: Int): E? {
|
||||||
|
return if (index in indices) this[index] else null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-7
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.serialization.deserialization
|
package org.jetbrains.kotlin.serialization.deserialization
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||||
@@ -99,13 +100,14 @@ public class TypeDeserializer(
|
|||||||
return c.components.moduleDescriptor.findClassAcrossModuleDependencies(id)
|
return c.components.moduleDescriptor.findClassAcrossModuleDependencies(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun typeArguments(protos: List<ProtoBuf.Type.Argument>): List<TypeProjection> =
|
fun typeArgument(parameter: TypeParameterDescriptor?, typeArgumentProto: ProtoBuf.Type.Argument): TypeProjection {
|
||||||
protos.map { proto ->
|
return if (typeArgumentProto.getProjection() == ProtoBuf.Type.Argument.Projection.STAR)
|
||||||
val type = type(proto.getType())
|
if (parameter == null)
|
||||||
if (proto.getProjection() == ProtoBuf.Type.Argument.Projection.STAR)
|
TypeBasedStarProjectionImpl(KotlinBuiltIns.getInstance().getNullableAnyType())
|
||||||
TypeBasedStarProjectionImpl(type)
|
else
|
||||||
else TypeProjectionImpl(variance(proto.getProjection()), type)
|
StarProjectionImpl(parameter)
|
||||||
}.toReadOnlyList()
|
else TypeProjectionImpl(variance(typeArgumentProto.getProjection()), type(typeArgumentProto.getType()))
|
||||||
|
}
|
||||||
|
|
||||||
override fun toString() = debugName + (if (parent == null) "" else ". Child of ${parent.debugName}")
|
override fun toString() = debugName + (if (parent == null) "" else ". Child of ${parent.debugName}")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -636,6 +636,12 @@ public class ResolveByStubTestGenerated extends AbstractResolveByStubTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("RecursiveGeneric.kt")
|
||||||
|
public void testRecursiveGeneric() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/RecursiveGeneric.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SingleAbstractMethod.kt")
|
@TestMetadata("SingleAbstractMethod.kt")
|
||||||
public void testSingleAbstractMethod() throws Exception {
|
public void testSingleAbstractMethod() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/class/SingleAbstractMethod.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user