Added check for incompatible variance modifiers and repeated modifiers

This commit is contained in:
Svetlana Isakova
2014-12-19 17:37:22 +03:00
parent d2becce1ac
commit 7b09e85717
38 changed files with 310 additions and 79 deletions
@@ -26,7 +26,6 @@ import org.jetbrains.jet.lang.descriptors.ClassKind
import org.jetbrains.jet.lang.resolve.java.diagnostics.ErrorsJvm
import org.jetbrains.jet.lexer.JetTokens
import org.jetbrains.jet.lang.psi.JetProperty
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor
import org.jetbrains.jet.lang.diagnostics.DiagnosticSink
import org.jetbrains.jet.lang.descriptors.Visibilities
import org.jetbrains.jet.lang.resolve.annotations.hasInlineAnnotation
@@ -40,6 +39,8 @@ import org.jetbrains.jet.lang.resolve.DescriptorToSourceUtils
import org.jetbrains.jet.lang.psi.JetTypeParameter
import org.jetbrains.jet.lang.resolve.annotations.hasIntrinsicAnnotation
import org.jetbrains.jet.lang.resolve.kotlin.nativeDeclarations.NativeFunChecker
import org.jetbrains.jet.lang.psi.JetPropertyAccessor
import org.jetbrains.jet.lang.descriptors.MemberDescriptor
public object JavaDeclarationCheckerProvider : AdditionalCheckerProvider {
@@ -64,49 +65,30 @@ public class PlatformStaticAnnotationChecker : AnnotationChecker {
override fun check(declaration: JetDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink) {
if (descriptor.hasPlatformStaticAnnotation()) {
if (declaration is JetNamedFunction || declaration is JetProperty) {
checkDeclaration(declaration, descriptor, diagnosticHolder, declaration)
if (declaration is JetNamedFunction || declaration is JetProperty || declaration is JetPropertyAccessor) {
checkDeclaration(declaration, descriptor, diagnosticHolder)
}
else {
//TODO: there should be general mechanism
diagnosticHolder.report(ErrorsJvm.PLATFORM_STATIC_ILLEGAL_USAGE.on(declaration, descriptor));
}
}
if (declaration is JetProperty) {
val getter = declaration.getGetter()
if (getter != null) {
val propertyGetterDescriptor = (descriptor as PropertyDescriptor).getGetter()!!
if (propertyGetterDescriptor.hasPlatformStaticAnnotation()) {
checkDeclaration(declaration, descriptor, diagnosticHolder, getter)
}
}
val setter = declaration.getSetter()
if (setter != null) {
val propertySetterDescriptor = (descriptor as PropertyDescriptor).getSetter()!!
if (propertySetterDescriptor.hasPlatformStaticAnnotation()) {
checkDeclaration(declaration, descriptor, diagnosticHolder, setter)
}
}
}
}
private fun checkDeclaration(
declaration: JetDeclaration,
descriptor: DeclarationDescriptor,
diagnosticHolder: DiagnosticSink,
reportDiagnosticOn: JetDeclaration
diagnosticHolder: DiagnosticSink
) {
val insideObject = containerKindIs(descriptor, ClassKind.OBJECT)
val insideClassObject = containerKindIs(descriptor, ClassKind.CLASS_OBJECT)
if (!insideObject && !(insideClassObject && containerKindIs(descriptor.getContainingDeclaration()!!, ClassKind.CLASS))) {
diagnosticHolder.report(ErrorsJvm.PLATFORM_STATIC_NOT_IN_OBJECT.on(reportDiagnosticOn));
diagnosticHolder.report(ErrorsJvm.PLATFORM_STATIC_NOT_IN_OBJECT.on(declaration));
}
if (insideObject && declaration.hasModifier(JetTokens.OVERRIDE_KEYWORD)) {
diagnosticHolder.report(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC.on(reportDiagnosticOn));
if (insideObject && descriptor is MemberDescriptor && descriptor.getModality().isOverridable()) {
diagnosticHolder.report(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC.on(declaration));
}
}
@@ -111,6 +111,7 @@ public interface Errors {
DiagnosticFactory1<PsiElement, Collection<JetModifierKeywordToken>> INCOMPATIBLE_MODIFIERS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, JetModifierKeywordToken> ILLEGAL_MODIFIER = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, JetModifierKeywordToken> REPEATED_MODIFIER = DiagnosticFactory1.create(ERROR);
DiagnosticFactory2<PsiElement, JetModifierKeywordToken, JetModifierKeywordToken> REDUNDANT_MODIFIER = DiagnosticFactory2.create(WARNING);
DiagnosticFactory0<PsiElement> INAPPLICABLE_ANNOTATION = DiagnosticFactory0.create(ERROR);
@@ -146,6 +146,7 @@ public class DefaultErrorMessages {
}
});
MAP.put(ILLEGAL_MODIFIER, "Illegal modifier ''{0}''", TO_STRING);
MAP.put(REPEATED_MODIFIER, "Repeated ''{0}''", TO_STRING);
MAP.put(INAPPLICABLE_ANNOTATION, "This annotation is not applicable to class members");
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
@@ -267,6 +267,7 @@ public class DeclarationsChecker {
private void checkClass(BodiesResolveContext c, JetClass aClass, ClassDescriptorWithResolutionScopes classDescriptor) {
checkOpenMembers(classDescriptor);
checkConstructorParameters(aClass);
if (c.getTopDownAnalysisParameters().isLazy()) {
checkTypeParameters(aClass);
}
@@ -289,6 +290,15 @@ public class DeclarationsChecker {
}
}
private void checkConstructorParameters(JetClass aClass) {
for (JetParameter parameter : aClass.getPrimaryConstructorParameters()) {
PropertyDescriptor propertyDescriptor = trace.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter);
if (propertyDescriptor != null) {
modifiersChecker.checkModifiersForDeclaration(parameter, propertyDescriptor);
}
}
}
private void checkTypeParameters(JetTypeParameterListOwner typeParameterListOwner) {
// TODO: Support annotation for type parameters
for (JetTypeParameter jetTypeParameter : typeParameterListOwner.getTypeParameters()) {
@@ -514,6 +524,9 @@ public class DeclarationsChecker {
private void checkAccessors(@NotNull JetProperty property, @NotNull PropertyDescriptor propertyDescriptor) {
for (JetPropertyAccessor accessor : property.getAccessors()) {
PropertyAccessorDescriptor propertyAccessorDescriptor = accessor.isGetter() ? propertyDescriptor.getGetter() : propertyDescriptor.getSetter();
assert propertyAccessorDescriptor != null : "No property accessor descriptor for " + property.getText();
modifiersChecker.checkModifiersForDeclaration(accessor, propertyAccessorDescriptor);
modifiersChecker.checkIllegalModalityModifiers(accessor);
}
JetPropertyAccessor getter = property.getGetter();
@@ -33,11 +33,9 @@ import org.jetbrains.jet.lang.resolve.constants.StringValue;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lexer.JetModifierKeywordToken;
import org.jetbrains.jet.lexer.JetTokens;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.*;
import static org.jetbrains.jet.lang.diagnostics.Errors.*;
import static org.jetbrains.jet.lexer.JetTokens.*;
@@ -65,6 +63,62 @@ public class ModifiersChecker {
}
}
public static void checkIncompatibleModifiers(
@Nullable JetModifierList modifierList,
@NotNull BindingTrace trace,
@NotNull Collection<JetModifierKeywordToken> availableModifiers,
@NotNull Collection<JetModifierKeywordToken>... availableCombinations
) {
if (modifierList == null) return;
Collection<JetModifierKeywordToken> presentModifiers = Sets.newLinkedHashSet();
for (JetModifierKeywordToken modifier : availableModifiers) {
if (modifierList.hasModifier(modifier)) {
presentModifiers.add(modifier);
}
}
checkRepeatedModifiers(modifierList, trace, availableModifiers);
if (presentModifiers.size() == 1) {
return;
}
for (Collection<JetModifierKeywordToken> combination : availableCombinations) {
if (presentModifiers.containsAll(combination) && combination.containsAll(presentModifiers)) {
return;
}
}
for (JetModifierKeywordToken token : presentModifiers) {
trace.report(Errors.INCOMPATIBLE_MODIFIERS.on(modifierList.getModifierNode(token).getPsi(), presentModifiers));
}
}
private static void checkRepeatedModifiers(
@NotNull JetModifierList modifierList,
@NotNull BindingTrace trace,
@NotNull Collection<JetModifierKeywordToken> availableModifiers
) {
for (JetModifierKeywordToken token : availableModifiers) {
if (!modifierList.hasModifier(token)) continue;
List<ASTNode> nodesOfRepeatedTokens = Lists.newArrayList();
ASTNode node = modifierList.getNode().getFirstChildNode();
while (node != null) {
if (node.getElementType() == token) {
nodesOfRepeatedTokens.add(node);
}
node = node.getTreeNext();
}
if (nodesOfRepeatedTokens.size() > 1) {
for (ASTNode repeatedToken : nodesOfRepeatedTokens) {
trace.report(REPEATED_MODIFIER.on(repeatedToken.getPsi(), token));
}
}
}
}
public static void checkIncompatibleVarianceModifiers(@Nullable JetModifierList modifierList, @NotNull BindingTrace trace) {
checkIncompatibleModifiers(modifierList, trace, Arrays.asList(JetTokens.IN_KEYWORD, JetTokens.OUT_KEYWORD));
}
@NotNull
private final BindingTrace trace;
@NotNull
@@ -87,6 +141,7 @@ public class ModifiersChecker {
checkInnerModifier(modifierListOwner, descriptor);
checkModalityModifiers(modifierListOwner);
checkVisibilityModifiers(modifierListOwner, descriptor);
checkVarianceModifiersOfTypeParameters(modifierListOwner);
}
checkPlatformNameApplicability(descriptor);
runAnnotationCheckers(modifierListOwner, descriptor);
@@ -172,16 +227,6 @@ public class ModifiersChecker {
}
private void checkPlatformNameApplicability(@NotNull DeclarationDescriptor descriptor) {
if (descriptor instanceof PropertyDescriptor) {
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) descriptor;
if (propertyDescriptor.getGetter() != null) {
checkPlatformNameApplicability(propertyDescriptor.getGetter());
}
if (propertyDescriptor.getSetter() != null) {
checkPlatformNameApplicability(propertyDescriptor.getSetter());
}
}
AnnotationDescriptor annotation = descriptor.getAnnotations().findAnnotation(new FqName("kotlin.platform.platformName"));
if (annotation == null) return;
@@ -205,24 +250,7 @@ public class ModifiersChecker {
}
private void checkCompatibility(@Nullable JetModifierList modifierList, Collection<JetModifierKeywordToken> availableModifiers, Collection<JetModifierKeywordToken>... availableCombinations) {
if (modifierList == null) return;
Collection<JetModifierKeywordToken> presentModifiers = Sets.newLinkedHashSet();
for (JetModifierKeywordToken modifier : availableModifiers) {
if (modifierList.hasModifier(modifier)) {
presentModifiers.add(modifier);
}
}
if (presentModifiers.size() == 1) {
return;
}
for (Collection<JetModifierKeywordToken> combination : availableCombinations) {
if (presentModifiers.containsAll(combination) && combination.containsAll(presentModifiers)) {
return;
}
}
for (JetModifierKeywordToken token : presentModifiers) {
trace.report(Errors.INCOMPATIBLE_MODIFIERS.on(modifierList.getModifierNode(token).getPsi(), presentModifiers));
}
checkIncompatibleModifiers(modifierList, trace, availableModifiers, availableCombinations);
}
private void checkRedundantModifier(@NotNull JetModifierList modifierList, Pair<JetModifierKeywordToken, JetModifierKeywordToken>... redundantBundles) {
@@ -317,4 +345,13 @@ public class ModifiersChecker {
checker.check(declaration, descriptor, trace);
}
}
public void checkVarianceModifiersOfTypeParameters(@NotNull JetModifierListOwner modifierListOwner) {
if (!(modifierListOwner instanceof JetTypeParameterListOwner)) return;
List<JetTypeParameter> typeParameters = ((JetTypeParameterListOwner) modifierListOwner).getTypeParameters();
for (JetTypeParameter typeParameter : typeParameters) {
JetModifierList modifierList = typeParameter.getModifierList();
checkIncompatibleVarianceModifiers(modifierList, trace);
}
}
}
@@ -35,6 +35,7 @@ import org.jetbrains.jet.context.LazinessToken
import org.jetbrains.jet.lang.resolve.lazy.LazyEntity
import org.jetbrains.jet.lang.resolve.lazy.ForceResolveUtil
import org.jetbrains.jet.utils.addToStdlib.firstIsInstanceOrNull
import org.jetbrains.jet.lexer.JetTokens
public class TypeResolver(
private val annotationResolver: AnnotationResolver,
@@ -256,6 +257,7 @@ public class TypeResolver(
val (i, argumentElement) = it
val projectionKind = argumentElement.getProjectionKind()
ModifiersChecker.checkIncompatibleVarianceModifiers(argumentElement.getModifierList(), c.trace)
if (projectionKind == JetProjectionKind.STAR) {
val parameters = constructor.getParameters()
if (parameters.size() > i) {
@@ -125,6 +125,7 @@ public class CandidateResolver {
for (JetTypeProjection projection : jetTypeArguments) {
if (projection.getProjectionKind() != JetProjectionKind.NONE) {
context.trace.report(PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT.on(projection));
ModifiersChecker.checkIncompatibleVarianceModifiers(projection.getModifierList(), context.trace);
}
JetType type = argumentTypeResolver.resolveTypeRefWithDefault(
projection.getTypeReference(), context.scope, context.trace,
@@ -4,4 +4,7 @@ package d
fun test() {
f()
}
}
var g: Int = 1
<!PACKAGE_MEMBER_CANNOT_BE_PROTECTED!>protected<!> set(i: Int) {}
@@ -2,5 +2,6 @@ package
package d {
internal val f: () -> kotlin.Int
internal var g: kotlin.Int
internal fun test(): kotlin.Unit
}
@@ -0,0 +1,23 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
trait Foo<T>
trait Foo1<<!INCOMPATIBLE_MODIFIERS!>in<!> <!INCOMPATIBLE_MODIFIERS!>out<!> T>
trait Foo2<<!REPEATED_MODIFIER!>in<!> <!REPEATED_MODIFIER!>in<!> T>
fun test1(foo: Foo<<!INCOMPATIBLE_MODIFIERS!>in<!> <!INCOMPATIBLE_MODIFIERS!>out<!> Int>) = foo
fun test2(): Foo<<!REPEATED_MODIFIER!>in<!> <!REPEATED_MODIFIER!>in<!> Int> = throw Exception()
fun test3() {
val f: Foo<<!REPEATED_MODIFIER!>out<!> <!REPEATED_MODIFIER!>out<!> <!REPEATED_MODIFIER!>out<!> <!REPEATED_MODIFIER!>out<!> Int>
class Bzz<<!REPEATED_MODIFIER!>in<!> <!REPEATED_MODIFIER!>in<!> T>
}
class A {
fun <<!VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY, REPEATED_MODIFIER!>out<!> <!REPEATED_MODIFIER!>out<!> T> bar() {
}
}
fun test4(a: A) {
a.bar<<!PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, REPEATED_MODIFIER!>out<!> <!REPEATED_MODIFIER!>out<!> Int>()
}
@@ -0,0 +1,32 @@
package
internal fun test1(/*0*/ foo: Foo<in kotlin.Int>): Foo<in kotlin.Int>
internal fun test2(): Foo<in kotlin.Int>
internal fun test3(): kotlin.Unit
internal fun test4(/*0*/ a: A): kotlin.Unit
internal final class A {
public constructor A()
internal final fun </*0*/ out T> bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal trait Foo</*0*/ T> {
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
}
internal trait Foo1</*0*/ out T> {
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
}
internal trait Foo2</*0*/ in T> {
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
}
@@ -0,0 +1,41 @@
<!REPEATED_MODIFIER!>abstract<!> <!REPEATED_MODIFIER!>abstract<!> class Foo
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> class Bar
<!REPEATED_MODIFIER, INCOMPATIBLE_MODIFIERS!>open<!> <!REPEATED_MODIFIER!>open<!> <!INCOMPATIBLE_MODIFIERS!>final<!> class Baz {
<!REPEATED_MODIFIER!>private<!> <!REPEATED_MODIFIER!>private<!> fun foo() {}
}
class Bzz(<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val q: Int = 1) {
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val x: Int = 2
public val y: Int
<!REPEATED_MODIFIER, REDUNDANT_MODIFIER_IN_GETTER!>public<!> <!REPEATED_MODIFIER!>public<!> get() = 3
val z: Int
<!INCOMPATIBLE_MODIFIERS, ILLEGAL_MODIFIER!>open<!> <!INCOMPATIBLE_MODIFIERS, ILLEGAL_MODIFIER!>final<!> get() = 4
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> class B(<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val z: Int = 1) {
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val y: Int = 2
public val x: Int
<!REPEATED_MODIFIER, REDUNDANT_MODIFIER_IN_GETTER!>public<!> <!REPEATED_MODIFIER!>public<!> get() = 3
}
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> object C {
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val y: Int = 1
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> fun z(): Int = 1
}
}
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val bar: Int = 1
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> fun foo(): Int = 1
fun test() {
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> class B(<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val z: Int = 1) {
<!REPEATED_MODIFIER!>public<!> <!REPEATED_MODIFIER!>public<!> val y: Int = 2
public val x: Int
<!REPEATED_MODIFIER, REDUNDANT_MODIFIER_IN_GETTER!>public<!> <!REPEATED_MODIFIER!>public<!> get() = 3
}
}
@@ -0,0 +1,66 @@
package
public val bar: kotlin.Int = 1
public fun foo(): kotlin.Int
internal fun test(): kotlin.Unit
public final class Bar {
public constructor Bar()
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
}
internal open class Baz {
public constructor Baz()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
private final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal final class Bzz {
public constructor Bzz(/*0*/ q: kotlin.Int = ...)
public final val q: kotlin.Int
public final val x: kotlin.Int = 2
public final val y: kotlin.Int
internal final val z: kotlin.Int
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 final class B {
public constructor B(/*0*/ z: kotlin.Int = ...)
public final val x: kotlin.Int
public final val y: kotlin.Int = 2
public final val z: kotlin.Int
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 object C {
private constructor C()
public final val y: kotlin.Int = 1
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 final fun z(): kotlin.Int
public class object <class-object-for-C> : Bzz.C {
private constructor <class-object-for-C>()
public final override /*1*/ /*fake_override*/ val y: kotlin.Int
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 final override /*1*/ /*fake_override*/ fun z(): kotlin.Int
}
}
}
internal abstract class Foo {
public constructor Foo()
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
}
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test;
import org.jetbrains.annotations.NotNull;
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public class ArrayTypeVariance {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
import java.util.*
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
import java.util.*
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
import java.util.*
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
import java.util.*
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait ChangeProjectionKind1 {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait InheritNotVararg {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait InheritNotVarargInteger {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait InheritNotVarargNotNull {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait InheritProjectionKind {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait InheritVarargNotNull {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait InheritProjectionKind {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait SameProjectionKind {
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
public trait TwoSuperclassesConflictingProjectionKinds {
@@ -3,9 +3,6 @@ package test
var Long.date1: Any get() = java.util.Date()
set(value) {}
var Long.date2: Any get() = java.util.Date()
protected set(value) {}
var Long.date3: Any get() = java.util.Date()
private set(value) {}
@@ -21,8 +18,5 @@ public var Long.date8: java.util.Date get() = java.util.Date()
public var Long.date9: java.util.Date get() = java.util.Date()
private set(value) {}
public var Long.date10: java.util.Date get() = java.util.Date()
protected set(value) {}
public var Long.date11: java.util.Date get() = java.util.Date()
public set(value) {}
@@ -3,15 +3,9 @@ package test
internal var kotlin.Long.date1: kotlin.Any
internal fun kotlin.Long.<get-date1>(): kotlin.Any
internal fun kotlin.Long.<set-date1>(/*0*/ value: kotlin.Any): kotlin.Unit
public var kotlin.Long.date10: java.util.Date
public fun kotlin.Long.<get-date10>(): java.util.Date
protected fun kotlin.Long.<set-date10>(/*0*/ value: java.util.Date): kotlin.Unit
public var kotlin.Long.date11: java.util.Date
public fun kotlin.Long.<get-date11>(): java.util.Date
public fun kotlin.Long.<set-date11>(/*0*/ value: java.util.Date): kotlin.Unit
internal var kotlin.Long.date2: kotlin.Any
internal fun kotlin.Long.<get-date2>(): kotlin.Any
protected fun kotlin.Long.<set-date2>(/*0*/ value: kotlin.Any): kotlin.Unit
internal var kotlin.Long.date3: kotlin.Any
internal fun kotlin.Long.<get-date3>(): kotlin.Any
private fun kotlin.Long.<set-date3>(/*0*/ value: kotlin.Any): kotlin.Unit
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
fun nothing(): Array<in Number> = throw Exception()
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
fun nothing(): Array<out Number> = throw Exception()
@@ -1,3 +1,4 @@
//ALLOW_AST_ACCESS
package test
fun <T> nothing(): Array<out T> = throw Exception()
@@ -33,7 +33,7 @@ import java.util.regex.Pattern;
public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
@TestMetadata("compiler/testData/diagnostics/tests")
@TestDataPath("$PROJECT_ROOT")
@InnerTestClasses({Tests.Annotations.class, Tests.BackingField.class, Tests.Cast.class, Tests.CheckArguments.class, Tests.ClassObjects.class, Tests.ControlFlowAnalysis.class, Tests.ControlStructures.class, Tests.CyclicHierarchy.class, Tests.DataClasses.class, Tests.DataFlow.class, Tests.DataFlowInfoTraversal.class, Tests.DeclarationChecks.class, Tests.DelegatedProperty.class, Tests.Delegation.class, Tests.Deparenthesize.class, Tests.DuplicateJvmSignature.class, Tests.DynamicTypes.class, Tests.Enum.class, Tests.Evaluate.class, Tests.Extensions.class, Tests.FunctionLiterals.class, Tests.Generics.class, Tests.Imports.class, Tests.IncompleteCode.class, Tests.Inference.class, Tests.Infos.class, Tests.Inline.class, Tests.Inner.class, Tests.J_k.class, Tests.Jdk_annotations.class, Tests.Labels.class, Tests.Library.class, Tests.Multimodule.class, Tests.NamedArguments.class, Tests.NullabilityAndSmartCasts.class, Tests.NullableTypes.class, Tests.Numbers.class, Tests.Objects.class, Tests.OperatorsOverloading.class, Tests.Overload.class, Tests.Override.class, Tests.PlatformTypes.class, Tests.Recovery.class, Tests.Redeclarations.class, Tests.Regressions.class, Tests.Resolve.class, Tests.Scopes.class, Tests.SenselessComparison.class, Tests.Shadowing.class, Tests.SmartCasts.class, Tests.Substitutions.class, Tests.Subtyping.class, Tests.Suppress.class, Tests.ThisAndSuper.class, Tests.TraitWithRequired.class, Tests.Typedefs.class, Tests.Unit.class, Tests.Varargs.class, Tests.Variance.class, Tests.When.class})
@InnerTestClasses({Tests.Annotations.class, Tests.BackingField.class, Tests.Cast.class, Tests.CheckArguments.class, Tests.ClassObjects.class, Tests.ControlFlowAnalysis.class, Tests.ControlStructures.class, Tests.CyclicHierarchy.class, Tests.DataClasses.class, Tests.DataFlow.class, Tests.DataFlowInfoTraversal.class, Tests.DeclarationChecks.class, Tests.DelegatedProperty.class, Tests.Delegation.class, Tests.Deparenthesize.class, Tests.DuplicateJvmSignature.class, Tests.DynamicTypes.class, Tests.Enum.class, Tests.Evaluate.class, Tests.Extensions.class, Tests.FunctionLiterals.class, Tests.Generics.class, Tests.Imports.class, Tests.IncompleteCode.class, Tests.Inference.class, Tests.Infos.class, Tests.Inline.class, Tests.Inner.class, Tests.J_k.class, Tests.Jdk_annotations.class, Tests.Labels.class, Tests.Library.class, Tests.Modifiers.class, Tests.Multimodule.class, Tests.NamedArguments.class, Tests.NullabilityAndSmartCasts.class, Tests.NullableTypes.class, Tests.Numbers.class, Tests.Objects.class, Tests.OperatorsOverloading.class, Tests.Overload.class, Tests.Override.class, Tests.PlatformTypes.class, Tests.Recovery.class, Tests.Redeclarations.class, Tests.Regressions.class, Tests.Resolve.class, Tests.Scopes.class, Tests.SenselessComparison.class, Tests.Shadowing.class, Tests.SmartCasts.class, Tests.Substitutions.class, Tests.Subtyping.class, Tests.Suppress.class, Tests.ThisAndSuper.class, Tests.TraitWithRequired.class, Tests.Typedefs.class, Tests.Unit.class, Tests.Varargs.class, Tests.Variance.class, Tests.When.class})
@RunWith(JUnit3RunnerWithInners.class)
public static class Tests extends AbstractJetDiagnosticsTest {
@TestMetadata("Abstract.kt")
@@ -238,12 +238,6 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("IllegalModifiers.kt")
public void testIllegalModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/IllegalModifiers.kt");
doTest(fileName);
}
@TestMetadata("IncDec.kt")
public void testIncDec() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/IncDec.kt");
@@ -6797,6 +6791,33 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
}
}
@TestMetadata("compiler/testData/diagnostics/tests/modifiers")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Modifiers extends AbstractJetDiagnosticsTest {
public void testAllFilesPresentInModifiers() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/tests/modifiers"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("IllegalModifiers.kt")
public void testIllegalModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt");
doTest(fileName);
}
@TestMetadata("incompatibleVarianceModifiers.kt")
public void testIncompatibleVarianceModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/incompatibleVarianceModifiers.kt");
doTest(fileName);
}
@TestMetadata("repeatedModifiers.kt")
public void testRepeatedModifiers() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/modifiers/repeatedModifiers.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/diagnostics/tests/multimodule")
@TestDataPath("$PROJECT_ROOT")
@InnerTestClasses({Multimodule.DuplicateClass.class, Multimodule.DuplicateMethod.class, Multimodule.DuplicateSuper.class})
@@ -104,6 +104,7 @@ public class QuickFixRegistrar {
QuickFixes.factories.put(GETTER_VISIBILITY_DIFFERS_FROM_PROPERTY_VISIBILITY, removeModifierFactory);
QuickFixes.factories.put(REDUNDANT_MODIFIER_IN_GETTER, removeRedundantModifierFactory);
QuickFixes.factories.put(ILLEGAL_MODIFIER, removeModifierFactory);
QuickFixes.factories.put(REPEATED_MODIFIER, removeModifierFactory);
JetSingleIntentionActionFactory changeToBackingFieldFactory = ChangeToBackingFieldFix.createFactory();
QuickFixes.factories.put(INITIALIZATION_USING_BACKING_FIELD_CUSTOM_SETTER, changeToBackingFieldFactory);
+1 -1
View File
@@ -3,7 +3,7 @@ package jquery
import org.w3c.dom.Element
native
public public class JQuery() {
public class JQuery() {
public fun addClass(className: String): JQuery = noImpl;
public fun addClass(f: Element.(Int, String) -> String): JQuery = noImpl;