Throw InvalidModuleException in assertValid() instead of standard ISE

This commit is contained in:
Mikhail Glukhikh
2017-11-17 14:53:10 +03:00
parent 539f8afef3
commit e53cedbd6b
3 changed files with 22 additions and 2 deletions
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.descriptors
class InvalidModuleException(message: String) : IllegalStateException(message)
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.descriptors.impl
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.descriptors.InvalidModuleException
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.descriptors.PackageFragmentProvider
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
@@ -51,7 +52,7 @@ class ModuleDescriptorImpl @JvmOverloads constructor(
override fun assertValid() {
if (!isValid) {
throw IllegalStateException("Accessing invalid module descriptor $this")
throw InvalidModuleException("Accessing invalid module descriptor $this")
}
}
@@ -124,7 +124,7 @@ public class ErrorUtils {
@Override
public void assertValid() {
throw new IllegalStateException("ERROR_MODULE is not a valid module");
throw new InvalidModuleException("ERROR_MODULE is not a valid module");
}
};
}