Synthetic extensions to take all annotations from original declarations
#KT-9387 Fixed
This commit is contained in:
+2
-3
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
|
||||
import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeAsciiOnly
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeFirstWord
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeSmart
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.util.*
|
||||
@@ -276,7 +275,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : KtScopeImpl
|
||||
descriptor.setType(propertyType, typeParameters, null, receiverType)
|
||||
|
||||
val getter = PropertyGetterDescriptorImpl(descriptor,
|
||||
Annotations.EMPTY,
|
||||
getMethod.annotations,
|
||||
Modality.FINAL,
|
||||
visibility,
|
||||
false,
|
||||
@@ -289,7 +288,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : KtScopeImpl
|
||||
|
||||
val setter = if (setMethod != null)
|
||||
PropertySetterDescriptorImpl(descriptor,
|
||||
Annotations.EMPTY,
|
||||
setMethod.annotations,
|
||||
Modality.FINAL,
|
||||
syntheticExtensionVisibility(setMethod),
|
||||
false,
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ class SamAdapterFunctionsScope(storageManager: StorageManager) : KtScope by KtSc
|
||||
fun create(sourceFunction: FunctionDescriptor): MyFunctionDescriptor {
|
||||
val descriptor = MyFunctionDescriptor(DescriptorUtils.getContainingModule(sourceFunction),
|
||||
null,
|
||||
Annotations.EMPTY, //TODO
|
||||
sourceFunction.annotations,
|
||||
sourceFunction.name,
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED,
|
||||
sourceFunction.source)
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
// FILE: KotlinFile.kt
|
||||
fun foo(javaClass: JavaClass) {
|
||||
javaClass.<!DEPRECATION!>something1<!>
|
||||
|
||||
javaClass.<!DEPRECATION!>something2<!>
|
||||
javaClass.something2 = 1
|
||||
javaClass.something2++
|
||||
|
||||
javaClass.something3
|
||||
javaClass.<!DEPRECATION!>something3<!> = 1
|
||||
javaClass.<!DEPRECATION!>something3<!>++
|
||||
|
||||
javaClass.<!DEPRECATION!>something4<!>
|
||||
javaClass.<!DEPRECATION!>something4<!> = 1
|
||||
javaClass.<!DEPRECATION!>something4<!>++
|
||||
|
||||
javaClass.<!DEPRECATION!>something5<!>
|
||||
javaClass.<!DEPRECATION!>something5<!> = 1
|
||||
javaClass.<!DEPRECATION!>something5<!>++
|
||||
}
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
@Deprecated
|
||||
public int getSomething1() { return 1; }
|
||||
|
||||
@Deprecated
|
||||
public int getSomething2() { return 1; }
|
||||
public void setSomething2(int value) { }
|
||||
|
||||
public int getSomething3() { return 1; }
|
||||
@Deprecated
|
||||
public void setSomething3(int value) { }
|
||||
|
||||
@Deprecated
|
||||
public int getSomething4() { return 1; }
|
||||
@Deprecated
|
||||
public void setSomething4(int value) { }
|
||||
|
||||
/**
|
||||
* @deprecated Bla-bla-bla
|
||||
*/
|
||||
public int getSomething5() { return 1; }
|
||||
/**
|
||||
* @deprecated Ha-ha-ha
|
||||
*/
|
||||
public void setSomething5(int value) { }
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ javaClass: JavaClass): kotlin.Unit
|
||||
|
||||
public open class JavaClass {
|
||||
public constructor JavaClass()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun getSomething1(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun getSomething2(): kotlin.Int
|
||||
public open fun getSomething3(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun getSomething4(): kotlin.Int
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun getSomething5(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setSomething2(/*0*/ value: kotlin.Int): kotlin.Unit
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun setSomething3(/*0*/ value: kotlin.Int): kotlin.Unit
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun setSomething4(/*0*/ value: kotlin.Int): kotlin.Unit
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun setSomething5(/*0*/ value: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: KotlinFile.kt
|
||||
public interface I {
|
||||
public fun doIt()
|
||||
}
|
||||
|
||||
fun foo(javaClass: JavaClass) {
|
||||
javaClass.<!DEPRECATION!>doSomething1<!> { bar() }
|
||||
javaClass.<!DEPRECATION!>doSomething2<!> { bar() }
|
||||
}
|
||||
|
||||
fun bar(){}
|
||||
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
@Deprecated
|
||||
public void doSomething1(Runnable runnable) { runnable.run(); }
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public void doSomething2(Runnable runnable) { runnable.run(); }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
public fun bar(): kotlin.Unit
|
||||
public fun foo(/*0*/ javaClass: JavaClass): kotlin.Unit
|
||||
|
||||
public interface I {
|
||||
public abstract fun doIt(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public open class JavaClass {
|
||||
public constructor JavaClass()
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun doSomething1(/*0*/ runnable: java.lang.Runnable!): kotlin.Unit
|
||||
@kotlin.Deprecated(message = "Deprecated in Java") public open fun doSomething2(/*0*/ runnable: java.lang.Runnable!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -15833,6 +15833,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Deprecated.kt")
|
||||
public void testDeprecated() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/Deprecated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("FalseGetters.kt")
|
||||
public void testFalseGetters() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/FalseGetters.kt");
|
||||
@@ -15986,6 +15992,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("Deprecated.kt")
|
||||
public void testDeprecated() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/Deprecated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("GenericClass.kt")
|
||||
public void testGenericClass() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/syntheticExtensions/samAdapters/GenericClass.kt");
|
||||
|
||||
Reference in New Issue
Block a user