Java 8 rules for method overrides:
- report errors on implementing methods of Any in interfaces - update testData ~~~ Java 8 override restrictions: interface can't implement a method of 'Any' - update compiler sources
This commit is contained in:
@@ -33,8 +33,6 @@ public interface OutputFile {
|
|||||||
public val sourceFiles: List<File>
|
public val sourceFiles: List<File>
|
||||||
public fun asByteArray(): ByteArray
|
public fun asByteArray(): ByteArray
|
||||||
public fun asText(): String
|
public fun asText(): String
|
||||||
|
|
||||||
override fun toString() = "$relativePath (compiled from $sourceFiles)"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SimpleOutputFile(
|
public class SimpleOutputFile(
|
||||||
@@ -44,4 +42,6 @@ public class SimpleOutputFile(
|
|||||||
) : OutputFile {
|
) : OutputFile {
|
||||||
override fun asByteArray(): ByteArray = content.toByteArray()
|
override fun asByteArray(): ByteArray = content.toByteArray()
|
||||||
override fun asText(): String = content
|
override fun asText(): String = content
|
||||||
|
|
||||||
|
override fun toString() = "$relativePath (compiled from $sourceFiles)"
|
||||||
}
|
}
|
||||||
@@ -217,6 +217,7 @@ public interface Errors {
|
|||||||
.create(WARNING, ABSTRACT_MODIFIER);
|
.create(WARNING, ABSTRACT_MODIFIER);
|
||||||
|
|
||||||
DiagnosticFactory0<JetDeclaration> CONSTRUCTOR_IN_TRAIT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
DiagnosticFactory0<JetDeclaration> CONSTRUCTOR_IN_TRAIT = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
|
||||||
|
DiagnosticFactory0<JetDeclaration> METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE = DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
DiagnosticFactory0<PsiElement> SUPERTYPE_INITIALIZED_IN_TRAIT = DiagnosticFactory0.create(ERROR);
|
DiagnosticFactory0<PsiElement> SUPERTYPE_INITIALIZED_IN_TRAIT = DiagnosticFactory0.create(ERROR);
|
||||||
|
|
||||||
|
|||||||
+1
@@ -439,6 +439,7 @@ public class DefaultErrorMessages {
|
|||||||
MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Interfaces cannot initialize supertypes");
|
MAP.put(SUPERTYPE_INITIALIZED_IN_TRAIT, "Interfaces cannot initialize supertypes");
|
||||||
MAP.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes");
|
MAP.put(CLASS_IN_SUPERTYPE_FOR_ENUM, "Enum class cannot inherit from classes");
|
||||||
MAP.put(CONSTRUCTOR_IN_TRAIT, "An interface may not have a constructor");
|
MAP.put(CONSTRUCTOR_IN_TRAIT, "An interface may not have a constructor");
|
||||||
|
MAP.put(METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE, "An interface may not implement a method of 'kotlin.Any'");
|
||||||
MAP.put(TRAIT_WITH_SUPERCLASS, "An interface cannot inherit from a class");
|
MAP.put(TRAIT_WITH_SUPERCLASS, "An interface cannot inherit from a class");
|
||||||
MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice");
|
MAP.put(SUPERTYPE_APPEARS_TWICE, "A supertype appears twice");
|
||||||
MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from");
|
MAP.put(FINAL_SUPERTYPE, "This type is final, so it cannot be inherited from");
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.resolve;
|
package org.jetbrains.kotlin.resolve;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
@@ -288,7 +289,8 @@ public class DeclarationsChecker {
|
|||||||
checkTypeParameterConstraints(aClass);
|
checkTypeParameterConstraints(aClass);
|
||||||
|
|
||||||
if (aClass.isInterface()) {
|
if (aClass.isInterface()) {
|
||||||
checkConstructorInTrait(aClass);
|
checkConstructorInInterface(aClass);
|
||||||
|
checkMethodsOfAnyInInterface(classDescriptor);
|
||||||
if (aClass.isLocal() && !(classDescriptor.getContainingDeclaration() instanceof ClassDescriptor)) {
|
if (aClass.isLocal() && !(classDescriptor.getContainingDeclaration() instanceof ClassDescriptor)) {
|
||||||
trace.report(LOCAL_INTERFACE_NOT_ALLOWED.on(aClass, classDescriptor));
|
trace.report(LOCAL_INTERFACE_NOT_ALLOWED.on(aClass, classDescriptor));
|
||||||
}
|
}
|
||||||
@@ -367,13 +369,71 @@ public class DeclarationsChecker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkConstructorInTrait(JetClass klass) {
|
private void checkConstructorInInterface(JetClass klass) {
|
||||||
JetPrimaryConstructor primaryConstructor = klass.getPrimaryConstructor();
|
JetPrimaryConstructor primaryConstructor = klass.getPrimaryConstructor();
|
||||||
if (primaryConstructor != null) {
|
if (primaryConstructor != null) {
|
||||||
trace.report(CONSTRUCTOR_IN_TRAIT.on(primaryConstructor));
|
trace.report(CONSTRUCTOR_IN_TRAIT.on(primaryConstructor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkMethodsOfAnyInInterface(ClassDescriptorWithResolutionScopes classDescriptor) {
|
||||||
|
for (CallableMemberDescriptor declaredCallableMember : classDescriptor.getDeclaredCallableMembers()) {
|
||||||
|
if (!(declaredCallableMember instanceof FunctionDescriptor)) continue;
|
||||||
|
FunctionDescriptor functionDescriptor = (FunctionDescriptor) declaredCallableMember;
|
||||||
|
|
||||||
|
PsiElement declaration = DescriptorToSourceUtils.descriptorToDeclaration(functionDescriptor);
|
||||||
|
if (!(declaration instanceof JetNamedFunction)) continue;
|
||||||
|
JetNamedFunction functionDeclaration = (JetNamedFunction) declaration;
|
||||||
|
|
||||||
|
if (isHidingParentMemberIfPresent(declaredCallableMember)) continue;
|
||||||
|
|
||||||
|
if (isImplementingMethodOfAny(declaredCallableMember)) {
|
||||||
|
trace.report(METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE.on(functionDeclaration));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Set<String> METHOD_OF_ANY_NAMES = ImmutableSet.of("toString", "hashCode", "equals");
|
||||||
|
|
||||||
|
private static boolean isImplementingMethodOfAny(CallableMemberDescriptor member) {
|
||||||
|
if (!METHOD_OF_ANY_NAMES.contains(member.getName().asString())) return false;
|
||||||
|
if (member.getModality() == Modality.ABSTRACT) return false;
|
||||||
|
|
||||||
|
return isImplementingMethodOfAnyInternal(member, new HashSet<ClassDescriptor>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isImplementingMethodOfAnyInternal(CallableMemberDescriptor member, Set<ClassDescriptor> visitedClasses) {
|
||||||
|
for (CallableMemberDescriptor overridden : member.getOverriddenDescriptors()) {
|
||||||
|
DeclarationDescriptor containingDeclaration = overridden.getContainingDeclaration();
|
||||||
|
if (!(containingDeclaration instanceof ClassDescriptor)) continue;
|
||||||
|
ClassDescriptor containingClass = (ClassDescriptor) containingDeclaration;
|
||||||
|
if (visitedClasses.contains(containingClass)) continue;
|
||||||
|
|
||||||
|
if (DescriptorUtils.getFqName(containingClass).equals(KotlinBuiltIns.FQ_NAMES.any)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isHidingParentMemberIfPresent(overridden)) continue;
|
||||||
|
|
||||||
|
visitedClasses.add(containingClass);
|
||||||
|
|
||||||
|
if (isImplementingMethodOfAnyInternal(overridden, visitedClasses)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isHidingParentMemberIfPresent(CallableMemberDescriptor member) {
|
||||||
|
JetNamedDeclaration declaration = (JetNamedDeclaration) DescriptorToSourceUtils.descriptorToDeclaration(member);
|
||||||
|
if (declaration != null) {
|
||||||
|
JetModifierList modifierList = declaration.getModifierList();
|
||||||
|
return modifierList == null || !modifierList.hasModifier(JetTokens.OVERRIDE_KEYWORD);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void checkAnnotationClassWithBody(JetClassOrObject classOrObject) {
|
private void checkAnnotationClassWithBody(JetClassOrObject classOrObject) {
|
||||||
if (classOrObject.getBody() != null) {
|
if (classOrObject.getBody() != null) {
|
||||||
trace.report(ANNOTATION_CLASS_WITH_BODY.on(classOrObject.getBody()));
|
trace.report(ANNOTATION_CLASS_WITH_BODY.on(classOrObject.getBody()));
|
||||||
|
|||||||
+7
-4
@@ -1,12 +1,15 @@
|
|||||||
interface Trait {
|
interface Trait {
|
||||||
fun foo() = "O"
|
fun foo() = "O"
|
||||||
override fun toString() = "K"
|
fun bar(): String
|
||||||
}
|
}
|
||||||
|
|
||||||
class SimpleClass : Trait
|
class SimpleClass : Trait {
|
||||||
|
override fun bar() = "K"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delegating 'toString' doesn't work, see KT-9519
|
||||||
class ComplexClass : Trait by SimpleClass() {
|
class ComplexClass : Trait by SimpleClass() {
|
||||||
override fun toString() = foo() + super.toString()
|
fun qux() = foo() + bar()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box() = ComplexClass().toString()
|
fun box() = ComplexClass().qux()
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ interface IWithToString {
|
|||||||
override fun toString(): String
|
override fun toString(): String
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IWithDefaultToString {
|
|
||||||
override fun toString(): String = "I"
|
|
||||||
}
|
|
||||||
|
|
||||||
class C1 : ClassWithToString(), ISomething {
|
class C1 : ClassWithToString(), ISomething {
|
||||||
override fun toString(): String = super.toString()
|
override fun toString(): String = super.toString()
|
||||||
}
|
}
|
||||||
@@ -20,15 +16,10 @@ class C2 : ClassWithToString(), IWithToString, ISomething {
|
|||||||
override fun toString(): String = super.toString()
|
override fun toString(): String = super.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
class C3 : IWithDefaultToString, ISomething {
|
|
||||||
override fun toString(): String = super.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return when {
|
return when {
|
||||||
C1().toString() != "C" -> "Failed #1"
|
C1().toString() != "C" -> "Failed #1"
|
||||||
C2().toString() != "C" -> "Failed #2"
|
C2().toString() != "C" -> "Failed #2"
|
||||||
C3().toString() != "I" -> "Failed #3"
|
|
||||||
else -> "OK"
|
else -> "OK"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
interface A {
|
|
||||||
override fun toString(): String {
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface B : A
|
|
||||||
|
|
||||||
class C : B {
|
|
||||||
override fun toString(): String {
|
|
||||||
return super.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box() = "${C()}"
|
|
||||||
@@ -3,8 +3,8 @@ package builders
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
|
|
||||||
interface Element {
|
abstract class Element {
|
||||||
fun render(builder: StringBuilder, indent: String)
|
abstract fun render(builder: StringBuilder, indent: String)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
@@ -13,13 +13,13 @@ interface Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextElement(val text: String) : Element {
|
class TextElement(val text: String) : Element() {
|
||||||
override fun render(builder: StringBuilder, indent: String) {
|
override fun render(builder: StringBuilder, indent: String) {
|
||||||
builder.append("$indent$text\n")
|
builder.append("$indent$text\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Tag(val name: String) : Element {
|
abstract class Tag(val name: String) : Element() {
|
||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
val attributes = HashMap<String, String>()
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -3,8 +3,8 @@ package builders
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
|
|
||||||
interface Element {
|
abstract class Element {
|
||||||
fun render(builder: StringBuilder, indent: String)
|
abstract fun render(builder: StringBuilder, indent: String)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
@@ -13,13 +13,13 @@ interface Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextElement(val text: String) : Element {
|
class TextElement(val text: String) : Element() {
|
||||||
override fun render(builder: StringBuilder, indent: String) {
|
override fun render(builder: StringBuilder, indent: String) {
|
||||||
builder.append("$indent$text\n")
|
builder.append("$indent$text\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Tag(val name: String) : Element {
|
abstract class Tag(val name: String) : Element() {
|
||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
val attributes = HashMap<String, String>()
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
interface SuperTrait {
|
abstract class SuperTrait {
|
||||||
override fun toString(): String = "!"
|
override fun toString(): String = "!"
|
||||||
}
|
}
|
||||||
|
|
||||||
data class A(val x: Int): SuperTrait {
|
data class A(val x: Int): SuperTrait() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+4
-4
@@ -49,8 +49,8 @@ fun main(args : Array<String>) {
|
|||||||
println(result)
|
println(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Element {
|
abstract class Element {
|
||||||
fun render(builder : StringBuilder, indent : String)
|
abstract fun render(builder : StringBuilder, indent : String)
|
||||||
|
|
||||||
override fun toString() : String {
|
override fun toString() : String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
@@ -59,13 +59,13 @@ interface Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextElement(val text : String) : Element {
|
class TextElement(val text : String) : Element() {
|
||||||
override fun render(builder : StringBuilder, indent : String) {
|
override fun render(builder : StringBuilder, indent : String) {
|
||||||
builder.append("$indent$text\n")
|
builder.append("$indent$text\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Tag(val name : String) : Element {
|
abstract class Tag(val name : String) : Element() {
|
||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
val attributes = HashMap<String, String>()
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -84,7 +84,8 @@ package html {
|
|||||||
public final override /*1*/ /*fake_override*/ fun kotlin.String.plus(): kotlin.Unit
|
public final override /*1*/ /*fake_override*/ fun kotlin.String.plus(): kotlin.Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface Element {
|
public abstract class Element {
|
||||||
|
public constructor Element()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
public abstract fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: kotlin.String): kotlin.Unit
|
public abstract fun render(/*0*/ builder: java.lang.StringBuilder, /*1*/ indent: kotlin.String): kotlin.Unit
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
interface IA {
|
||||||
|
<!VIRTUAL_MEMBER_HIDDEN!>fun toString(): String<!> = "IB"
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface IA {
|
||||||
|
public abstract override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
interface IA {
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IA"<!>
|
||||||
|
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun equals(other: Any?): Boolean = <!SUPERCLASS_NOT_ACCESSIBLE_FROM_TRAIT!>super<!>.equals(other)<!>
|
||||||
|
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun hashCode(): Int {
|
||||||
|
return 42;
|
||||||
|
}<!>
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface IA {
|
||||||
|
public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
interface IC {
|
||||||
|
fun toString(x: String): String = "IC$x"
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public interface IC {
|
||||||
|
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 fun toString(/*0*/ x: kotlin.String): kotlin.String
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
interface IA
|
||||||
|
|
||||||
|
interface IB : IA {
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IB"<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IC : IB {
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IC"<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ID : IC {
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "ID"<!>
|
||||||
|
}
|
||||||
+14
-9
@@ -1,19 +1,24 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
public interface A {
|
public interface IA {
|
||||||
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*/ fun toString(): kotlin.String
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface B : A {
|
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class C : B {
|
public interface IB : IA {
|
||||||
public constructor C()
|
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*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IC : IB {
|
||||||
|
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*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ID : IC {
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
public open override /*1*/ fun toString(): kotlin.String
|
public open override /*1*/ fun toString(): kotlin.String
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
interface ILeft {
|
||||||
|
override fun toString(): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IRight {
|
||||||
|
override fun toString(): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IDiamond : ILeft, IRight {
|
||||||
|
<!METHOD_OF_ANY_IMPLEMENTED_IN_INTERFACE!>override fun toString(): String = "IDiamond"<!>
|
||||||
|
}
|
||||||
+5
-6
@@ -1,20 +1,19 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
public final class C : IA, IB {
|
public interface IDiamond : ILeft, IRight {
|
||||||
public constructor C()
|
|
||||||
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*2*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*2*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*2*/ fun toString(): kotlin.String
|
public open override /*2*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IA {
|
public interface ILeft {
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
public open override /*1*/ fun toString(): kotlin.String
|
public abstract override /*1*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IB {
|
public interface IRight {
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
public open override /*1*/ fun toString(): kotlin.String
|
public abstract override /*1*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
Vendored
-12
@@ -1,12 +0,0 @@
|
|||||||
interface IA {
|
|
||||||
override fun toString(): String = "IA"
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IB {
|
|
||||||
override fun toString(): String = "IB"
|
|
||||||
}
|
|
||||||
|
|
||||||
class C : IA, IB {
|
|
||||||
override fun toString(): String =
|
|
||||||
<!AMBIGUOUS_SUPER!>super<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>toString<!>()
|
|
||||||
}
|
|
||||||
-12
@@ -1,12 +0,0 @@
|
|||||||
interface A {
|
|
||||||
override fun toString(): String {
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface B : A
|
|
||||||
|
|
||||||
class C : B {
|
|
||||||
override fun toString(): String =
|
|
||||||
super.toString()
|
|
||||||
}
|
|
||||||
-8
@@ -6,11 +6,3 @@ class A : IWithToString {
|
|||||||
// Should be Any#toString(), even though IWithToString defines an abstract toString.
|
// Should be Any#toString(), even though IWithToString defines an abstract toString.
|
||||||
override fun toString(): String = super.toString()
|
override fun toString(): String = super.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IWithImplementedToString {
|
|
||||||
override fun toString(): String = "Heh"
|
|
||||||
}
|
|
||||||
|
|
||||||
class B : IWithImplementedToString {
|
|
||||||
override fun toString(): String = super.toString()
|
|
||||||
}
|
|
||||||
|
|||||||
-13
@@ -7,19 +7,6 @@ public final class A : IWithToString {
|
|||||||
public open override /*1*/ fun toString(): kotlin.String
|
public open override /*1*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class B : IWithImplementedToString {
|
|
||||||
public constructor B()
|
|
||||||
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*/ fun toString(): kotlin.String
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IWithImplementedToString {
|
|
||||||
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*/ fun toString(): kotlin.String
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IWithToString {
|
public interface IWithToString {
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
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 hashCode(): kotlin.Int
|
||||||
|
|||||||
@@ -9184,57 +9184,66 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/jdk-annotations")
|
@TestMetadata("compiler/testData/diagnostics/tests/java8Overrides")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
public static class Jdk_annotations extends AbstractJetDiagnosticsTest {
|
public static class Java8Overrides extends AbstractJetDiagnosticsTest {
|
||||||
public void testAllFilesPresentInJdk_annotations() throws Exception {
|
@TestMetadata("abstractBaseClassMemberNotImplemented.kt")
|
||||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/jdk-annotations"), Pattern.compile("^(.+)\\.kt$"), true);
|
public void testAbstractBaseClassMemberNotImplemented() throws Exception {
|
||||||
}
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/abstractBaseClassMemberNotImplemented.kt");
|
||||||
|
|
||||||
@TestMetadata("ArrayListAndMap.kt")
|
|
||||||
public void testArrayListAndMap() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/ArrayListAndMap.kt");
|
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ArrayListClone.kt")
|
@TestMetadata("abstractVsAbstract.kt")
|
||||||
public void testArrayListClone() throws Exception {
|
public void testAbstractVsAbstract() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/ArrayListClone.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/abstractVsAbstract.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ArrayListToArray.kt")
|
public void testAllFilesPresentInJava8Overrides() throws Exception {
|
||||||
public void testArrayListToArray() throws Exception {
|
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/java8Overrides"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/ArrayListToArray.kt");
|
}
|
||||||
|
|
||||||
|
@TestMetadata("defaultVsAbstract.kt")
|
||||||
|
public void testDefaultVsAbstract() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/defaultVsAbstract.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql")
|
@TestMetadata("hidingMethodOfAny.kt")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
public void testHidingMethodOfAny() throws Exception {
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/hidingMethodOfAny.kt");
|
||||||
public static class Sql extends AbstractJetDiagnosticsTest {
|
doTest(fileName);
|
||||||
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")
|
@TestMetadata("implementingMethodOfAny.kt")
|
||||||
public void testDriverManager() throws Exception {
|
public void testImplementingMethodOfAny() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql/DriverManager.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/implementingMethodOfAny.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("ResultSet.kt")
|
@TestMetadata("notAMethodOfAny.kt")
|
||||||
public void testResultSet() throws Exception {
|
public void testNotAMethodOfAny() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql/ResultSet.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/notAMethodOfAny.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Statement.kt")
|
@TestMetadata("overridingMethodOfAnyChain.kt")
|
||||||
public void testStatement() throws Exception {
|
public void testOverridingMethodOfAnyChain() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/jdk-annotations/sql/Statement.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/overridingMethodOfAnyChain.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("overridingMethodOfAnyDiamond.kt")
|
||||||
|
public void testOverridingMethodOfAnyDiamond() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/overridingMethodOfAnyDiamond.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("singleRelevantDefault.kt")
|
||||||
|
public void testSingleRelevantDefault() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/java8Overrides/singleRelevantDefault.kt");
|
||||||
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15668,18 +15677,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("withAmbiguousMethodOfAny.kt")
|
|
||||||
public void testWithAmbiguousMethodOfAny() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/withAmbiguousMethodOfAny.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("withMethodOfAnyImplementedInSuperInterface.kt")
|
|
||||||
public void testWithMethodOfAnyImplementedInSuperInterface() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/withMethodOfAnyImplementedInSuperInterface.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("withMethodOfAnyOverridenInInterface.kt")
|
@TestMetadata("withMethodOfAnyOverridenInInterface.kt")
|
||||||
public void testWithMethodOfAnyOverridenInInterface() throws Exception {
|
public void testWithMethodOfAnyOverridenInInterface() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/withMethodOfAnyOverridenInInterface.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/thisAndSuper/unqualifiedSuper/withMethodOfAnyOverridenInInterface.kt");
|
||||||
|
|||||||
-6
@@ -7540,12 +7540,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5393_toString.kt")
|
|
||||||
public void testKt5393_toString() throws Exception {
|
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/kt5393_toString.kt");
|
|
||||||
doTest(fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("multiple.kt")
|
@TestMetadata("multiple.kt")
|
||||||
public void testMultiple() throws Exception {
|
public void testMultiple() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/multiple.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/traits/multiple.kt");
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ public class SamConstructorDescriptor(
|
|||||||
samInterface.getSource()
|
samInterface.getSource()
|
||||||
)
|
)
|
||||||
|
|
||||||
public object SamConstructorDescriptorKindExclude : DescriptorKindExclude {
|
public object SamConstructorDescriptorKindExclude : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor) = descriptor is SamConstructorDescriptor
|
override fun excludes(descriptor: DeclarationDescriptor) = descriptor is SamConstructorDescriptor
|
||||||
|
|
||||||
override val fullyExcludedDescriptorKinds: Int get() = 0
|
override val fullyExcludedDescriptorKinds: Int get() = 0
|
||||||
|
|||||||
@@ -211,21 +211,21 @@ public class DescriptorKindFilter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface DescriptorKindExclude {
|
public abstract class DescriptorKindExclude {
|
||||||
public fun excludes(descriptor: DeclarationDescriptor): Boolean
|
public abstract fun excludes(descriptor: DeclarationDescriptor): Boolean
|
||||||
|
|
||||||
public val fullyExcludedDescriptorKinds: Int
|
public abstract val fullyExcludedDescriptorKinds: Int
|
||||||
|
|
||||||
override fun toString() = this.javaClass.getSimpleName()
|
override fun toString() = this.javaClass.getSimpleName()
|
||||||
|
|
||||||
public object Extensions : DescriptorKindExclude {
|
public object Extensions : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor)
|
override fun excludes(descriptor: DeclarationDescriptor)
|
||||||
= descriptor is CallableDescriptor && descriptor.getExtensionReceiverParameter() != null
|
= descriptor is CallableDescriptor && descriptor.getExtensionReceiverParameter() != null
|
||||||
|
|
||||||
override val fullyExcludedDescriptorKinds: Int get() = 0
|
override val fullyExcludedDescriptorKinds: Int get() = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public object NonExtensions : DescriptorKindExclude {
|
public object NonExtensions : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor)
|
override fun excludes(descriptor: DeclarationDescriptor)
|
||||||
= descriptor !is CallableDescriptor || descriptor.getExtensionReceiverParameter() == null
|
= descriptor !is CallableDescriptor || descriptor.getExtensionReceiverParameter() == null
|
||||||
|
|
||||||
@@ -233,14 +233,14 @@ public interface DescriptorKindExclude {
|
|||||||
get() = DescriptorKindFilter.ALL_KINDS_MASK and (DescriptorKindFilter.FUNCTIONS_MASK or DescriptorKindFilter.VARIABLES_MASK).inv()
|
get() = DescriptorKindFilter.ALL_KINDS_MASK and (DescriptorKindFilter.FUNCTIONS_MASK or DescriptorKindFilter.VARIABLES_MASK).inv()
|
||||||
}
|
}
|
||||||
|
|
||||||
public object EnumEntry : DescriptorKindExclude {
|
public object EnumEntry : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor)
|
override fun excludes(descriptor: DeclarationDescriptor)
|
||||||
= descriptor is ClassDescriptor && descriptor.getKind() == ClassKind.ENUM_ENTRY
|
= descriptor is ClassDescriptor && descriptor.getKind() == ClassKind.ENUM_ENTRY
|
||||||
|
|
||||||
override val fullyExcludedDescriptorKinds: Int get() = 0
|
override val fullyExcludedDescriptorKinds: Int get() = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public object TopLevelPackages : DescriptorKindExclude {
|
public object TopLevelPackages : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor): Boolean {
|
override fun excludes(descriptor: DeclarationDescriptor): Boolean {
|
||||||
val fqName = when (descriptor) {
|
val fqName = when (descriptor) {
|
||||||
is PackageFragmentDescriptor -> descriptor.fqName
|
is PackageFragmentDescriptor -> descriptor.fqName
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public sealed class CallType<TReceiver : JetElement?>(val descriptorKindFilter:
|
|||||||
|
|
||||||
object TYPE : CallType<JetExpression?>(DescriptorKindFilter(DescriptorKindFilter.CLASSIFIERS_MASK or DescriptorKindFilter.PACKAGES_MASK))
|
object TYPE : CallType<JetExpression?>(DescriptorKindFilter(DescriptorKindFilter.CLASSIFIERS_MASK or DescriptorKindFilter.PACKAGES_MASK))
|
||||||
|
|
||||||
private object NonInfixExclude : DescriptorKindExclude {
|
private object NonInfixExclude : DescriptorKindExclude() {
|
||||||
//TODO: check 'infix' modifier
|
//TODO: check 'infix' modifier
|
||||||
override fun excludes(descriptor: DeclarationDescriptor) =
|
override fun excludes(descriptor: DeclarationDescriptor) =
|
||||||
!(descriptor is SimpleFunctionDescriptor && descriptor.valueParameters.size() == 1)
|
!(descriptor is SimpleFunctionDescriptor && descriptor.valueParameters.size() == 1)
|
||||||
@@ -65,7 +65,7 @@ public sealed class CallType<TReceiver : JetElement?>(val descriptorKindFilter:
|
|||||||
get() = 0
|
get() = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
private object NonOperatorExclude : DescriptorKindExclude {
|
private object NonOperatorExclude : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor) =
|
override fun excludes(descriptor: DeclarationDescriptor) =
|
||||||
!(descriptor is SimpleFunctionDescriptor && descriptor.isOperator)
|
!(descriptor is SimpleFunctionDescriptor && descriptor.isOperator)
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ public sealed class CallType<TReceiver : JetElement?>(val descriptorKindFilter:
|
|||||||
get() = 0
|
get() = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
private object CallableReferenceExclude : DescriptorKindExclude {
|
private object CallableReferenceExclude : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor) /* currently not supported for locals, synthetic and genetic */
|
override fun excludes(descriptor: DeclarationDescriptor) /* currently not supported for locals, synthetic and genetic */
|
||||||
= descriptor !is CallableMemberDescriptor || descriptor.kind == CallableMemberDescriptor.Kind.SYNTHESIZED || descriptor.typeParameters.isNotEmpty()
|
= descriptor !is CallableMemberDescriptor || descriptor.kind == CallableMemberDescriptor.Kind.SYNTHESIZED || descriptor.typeParameters.isNotEmpty()
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -397,7 +397,7 @@ class BasicCompletionSession(configuration: CompletionSessionConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
object NonAnnotationClassifierExclude : DescriptorKindExclude {
|
object NonAnnotationClassifierExclude : DescriptorKindExclude() {
|
||||||
override fun excludes(descriptor: DeclarationDescriptor): Boolean {
|
override fun excludes(descriptor: DeclarationDescriptor): Boolean {
|
||||||
if (descriptor !is ClassifierDescriptor) return false
|
if (descriptor !is ClassifierDescriptor) return false
|
||||||
return descriptor !is ClassDescriptor || descriptor.getKind() != ClassKind.ANNOTATION_CLASS
|
return descriptor !is ClassDescriptor || descriptor.getKind() != ClassKind.ANNOTATION_CLASS
|
||||||
|
|||||||
@@ -40,7 +40,9 @@ interface CallInfo {
|
|||||||
val extensionReceiver: JsExpression?
|
val extensionReceiver: JsExpression?
|
||||||
|
|
||||||
fun constructSafeCallIsNeeded(result: JsExpression): JsExpression
|
fun constructSafeCallIsNeeded(result: JsExpression): JsExpression
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class AbstractCallInfo : CallInfo {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val location = DiagnosticUtils.atLocation(callableDescriptor)
|
val location = DiagnosticUtils.atLocation(callableDescriptor)
|
||||||
val name = callableDescriptor.getName().asString()
|
val name = callableDescriptor.getName().asString()
|
||||||
@@ -49,9 +51,9 @@ interface CallInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if value == null, it is get access
|
// if value == null, it is get access
|
||||||
class VariableAccessInfo(callInfo: CallInfo, val value: JsExpression? = null) : CallInfo by callInfo
|
class VariableAccessInfo(callInfo: CallInfo, val value: JsExpression? = null) : AbstractCallInfo(), CallInfo by callInfo
|
||||||
|
|
||||||
class FunctionCallInfo(callInfo: CallInfo, val argumentsInfo: CallArgumentTranslator.ArgumentsInfo) : CallInfo by callInfo
|
class FunctionCallInfo(callInfo: CallInfo, val argumentsInfo: CallArgumentTranslator.ArgumentsInfo) : AbstractCallInfo(), CallInfo by callInfo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* no receivers - extensionOrDispatchReceiver = null, extensionReceiver = null
|
* no receivers - extensionOrDispatchReceiver = null, extensionReceiver = null
|
||||||
@@ -146,7 +148,7 @@ private fun TranslationContext.createCallInfo(resolvedCall: ResolvedCall<out Cal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return object : CallInfo {
|
return object : AbstractCallInfo(), CallInfo {
|
||||||
override val context: TranslationContext = this@createCallInfo
|
override val context: TranslationContext = this@createCallInfo
|
||||||
override val resolvedCall: ResolvedCall<out CallableDescriptor> = resolvedCall
|
override val resolvedCall: ResolvedCall<out CallableDescriptor> = resolvedCall
|
||||||
override val dispatchReceiver: JsExpression? = dispatchReceiver
|
override val dispatchReceiver: JsExpression? = dispatchReceiver
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ package foo
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
|
|
||||||
interface Element {
|
abstract class Element {
|
||||||
fun render(builder: StringBuilder, indent: String)
|
abstract fun render(builder: StringBuilder, indent: String)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
@@ -18,13 +18,13 @@ interface Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextElement(val text: String) : Element {
|
class TextElement(val text: String) : Element() {
|
||||||
override fun render(builder: StringBuilder, indent: String) {
|
override fun render(builder: StringBuilder, indent: String) {
|
||||||
builder.append("$indent$text\n")
|
builder.append("$indent$text\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Tag(val name: String) : Element {
|
abstract class Tag(val name: String) : Element() {
|
||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
val attributes = HashMap<String, String>()
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -8,8 +8,8 @@ package foo
|
|||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
|
|
||||||
interface Element {
|
abstract class Element {
|
||||||
fun render(builder: StringBuilder, indent: String)
|
abstract fun render(builder: StringBuilder, indent: String)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
@@ -18,13 +18,13 @@ interface Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextElement(val text: String) : Element {
|
class TextElement(val text: String) : Element() {
|
||||||
override fun render(builder: StringBuilder, indent: String) {
|
override fun render(builder: StringBuilder, indent: String) {
|
||||||
builder.append("$indent$text\n")
|
builder.append("$indent$text\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Tag(val name: String) : Element {
|
abstract class Tag(val name: String) : Element() {
|
||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
val attributes = HashMap<String, String>()
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ fun main(args: Array<String>) {
|
|||||||
println(result)
|
println(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Element {
|
abstract class Element {
|
||||||
fun render(builder: StringBuilder, indent: String)
|
abstract fun render(builder: StringBuilder, indent: String)
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
val builder = StringBuilder()
|
val builder = StringBuilder()
|
||||||
@@ -55,13 +55,13 @@ interface Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextElement(val text: String) : Element {
|
class TextElement(val text: String) : Element() {
|
||||||
override fun render(builder: StringBuilder, indent: String) {
|
override fun render(builder: StringBuilder, indent: String) {
|
||||||
builder.append("$indent$text\n")
|
builder.append("$indent$text\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class Tag(val name: String) : Element {
|
abstract class Tag(val name: String) : Element() {
|
||||||
val children = ArrayList<Element>()
|
val children = ArrayList<Element>()
|
||||||
val attributes = HashMap<String, String>()
|
val attributes = HashMap<String, String>()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user