Java 8 rules for method overrides:
- base class method wins against a (default) interface method, so an abstract base class method should always be implemented in a derived class; - interface methods clash regardless of abstract/default with possibly undefined behavior at run-time, so a class or interface should always define its own method for methods inherited from multiple interfaces and not from base class; - meaningful diagnostics for class inheriting conflicting JVM signatures. Since no override will happen under Java 8 rules, ACCIDENTAL_OVERRIDE is misleading for this case; - update testData.
This commit is contained in:
+6
-1
@@ -118,7 +118,12 @@ class BuilderFactoryForDuplicateSignatureDiagnostics(
|
||||
if (elementToReportOn == null) return // TODO: it'd be better to report this error without any element at all
|
||||
|
||||
val data = ConflictingJvmDeclarationsData(classInternalName, classOrigin, rawSignature, origins)
|
||||
diagnostics.report(ErrorsJvm.ACCIDENTAL_OVERRIDE.on(elementToReportOn, data))
|
||||
if (memberElement != null) {
|
||||
diagnostics.report(ErrorsJvm.ACCIDENTAL_OVERRIDE.on(elementToReportOn, data))
|
||||
}
|
||||
else {
|
||||
diagnostics.report(ErrorsJvm.CONFLICTING_INHERITED_JVM_DECLARATIONS.on(elementToReportOn, data))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -45,6 +45,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
|
||||
static {
|
||||
MAP.put(ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
||||
MAP.put(ErrorsJvm.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
||||
MAP.put(ErrorsJvm.CONFLICTING_INHERITED_JVM_DECLARATIONS, "Inherited platform declarations clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
|
||||
MAP.put(ErrorsJvm.JVM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and companion objects of classes can be annotated with 'JvmStatic'");
|
||||
MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be 'JvmStatic' in object");
|
||||
MAP.put(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "''JvmOverloads'' annotation has no effect for methods without default arguments");
|
||||
|
||||
@@ -39,6 +39,8 @@ public interface ErrorsJvm {
|
||||
|
||||
DiagnosticFactory1<PsiElement, ConflictingJvmDeclarationsData> ACCIDENTAL_OVERRIDE =
|
||||
DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
|
||||
DiagnosticFactory1<PsiElement, ConflictingJvmDeclarationsData> CONFLICTING_INHERITED_JVM_DECLARATIONS =
|
||||
DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
|
||||
|
||||
DiagnosticFactory0<JetDeclaration> OVERRIDE_CANNOT_BE_STATIC = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory0<JetDeclaration> JVM_STATIC_NOT_IN_OBJECT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||
|
||||
@@ -309,8 +309,13 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory2<JetClassOrObject, JetClassOrObject, CallableMemberDescriptor> ABSTRACT_MEMBER_NOT_IMPLEMENTED =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory2<JetClassOrObject, JetClassOrObject, CallableMemberDescriptor> ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory2<JetClassOrObject, JetClassOrObject, CallableMemberDescriptor> MANY_IMPL_MEMBER_NOT_IMPLEMENTED =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory2<JetClassOrObject, JetClassOrObject, CallableMemberDescriptor> MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_NAME);
|
||||
|
||||
|
||||
DiagnosticFactory1<JetNamedDeclaration, Collection<JetType>> AMBIGUOUS_ANONYMOUS_TYPE_INFERRED =
|
||||
DiagnosticFactory1.create(ERROR, DECLARATION_SIGNATURE);
|
||||
|
||||
+4
@@ -559,9 +559,13 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(ABSTRACT_MEMBER_NOT_IMPLEMENTED, "{0} must be declared abstract or implement abstract member {1}", RENDER_CLASS_OR_OBJECT,
|
||||
FQ_NAMES_IN_TYPES);
|
||||
MAP.put(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED, "{0} must be declared abstract or implement abstract base class member {1}",
|
||||
RENDER_CLASS_OR_OBJECT, FQ_NAMES_IN_TYPES);
|
||||
|
||||
MAP.put(MANY_IMPL_MEMBER_NOT_IMPLEMENTED, "{0} must override {1} because it inherits many implementations of it",
|
||||
RENDER_CLASS_OR_OBJECT, FQ_NAMES_IN_TYPES);
|
||||
MAP.put(MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED, "{0} must override {1} because it inherits multiple interface methods of it",
|
||||
RENDER_CLASS_OR_OBJECT, FQ_NAMES_IN_TYPES);
|
||||
|
||||
MAP.put(CONFLICTING_OVERLOADS, "''{0}'' is already defined in {1}", COMPACT_WITH_MODIFIERS, STRING);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.LinkedMultiMap;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -34,7 +35,6 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.lexer.JetToken;
|
||||
import org.jetbrains.kotlin.lexer.JetTokens;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -269,32 +269,49 @@ public class OverrideResolver {
|
||||
// More than one implementation or no implementations at all
|
||||
Set<CallableMemberDescriptor> abstractNoImpl = Sets.newLinkedHashSet();
|
||||
Set<CallableMemberDescriptor> manyImpl = Sets.newLinkedHashSet();
|
||||
collectMissingImplementations(classDescriptor, abstractNoImpl, manyImpl);
|
||||
Set<CallableMemberDescriptor> abstractInBaseClassNoImpl = Sets.newLinkedHashSet();
|
||||
Set<CallableMemberDescriptor> conflictingInterfaceOverrides = Sets.newLinkedHashSet();
|
||||
collectMissingImplementations(classDescriptor,
|
||||
abstractNoImpl, manyImpl,
|
||||
abstractInBaseClassNoImpl, conflictingInterfaceOverrides);
|
||||
|
||||
if (!manyImpl.isEmpty()) {
|
||||
trace.report(MANY_IMPL_MEMBER_NOT_IMPLEMENTED.on(klass, klass, manyImpl.iterator().next()));
|
||||
if (!classCanHaveAbstractMembers(classDescriptor)) {
|
||||
if (!abstractInBaseClassNoImpl.isEmpty()) {
|
||||
trace.report(ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED.on(klass, klass, abstractInBaseClassNoImpl.iterator().next()));
|
||||
}
|
||||
else if (!abstractNoImpl.isEmpty()) {
|
||||
trace.report(ABSTRACT_MEMBER_NOT_IMPLEMENTED.on(klass, klass, abstractNoImpl.iterator().next()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!classCanHaveAbstractMembers(classDescriptor) && !abstractNoImpl.isEmpty()) {
|
||||
trace.report(ABSTRACT_MEMBER_NOT_IMPLEMENTED.on(klass, klass, abstractNoImpl.iterator().next()));
|
||||
if (!conflictingInterfaceOverrides.isEmpty()) {
|
||||
trace.report(MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED.on(klass, klass, conflictingInterfaceOverrides.iterator().next()));
|
||||
}
|
||||
else if (!manyImpl.isEmpty()) {
|
||||
trace.report(MANY_IMPL_MEMBER_NOT_IMPLEMENTED.on(klass, klass, manyImpl.iterator().next()));
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Set<CallableMemberDescriptor> getMissingImplementations(@NotNull ClassDescriptor classDescriptor) {
|
||||
Set<CallableMemberDescriptor> result = new LinkedHashSet<CallableMemberDescriptor>();
|
||||
collectMissingImplementations(classDescriptor, result, result);
|
||||
return result;
|
||||
Set<CallableMemberDescriptor> shouldImplement = new LinkedHashSet<CallableMemberDescriptor>();
|
||||
Set<CallableMemberDescriptor> dontCare = new HashSet<CallableMemberDescriptor>();
|
||||
collectMissingImplementations(classDescriptor, shouldImplement, shouldImplement, dontCare, dontCare);
|
||||
return shouldImplement;
|
||||
}
|
||||
|
||||
private static void collectMissingImplementations(
|
||||
@NotNull ClassDescriptor classDescriptor,
|
||||
@NotNull Set<CallableMemberDescriptor> abstractNoImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> manyImpl
|
||||
@NotNull Set<CallableMemberDescriptor> manyImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> abstractInBaseClassNoImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> conflictingInterfaceOverrides
|
||||
) {
|
||||
for (DeclarationDescriptor member : classDescriptor.getDefaultType().getMemberScope().getAllDescriptors()) {
|
||||
if (member instanceof CallableMemberDescriptor) {
|
||||
collectMissingImplementations((CallableMemberDescriptor) member, abstractNoImpl, manyImpl);
|
||||
collectMissingImplementations((CallableMemberDescriptor) member,
|
||||
abstractNoImpl, manyImpl,
|
||||
abstractInBaseClassNoImpl, conflictingInterfaceOverrides);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,14 +319,16 @@ public class OverrideResolver {
|
||||
private static void collectMissingImplementations(
|
||||
@NotNull CallableMemberDescriptor descriptor,
|
||||
@NotNull Set<CallableMemberDescriptor> abstractNoImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> manyImpl
|
||||
@NotNull Set<CallableMemberDescriptor> manyImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> abstractInBaseClassNoImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> conflictingInterfaceOverrides
|
||||
) {
|
||||
if (descriptor.getKind().isReal()) return;
|
||||
if (descriptor.getVisibility() == Visibilities.INVISIBLE_FAKE) return;
|
||||
|
||||
Collection<? extends CallableMemberDescriptor> directOverridden = descriptor.getOverriddenDescriptors();
|
||||
if (directOverridden.size() == 0) {
|
||||
throw new IllegalStateException("A 'fake override' must override something");
|
||||
throw new IllegalStateException("A 'fake override' " + descriptor.getName().asString() + " must override something");
|
||||
}
|
||||
|
||||
// collects map from the directly overridden descriptor to the set of declarations:
|
||||
@@ -324,6 +343,8 @@ public class OverrideResolver {
|
||||
Set<CallableMemberDescriptor> relevantDirectlyOverridden =
|
||||
getRelevantDirectlyOverridden(overriddenDeclarationsByDirectParent, allFilteredOverriddenDeclarations);
|
||||
|
||||
collectJava8MissingOverrides(relevantDirectlyOverridden, abstractInBaseClassNoImpl, conflictingInterfaceOverrides);
|
||||
|
||||
List<CallableMemberDescriptor> implementations = collectImplementations(relevantDirectlyOverridden);
|
||||
if (implementations.size() == 1 && isReturnTypeOkForOverride(descriptor, implementations.get(0))) return;
|
||||
|
||||
@@ -342,6 +363,49 @@ public class OverrideResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private static void collectJava8MissingOverrides(
|
||||
Set<CallableMemberDescriptor> relevantDirectlyOverridden,
|
||||
@NotNull Set<CallableMemberDescriptor> abstractInBaseClassNoImpl,
|
||||
@NotNull Set<CallableMemberDescriptor> conflictingInterfaceOverrides
|
||||
) {
|
||||
// Java 8:
|
||||
// -- class should implement an abstract member of a super-class,
|
||||
// even if relevant default implementation is provided in one of the super-interfaces;
|
||||
// -- inheriting multiple override equivalent methods from an interface is a conflict
|
||||
// regardless of 'default' vs 'abstract'.
|
||||
|
||||
boolean overridesClassMember = false;
|
||||
boolean overridesNonAbstractInterfaceMember = false;
|
||||
CallableMemberDescriptor overridesAbstractInBaseClass = null;
|
||||
List<CallableMemberDescriptor> overriddenInterfaceMembers = new SmartList<CallableMemberDescriptor>();
|
||||
for (CallableMemberDescriptor overridden : relevantDirectlyOverridden) {
|
||||
DeclarationDescriptor containingDeclaration = overridden.getContainingDeclaration();
|
||||
if (containingDeclaration instanceof ClassDescriptor) {
|
||||
ClassDescriptor baseClassOrInterface = (ClassDescriptor) containingDeclaration;
|
||||
if (baseClassOrInterface.getKind() == ClassKind.CLASS) {
|
||||
overridesClassMember = true;
|
||||
if (overridden.getModality() == Modality.ABSTRACT) {
|
||||
overridesAbstractInBaseClass = overridden;
|
||||
}
|
||||
}
|
||||
else if (baseClassOrInterface.getKind() == ClassKind.INTERFACE) {
|
||||
overriddenInterfaceMembers.add(overridden);
|
||||
if (overridden.getModality() != Modality.ABSTRACT) {
|
||||
overridesNonAbstractInterfaceMember = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (overridesAbstractInBaseClass != null) {
|
||||
abstractInBaseClassNoImpl.add(overridesAbstractInBaseClass);
|
||||
}
|
||||
|
||||
if (!overridesClassMember && overridesNonAbstractInterfaceMember && overriddenInterfaceMembers.size() > 1) {
|
||||
conflictingInterfaceOverrides.addAll(overriddenInterfaceMembers);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<CallableMemberDescriptor> collectImplementations(@NotNull Set<CallableMemberDescriptor> relevantDirectlyOverridden) {
|
||||
List<CallableMemberDescriptor> result = new ArrayList<CallableMemberDescriptor>(relevantDirectlyOverridden.size());
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.diagnostics.Errors.*
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory.*
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm
|
||||
|
||||
public fun getJvmSignatureDiagnostics(element: PsiElement, otherDiagnostics: Diagnostics, moduleScope: GlobalSearchScope): Diagnostics? {
|
||||
fun getDiagnosticsForPackage(file: JetFile): Diagnostics? {
|
||||
@@ -86,7 +87,7 @@ class FilteredJvmDiagnostics(val jvmDiagnostics: Diagnostics, val otherDiagnosti
|
||||
}
|
||||
|
||||
override fun forElement(psiElement: PsiElement): Collection<Diagnostic> {
|
||||
val jvmDiagnosticFactories = setOf(CONFLICTING_JVM_DECLARATIONS, ACCIDENTAL_OVERRIDE)
|
||||
val jvmDiagnosticFactories = setOf(CONFLICTING_JVM_DECLARATIONS, ACCIDENTAL_OVERRIDE, CONFLICTING_INHERITED_JVM_DECLARATIONS)
|
||||
fun Diagnostic.data() = cast(this, jvmDiagnosticFactories).getA()
|
||||
val (conflicting, other) = jvmDiagnostics.forElement(psiElement).partition { it.getFactory() in jvmDiagnosticFactories }
|
||||
if (alreadyReported(psiElement)) {
|
||||
@@ -110,9 +111,10 @@ class FilteredJvmDiagnostics(val jvmDiagnostics: Diagnostics, val otherDiagnosti
|
||||
other ->
|
||||
me != other && (
|
||||
// in case of implementation copied from a super trait there will be both diagnostics on the same signature
|
||||
me.getFactory() == ACCIDENTAL_OVERRIDE && other.getFactory() == CONFLICTING_JVM_DECLARATIONS
|
||||
// there are paris of corresponding signatures that frequently clash simultaneously: package facade & part, trait and trait-impl
|
||||
|| other.data() higherThan me.data()
|
||||
other.factory == ErrorsJvm.CONFLICTING_JVM_DECLARATIONS && (me.factory == ACCIDENTAL_OVERRIDE ||
|
||||
me.factory == CONFLICTING_INHERITED_JVM_DECLARATIONS)
|
||||
// there are paris of corresponding signatures that frequently clash simultaneously: package facade & part, trait and trait-impl
|
||||
|| other.data() higherThan me.data()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ interface B {
|
||||
fun foo(): ArrayList<String> = ArrayList(Arrays.asList("B"))
|
||||
}
|
||||
|
||||
open class C : A(), B
|
||||
open class C : A(), B {
|
||||
override fun foo(): ArrayList<String> = super<B>.foo()
|
||||
}
|
||||
|
||||
interface D {
|
||||
fun foo(): Collection<String>
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
interface A<T> {
|
||||
fun foo(t: T): String
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(t: Int) = "B"
|
||||
}
|
||||
|
||||
class Z1 : A<Int>, B
|
||||
|
||||
class Z2 : B, A<Int>
|
||||
|
||||
fun box(): String {
|
||||
val z1 = Z1()
|
||||
val z2 = Z2()
|
||||
val z1a: A<Int> = z1
|
||||
val z1b: B = z1
|
||||
val z2a: A<Int> = z2
|
||||
val z2b: B = z2
|
||||
|
||||
return when {
|
||||
z1.foo( 0) != "B" -> "Fail #1"
|
||||
z1a.foo( 0) != "B" -> "Fail #2"
|
||||
z1b.foo( 0) != "B" -> "Fail #3"
|
||||
z2.foo( 0) != "B" -> "Fail #4"
|
||||
z2a.foo( 0) != "B" -> "Fail #5"
|
||||
z2b.foo( 0) != "B" -> "Fail #6"
|
||||
else -> "OK"
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
interface A<T> {
|
||||
fun foo(t: T): String
|
||||
}
|
||||
|
||||
interface B<T : Number> {
|
||||
fun foo(a: T) = "B"
|
||||
}
|
||||
|
||||
class Z1 : A<Int>, B<Int>
|
||||
|
||||
class Z2 : B<Int>, A<Int>
|
||||
|
||||
fun box(): String {
|
||||
val z1 = Z1()
|
||||
val z2 = Z2()
|
||||
val z1a: A<Int> = z1
|
||||
val z1b: B<Int> = z1
|
||||
val z2a: A<Int> = z2
|
||||
val z2b: B<Int> = z2
|
||||
|
||||
return when {
|
||||
z1.foo( 0) != "B" -> "Fail #1"
|
||||
z1a.foo( 0) != "B" -> "Fail #2"
|
||||
z1b.foo( 0) != "B" -> "Fail #3"
|
||||
z2.foo( 0) != "B" -> "Fail #4"
|
||||
z2a.foo( 0) != "B" -> "Fail #5"
|
||||
z2b.foo( 0) != "B" -> "Fail #6"
|
||||
else -> "OK"
|
||||
}
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
var result = ""
|
||||
|
||||
interface A {
|
||||
var foo: String
|
||||
get() = result
|
||||
set(value) {
|
||||
result += value
|
||||
}
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
abstract var foo: Any
|
||||
}
|
||||
|
||||
class C : A, B()
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
c.foo = "1"
|
||||
val b: B = c
|
||||
val a: A = c
|
||||
b.foo = "2"
|
||||
a.foo = "3"
|
||||
return if (result == "123") "OK" else "Fail: $result"
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
interface A {
|
||||
fun foo(): String = "A"
|
||||
}
|
||||
|
||||
interface B {
|
||||
fun foo(): Any
|
||||
}
|
||||
|
||||
class C : A, B
|
||||
|
||||
fun box(): String {
|
||||
val c = C()
|
||||
var result = ""
|
||||
val b: B = c
|
||||
val a: A = c
|
||||
result += c.foo()
|
||||
result += b.foo()
|
||||
result += a.foo()
|
||||
return if (result == "AAA") "OK" else "Fail: $result"
|
||||
}
|
||||
@@ -9,6 +9,8 @@ class B0 : Collection<String>, A0 {
|
||||
override fun contains(o: String) = throw UnsupportedOperationException()
|
||||
override fun iterator() = throw UnsupportedOperationException()
|
||||
override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException()
|
||||
override val size: Int
|
||||
get() = super.size
|
||||
}
|
||||
|
||||
open class A1 {
|
||||
@@ -45,6 +47,8 @@ class B4 : Collection<String>, I4<Int> {
|
||||
override fun contains(o: String) = throw UnsupportedOperationException()
|
||||
override fun iterator() = throw UnsupportedOperationException()
|
||||
override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException()
|
||||
override val size: Int
|
||||
get() = super.size
|
||||
}
|
||||
|
||||
interface I5 : Collection<String> {
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ interface B {
|
||||
get() = "FAIL"
|
||||
}
|
||||
|
||||
abstract class C {
|
||||
abstract protected val c: String
|
||||
open class C {
|
||||
private val c: String = "FAIL"
|
||||
}
|
||||
|
||||
open class D: C(), A, B {
|
||||
|
||||
+3
-1
@@ -6,7 +6,9 @@ interface B {
|
||||
fun foo(): String = "OK"
|
||||
}
|
||||
|
||||
interface C : A, B
|
||||
interface C : A, B {
|
||||
override fun foo(): String = super<B>.foo()
|
||||
}
|
||||
|
||||
// There's no 'foo' in A$DefaultImpls, proguard and other tools may fail if we generate calls to it
|
||||
// 0 INVOKESTATIC A\$DefaultImpls.foo
|
||||
|
||||
+5
-1
@@ -11,4 +11,8 @@ interface KotlinTrait {
|
||||
public fun foo(someOtherName: Int) {}
|
||||
}
|
||||
|
||||
class BothTraitsSubclass : JavaInterface, KotlinTrait
|
||||
class BothTraitsSubclass : JavaInterface, KotlinTrait {
|
||||
override fun foo(someOtherName: Int) {
|
||||
super.foo(someOtherName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,17 +14,17 @@ abstract class D(): A() {
|
||||
override val i : Int = 34
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class C<!>() : D() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class C<!>() : D() {
|
||||
fun test() {
|
||||
super.i
|
||||
}
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
override fun foo(): Int {
|
||||
super.<!ABSTRACT_SUPER_CALL!>i<!>
|
||||
|
||||
super.fff() //everything is ok
|
||||
return super.<!ABSTRACT_SUPER_CALL!>foo<!>() //no error!!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ open <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Br<!>(<!UNUSED_PARAMETER!>t<!> : T
|
||||
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Br3<!>(t : T) : Br(t) {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class Br3<!>(t : T) : Br(t) {
|
||||
|
||||
}
|
||||
|
||||
@@ -35,4 +35,4 @@ open class GC1(g : G<Int>) : G<Int> by g {
|
||||
|
||||
open class GC2(g : G<Int>) : GC1(g) {
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -14,6 +14,6 @@ interface TwoImpl : Two {
|
||||
public override fun foo() = 2
|
||||
}
|
||||
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test1<!>() : TwoImpl, OneImpl {}
|
||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class Test1<!>() : TwoImpl, OneImpl {}
|
||||
class Test2(a : One) : One by a, Two {}
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class Test3<!>(a : One, b : Two) : Two by b, One by a {}
|
||||
@@ -11,8 +11,8 @@ public abstract class B implements A {
|
||||
|
||||
// FILE: C.kt
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class C<!> : B()
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class C<!> : B()
|
||||
|
||||
fun main() {
|
||||
C().a
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
abstract class ALeft {
|
||||
abstract fun foo()
|
||||
}
|
||||
|
||||
interface IRight {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class CDerived<!> : ALeft(), IRight
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public abstract class ALeft {
|
||||
public constructor ALeft()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CDerived : ALeft, IRight {
|
||||
public constructor CDerived()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface IRight {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
interface ILeft {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
interface IRight {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
interface IDerived : ILeft, IRight
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class CDerived<!> : ILeft, IRight
|
||||
|
||||
abstract class ADerived : ILeft, IRight
|
||||
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
public abstract class ADerived : ILeft, IRight {
|
||||
public constructor ADerived()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CDerived : ILeft, IRight {
|
||||
public constructor CDerived()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface IDerived : ILeft, IRight {
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface ILeft {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface IRight {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
interface ILeft {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface IRight {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>interface IDerived<!> : ILeft, IRight
|
||||
|
||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class CDerived<!> : ILeft, IRight
|
||||
|
||||
abstract <!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class ADerived<!> : ILeft, IRight
|
||||
@@ -0,0 +1,38 @@
|
||||
package
|
||||
|
||||
public abstract class ADerived : ILeft, IRight {
|
||||
public constructor ADerived()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class CDerived : ILeft, IRight {
|
||||
public constructor CDerived()
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface IDerived : ILeft, IRight {
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface ILeft {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface IRight {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
interface ITop {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
interface ILeft : ITop
|
||||
|
||||
interface IRight : ITop
|
||||
|
||||
interface IDerived : ILeft, IRight
|
||||
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public interface IDerived : ILeft, IRight {
|
||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*2*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*2*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface ILeft : ITop {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface IRight : ITop {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface ITop {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -22,7 +22,7 @@ abstract class C {
|
||||
}
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>object D<!> : C() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>object D<!> : C() {
|
||||
<!INCOMPATIBLE_MODIFIERS!>override<!> <!INCOMPATIBLE_MODIFIERS!>const<!> val x: Int = 9
|
||||
|
||||
const val inObject = 10
|
||||
|
||||
@@ -2,5 +2,5 @@ abstract class A {
|
||||
abstract fun foo(): Int
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
}
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
}
|
||||
@@ -2,5 +2,5 @@ abstract class A {
|
||||
abstract val i: Int
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ abstract class A {
|
||||
abstract var i: Int
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class B<!>() : A() {
|
||||
}
|
||||
|
||||
@@ -40,15 +40,15 @@ abstract class MyAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {
|
||||
override fun bar(t: String) = t
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalGenericClass1<!><T> : MyTrait<T>, MyAbstractClass<T>() {}
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalGenericClass2<!><T, R>(r : R) : MyTrait<T>, MyAbstractClass<R>() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalGenericClass1<!><T> : MyTrait<T>, MyAbstractClass<T>() {}
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalGenericClass2<!><T, R>(r : R) : MyTrait<T>, MyAbstractClass<R>() {
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun foo(r: R) = r
|
||||
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> val <T> pr : R<!> = r
|
||||
}
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass1<!> : MyTrait<Int>, MyAbstractClass<String>() {}
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass1<!> : MyTrait<Int>, MyAbstractClass<String>() {}
|
||||
abstract class MyLegalAbstractClass1 : MyTrait<Int>, MyAbstractClass<String>() {}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass2<!><T>(t : T) : MyTrait<Int>, MyAbstractClass<Int>() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass2<!><T>(t : T) : MyTrait<Int>, MyAbstractClass<Int>() {
|
||||
fun foo(t: T) = t
|
||||
fun bar(t: T) = t
|
||||
<!CONFLICTING_OVERLOADS!>val <R> pr : T<!> = t
|
||||
|
||||
@@ -21,9 +21,9 @@ open class MyClass() : MyTrait, MyAbstractClass() {
|
||||
|
||||
class MyChildClass() : MyClass() {}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass<!> : MyTrait, MyAbstractClass() {}
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass<!> : MyTrait, MyAbstractClass() {}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass2<!>() : MyTrait, MyAbstractClass() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass2<!>() : MyTrait, MyAbstractClass() {
|
||||
override fun foo() {}
|
||||
override val pr : Unit = Unit
|
||||
override val prr : Unit = Unit
|
||||
@@ -35,7 +35,7 @@ class MyChildClass() : MyClass() {}
|
||||
override val prr : Unit = Unit
|
||||
}
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass4<!>() : MyTrait, MyAbstractClass() {
|
||||
<!ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED!>class MyIllegalClass4<!>() : MyTrait, MyAbstractClass() {
|
||||
<!VIRTUAL_MEMBER_HIDDEN!>fun foo()<!> {}
|
||||
<!VIRTUAL_MEMBER_HIDDEN, MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>val pr : Unit<!>
|
||||
<!NOTHING_TO_OVERRIDE!>override<!> fun other() {}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ interface B {
|
||||
fun foo() = 2
|
||||
}
|
||||
|
||||
open <!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class C<!> : A, B {}
|
||||
open <!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class C<!> : A, B {}
|
||||
|
||||
interface E {
|
||||
fun foo(): Int
|
||||
|
||||
Vendored
+1
-1
@@ -10,4 +10,4 @@ interface KotlinTrait {
|
||||
public fun foo(someOtherName: Int) {}
|
||||
}
|
||||
|
||||
class BothTraitsSubclass : JavaInterface, KotlinTrait
|
||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class BothTraitsSubclass<!> : JavaInterface, KotlinTrait
|
||||
+2
-2
@@ -22,7 +22,7 @@ public interface B {
|
||||
<!ACCIDENTAL_OVERRIDE!>override fun foo(x: String?)<!> {}
|
||||
}
|
||||
|
||||
interface <!ACCIDENTAL_OVERRIDE!>I<!> : A, B
|
||||
interface <!CONFLICTING_INHERITED_JVM_DECLARATIONS!>I<!> : A, B
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class C3<!> : I {
|
||||
<!ACCIDENTAL_OVERRIDE!>override fun foo(x: String)<!> {}
|
||||
@@ -30,4 +30,4 @@ interface <!ACCIDENTAL_OVERRIDE!>I<!> : A, B
|
||||
|
||||
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class C4<!> : I {
|
||||
<!ACCIDENTAL_OVERRIDE!>override fun foo(x: String?)<!> {}
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@ interface B {
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
<!MANY_IMPL_MEMBER_NOT_IMPLEMENTED!>class C<!> : A, B {} //should be error here
|
||||
<!MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class C<!> : A, B {} //should be error here
|
||||
@@ -9184,6 +9184,60 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/jdk-annotations")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Jdk_annotations extends AbstractJetDiagnosticsTest {
|
||||
public void testAllFilesPresentInJdk_annotations() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/jdk-annotations"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayListAndMap.kt")
|
||||
public void testArrayListAndMap() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/ArrayListAndMap.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayListClone.kt")
|
||||
public void testArrayListClone() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/ArrayListClone.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ArrayListToArray.kt")
|
||||
public void testArrayListToArray() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/ArrayListToArray.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Sql extends AbstractJetDiagnosticsTest {
|
||||
public void testAllFilesPresentInSql() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/jdk-annotations/sql"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("DriverManager.kt")
|
||||
public void testDriverManager() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql/DriverManager.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ResultSet.kt")
|
||||
public void testResultSet() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql/ResultSet.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("Statement.kt")
|
||||
public void testStatement() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql/Statement.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/labels")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
-24
@@ -454,18 +454,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeGenericContravariantOverride1.kt")
|
||||
public void testFakeGenericContravariantOverride1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeGenericContravariantOverride2.kt")
|
||||
public void testFakeGenericContravariantOverride2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeGenericCovariantOverride.kt")
|
||||
public void testFakeGenericCovariantOverride() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
|
||||
@@ -478,24 +466,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideOfPropertySetterInTraitImpl.kt")
|
||||
public void testFakeOverrideOfPropertySetterInTraitImpl() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideOfTraitImpl.kt")
|
||||
public void testFakeOverrideOfTraitImpl() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideWithImplementationInTrait.kt")
|
||||
public void testFakeOverrideWithImplementationInTrait() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideWithSeveralSuperDeclarations.kt")
|
||||
public void testFakeOverrideWithSeveralSuperDeclarations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt");
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !DIAGNOSTICS_NUMBER: 1
|
||||
// !DIAGNOSTICS: ABSTRACT_MEMBER_NOT_IMPLEMENTED
|
||||
// !DIAGNOSTICS: ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED
|
||||
// !MESSAGE_TYPE: TEXT
|
||||
|
||||
interface T1
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- abstractBaseClassMemberNotImplemented1 -->
|
||||
Class 'E' must be declared abstract or implement abstract base class member public abstract fun f(): T4 defined in D
|
||||
@@ -1,2 +0,0 @@
|
||||
<!-- wrongReturnTypeInImplementation1 -->
|
||||
Class 'E' must be declared abstract or implement abstract member public abstract fun f(): T3 defined in C
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
// "class org.jetbrains.kotlin.idea.quickfix.RemoveFunctionParametersFix" "false"
|
||||
//ERROR: No value passed for parameter other
|
||||
|
||||
interface StringComparable {
|
||||
abstract class StringComparable {
|
||||
public fun compareTo(other: String): Int = 0
|
||||
}
|
||||
|
||||
class X: Comparable<String>, StringComparable
|
||||
class X: Comparable<String>, StringComparable()
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
X().compareTo(<caret>)
|
||||
|
||||
+6
-6
@@ -31,6 +31,12 @@ import java.util.regex.Pattern;
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTest {
|
||||
@TestMetadata("abstractBaseClassMemberNotImplemented.kt")
|
||||
public void testAbstractBaseClassMemberNotImplemented() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/abstractBaseClassMemberNotImplemented.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInDiagnosticMessage() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/diagnosticMessage"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
@@ -202,10 +208,4 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/upperBoundViolated.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("wrongReturnTypeInImplementation.kt")
|
||||
public void testWrongReturnTypeInImplementation() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/diagnosticMessage/wrongReturnTypeInImplementation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,18 +77,6 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeGenericContravariantOverride1.kt")
|
||||
public void testFakeGenericContravariantOverride1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride1.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeGenericContravariantOverride2.kt")
|
||||
public void testFakeGenericContravariantOverride2() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericContravariantOverride2.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeGenericCovariantOverride.kt")
|
||||
public void testFakeGenericCovariantOverride() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeGenericCovariantOverride.kt");
|
||||
@@ -101,24 +89,12 @@ public class BridgeTestGenerated extends AbstractBridgeTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideOfPropertySetterInTraitImpl.kt")
|
||||
public void testFakeOverrideOfPropertySetterInTraitImpl() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfPropertySetterInTraitImpl.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideOfTraitImpl.kt")
|
||||
public void testFakeOverrideOfTraitImpl() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideOfTraitImpl.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideWithImplementationInTrait.kt")
|
||||
public void testFakeOverrideWithImplementationInTrait() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideWithImplementationInTrait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("fakeOverrideWithSeveralSuperDeclarations.kt")
|
||||
public void testFakeOverrideWithSeveralSuperDeclarations() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/bridges/fakeOverrideWithSeveralSuperDeclarations.kt");
|
||||
|
||||
Reference in New Issue
Block a user