disable +JDK macro in JetDiagnosticsTest and fix (actually hide) revealed bugs
+JDK was not very helpful
This commit is contained in:
+2
@@ -219,6 +219,7 @@ public class JavaDescriptorResolver {
|
||||
// First, let's check that this is a real Java class, not a Java's view on a Kotlin class:
|
||||
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(qualifiedName);
|
||||
if (kotlinClassDescriptor != null) {
|
||||
// TODO: return null, no loops here
|
||||
return new ResolverSrcClassData(kotlinClassDescriptor);
|
||||
}
|
||||
|
||||
@@ -258,6 +259,7 @@ public class JavaDescriptorResolver {
|
||||
// First, let's check that this is a real Java class, not a Java's view on a Kotlin class:
|
||||
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(qualifiedName);
|
||||
if (kotlinClassDescriptor != null) {
|
||||
// TODO: return null, no loops here
|
||||
return kotlinClassDescriptor;
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -29,6 +29,7 @@ import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassifierDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -68,7 +69,14 @@ public class JavaPackageScope extends JavaClassOrPackageScope {
|
||||
|
||||
@Override
|
||||
public ClassifierDescriptor getClassifier(@NotNull String name) {
|
||||
return semanticServices.getDescriptorResolver().resolveClass(getQualifiedName(packageFQN, name));
|
||||
ClassDescriptor classDescriptor = semanticServices.getDescriptorResolver().resolveClass(getQualifiedName(packageFQN, name));
|
||||
if (classDescriptor == null || DescriptorUtils.isObject(classDescriptor)) {
|
||||
// TODO: this is a big hack against several things that I barely understand myself and cannot explain
|
||||
// 1. We should not return objects from this method, and maybe JDR.resolveClass should not return too
|
||||
// 2. JDR should not return classes being analyzed
|
||||
return null;
|
||||
}
|
||||
return classDescriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FILE: a.kt
|
||||
// +JDK
|
||||
|
||||
/**
|
||||
* This is an example of a Type-Safe Groovy-style Builder
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package Jet86
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
trait A {
|
||||
fun foo() : Int = 1
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//+JDK
|
||||
|
||||
class Foo() {
|
||||
private val builder = StringBuilder("sdfsd");
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
fun none() {}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
// KT-689 Allow to put Java and Kotlin files in the same packages
|
||||
|
||||
// This is a stub test. One should not extend Java packages that come from libraries.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package foo
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FILE: b.kt
|
||||
// +JDK
|
||||
|
||||
|
||||
package foobar.a
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
fun test() {
|
||||
val a : Int? = 0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//+JDK
|
||||
|
||||
class X {
|
||||
val <!MUST_BE_INITIALIZED_OR_BE_ABSTRACT!>x<!> : Int
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
// Fixpoint generic in Java: Enum<T extends Enum<T>>
|
||||
fun test(<!UNUSED_PARAMETER!>a<!> : annotation.RetentionPolicy) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FILE: f.kt
|
||||
// +JDK
|
||||
|
||||
import java.*
|
||||
import java.util.*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
fun t1() : Int{
|
||||
return 0
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
class Foo1() : java.util.ArrayList<Int>()
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-389 Wrong type inference for varargs etc.
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package kotlin1
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package kotlin1
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package kotlin1
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
// +JDK
|
||||
annotation [java.lang.Deprecated] class my
|
||||
annotation Deprecated class my1
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.lang.Deprecated as deprecated
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
import java.lang.annotation.*
|
||||
|
||||
annotation [java.lang.annotation.Retention(RetentionPolicy.CLASS)] class my
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//KT-1001 Argument 2 for @NotNull parameter of JetFlowInformationProvider.checkIsInitialized must not be null
|
||||
|
||||
package kt1001
|
||||
//+JDK
|
||||
|
||||
fun foo(<!UNUSED_PARAMETER!>c<!>: Array<Int>) {
|
||||
return
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-1027 Strange selection of unreachable code
|
||||
//+JDK
|
||||
|
||||
package kt1027
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-1066 false 'Variable cannot be initialized before declaration'
|
||||
//+JDK
|
||||
|
||||
package kt1066
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//KT-1156 Throwing exception on the right side of elvis operator marks code unreachable
|
||||
|
||||
//+JDK
|
||||
|
||||
fun foo(maybe: Int?) {
|
||||
val i : Int = maybe ?: throw RuntimeException("No value")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
//KT-1189 StackOverflow in ide
|
||||
package kt1189
|
||||
//+JDK
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||
|
||||
inline fun <erased T> ReentrantReadWriteLock.write(action: ()->T) : T {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-1219 Incorrect 'unused value' error in closures
|
||||
//+JDK
|
||||
|
||||
package kt1219
|
||||
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
package kt770_351_735
|
||||
|
||||
//+JDK
|
||||
|
||||
//KT-770 Reference is not resolved to anything, but is not marked unresolved
|
||||
fun main(args : Array<String>) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-1141 No check that object in 'object expression' implements all abstract members of supertype
|
||||
//+JDK
|
||||
|
||||
package kt1141
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FILE: b.kt
|
||||
// +JDK
|
||||
package outer
|
||||
|
||||
fun Int?.optint() : Unit {}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
import java.util.Enumeration
|
||||
|
||||
inline fun <T> java.util.Enumeration<T>.iterator() = object: Iterator<T> {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
//+JDK
|
||||
//KT-819 Redeclaration error for extension properties with the same name and different receivers
|
||||
|
||||
import java.io.*
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FILE: aa/A.java
|
||||
// +JDK
|
||||
package aa;
|
||||
|
||||
public class A {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FILE: a/M.java
|
||||
// +JDK
|
||||
package a;
|
||||
|
||||
public class M {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-1270 Poor highlighting when trying to dereference a nullable reference
|
||||
//+JDK
|
||||
|
||||
package kt1270
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package kt244
|
||||
|
||||
//+JDK
|
||||
|
||||
// KT-244 Use dataflow info while resolving variable initializers
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//+JDK
|
||||
|
||||
package toplevelObjectDeclarations
|
||||
|
||||
object CObj {}
|
||||
|
||||
object DOjb : <!SUPERTYPE_NOT_INITIALIZED_DEFAULT, FINAL_SUPERTYPE!>CObj<!> {}
|
||||
object DOjb : <!UNRESOLVED_REFERENCE!>CObj<!> {}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-1028 Wrong type checking for plusAssign
|
||||
//+JDK
|
||||
package kt1028
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
import java.util.Collections
|
||||
import java.util.List
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// JET-72 Type inference doesn't work when iterating over ArrayList
|
||||
// +JDK
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-174 Nullability info for extension function receivers
|
||||
// +JDK
|
||||
trait Tree {}
|
||||
|
||||
fun Any?.TreeValue() : Tree {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-201 Allow to call extension with nullable receiver with a '.'
|
||||
// +JDK
|
||||
|
||||
fun <T : Any> T?.npe() : T = if (this == null) throw NullPointerException() else this
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-235 Illegal assignment return type
|
||||
// +JDK
|
||||
|
||||
package kt235
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-258 Support equality constraints in type inference
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-287 Infer constructor type arguments
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-313 Bug in substitutions in a function returning its type parameter T
|
||||
// +JDK
|
||||
|
||||
fun <T> Iterable<T>.join(separator : String?) : String {
|
||||
return separator.npe()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// KT-336 Can't infer type parameter for ArrayList in a generic function (Exception in type inference)
|
||||
// KT-335 Type inference fails on Collections.sort
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
import java.lang.Comparable as Comparable
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// KT-385 type inference does not work properly`
|
||||
// KT-109 Good code is red: type arguments are not inferred
|
||||
// KT-441 Exception in type inference when multiple overloads accepting an integer literal are accessible
|
||||
// +JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-459 Type argument inference fails when class names are fully qualified
|
||||
// +JDK
|
||||
|
||||
fun test() {
|
||||
val attributes : java.util.HashMap<String, String> = java.util.HashMap() // failure!
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package kt469
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-498 Very strange error in the type checker
|
||||
// +JDK
|
||||
|
||||
class IdUnavailableException() : Exception() {}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-524 sure() returns T
|
||||
// +JDK
|
||||
|
||||
package StringBuilder
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-549 type inference failed
|
||||
// +JDK
|
||||
|
||||
package demo
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-58 Allow finally around definite returns
|
||||
// +JDK
|
||||
|
||||
package kt58
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-580 Type inference failed
|
||||
// +JDK
|
||||
|
||||
package whats.the.difference
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-588 Unresolved static method
|
||||
// +JDK
|
||||
|
||||
class Test() : Thread("Test") {
|
||||
class object {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-597 Type inference failed
|
||||
// +JDK
|
||||
|
||||
fun <T> Array<T>?.get(i: Int) : T {
|
||||
if (this != null)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-600 Problem with 'sure' extension function type inference
|
||||
// +JDK
|
||||
|
||||
fun <T : Any> T?._sure() : T { if (this != null) return this else throw NullPointerException() }
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-702 Type inference failed
|
||||
// +JDK
|
||||
fun getJavaClass<T>() : java.lang.Class<T> { return "" <!CAST_NEVER_SUCCEEDS!>as<!> Class<T> }
|
||||
|
||||
public class Throwables() {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-716 Type inference failed
|
||||
// +JDK
|
||||
|
||||
class TypeInfo<T>
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//KT-743 Wrong type inference
|
||||
// +JDK
|
||||
class List<T>(val head: T, val tail: List<T>? = null)
|
||||
|
||||
fun <T, Q> List<T>.map(f: (T)-> Q): List<T>? = tail.sure<List<T>>().map(f)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
//KT-750 Type inference failed: Constraint violation
|
||||
fun main(args : Array<String>) {
|
||||
var i : Int? = Integer.valueOf(100)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KT-860 ConcurrentModificationException in frontend
|
||||
// +JDK
|
||||
|
||||
package kotlin.util
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//FILE:a.kt
|
||||
//+JDK
|
||||
//KT-1080 Don't use previously imported packages while resolving import references
|
||||
|
||||
package kt1080
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
|
||||
package kt_250_617_10
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package kt939
|
||||
|
||||
//+JDK
|
||||
|
||||
//KT-939 CommonSupertypes erases scopes associated to types
|
||||
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
//FILE:a.kt
|
||||
//KT-955 Unable to import a Kotlin package into a Kotlin file with no package header
|
||||
//+JDK
|
||||
|
||||
package foo
|
||||
|
||||
fun f() {}
|
||||
|
||||
//FILE:b.kt
|
||||
//+JDK
|
||||
|
||||
import foo.*
|
||||
|
||||
val m = f() // unresolved
|
||||
|
||||
//FILE:c.kt
|
||||
//+JDK
|
||||
|
||||
package java.util
|
||||
|
||||
fun bar() {}
|
||||
|
||||
//FILE:d.kt
|
||||
//+JDK
|
||||
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// +JDK
|
||||
import java.util.ArrayList
|
||||
|
||||
class MyListOfPairs<T> : ArrayList<#(T, T)>() { }
|
||||
|
||||
@@ -151,8 +151,7 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
}
|
||||
});
|
||||
|
||||
boolean importJdk = expectedText.contains("+JDK");
|
||||
// ModuleConfiguration configuration = importJdk ? JavaBridgeConfiguration.createJavaBridgeConfiguration(getProject()) : ModuleConfiguration.EMPTY;
|
||||
// ModuleConfiguration configuration = JavaBridgeConfiguration.createJavaBridgeConfiguration(getProject());
|
||||
if (hasJavaFiles) {
|
||||
// According to yole@ the only way to import java files is to write them on disk
|
||||
// -- stepan.koltsov@ 2012-02-29
|
||||
@@ -166,13 +165,7 @@ public class JetDiagnosticsTest extends JetLiteFixture {
|
||||
}
|
||||
}
|
||||
|
||||
BindingContext bindingContext;
|
||||
if (importJdk) {
|
||||
bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(getProject(), jetFiles, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
}
|
||||
else {
|
||||
bindingContext = AnalyzingUtils.analyzeFiles(getProject(), ModuleConfiguration.EMPTY, jetFiles, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
}
|
||||
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(getProject(), jetFiles, Predicates.<PsiFile>alwaysTrue(), JetControlFlowDataTraceFactory.EMPTY);
|
||||
|
||||
boolean ok = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user