diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java index 04d77e86797..2fb1c74abf1 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DeclarationResolver.java @@ -319,6 +319,15 @@ public class DeclarationResolver { private void checkRedeclarationsInNamespaces() { for (MutablePackageFragmentDescriptor packageFragment : Sets.newHashSet(context.getPackageFragments().values())) { + if (KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME.equals(packageFragment.getFqName())) { + // TODO: drop this after built-ins are fully rewritten to Kotlin + // At the moment, there are Java classes for ranges (e.g. IntRange.java) which contain static members. If someone tries to + // rewrite IntRange to Kotlin, redeclaration will be reported because there are both class (from the Kotlin sources) and + // package (from static members of Java class present in kotlin-runtime.jar) for FQ name "jet.IntRange". + // Will be safe to drop once there are no Java classes duplicating sources of Kotlin built-ins + continue; + } + PackageViewDescriptor packageView = packageFragment.getContainingDeclaration().getPackage(packageFragment.getFqName()); JetScope packageViewScope = packageView.getMemberScope(); Multimap simpleNameDescriptors = packageFragment.getMemberScope().getDeclaredDescriptorsAccessibleBySimpleName(); @@ -357,16 +366,7 @@ public class DeclarationResolver { Collection files = trace.get(BindingContext.PACKAGE_TO_FILES, aPackage.getFqName()); if (files == null) { - // TODO: uncomment this after built-ins are fully rewritten to Kotlin - // At the moment, there are Java classes for ranges (e.g. IntRange.java) which contain static members. If someone tries to - // rewrite IntRange to Kotlin, this exception will be thrown because there are both class (from the Kotlin sources) and - // package (from static members of Java class present in kotlin-runtime.jar) for FQ name "jet.IntRange", but no sources - // correspond to the package. - // Will be safe to uncomment once there are no Java classes duplicating sources of Kotlin built-ins - - // throw new IllegalStateException("declarations corresponding to " + aPackage + " are not found"); - - return Collections.emptySet(); + throw new IllegalStateException("declarations corresponding to " + aPackage + " are not found"); } declarations = Collections2.transform(files, new Function() {