Don't break the world if enum in annotation isn't found
This commit is contained in:
@@ -50,4 +50,9 @@ public class ErrorValue implements CompileTimeConstant<Void> {
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,8 @@ public class ErrorUtils {
|
||||
return createErrorType(value + " is not allowed here", value.getType().getMemberScope());
|
||||
}
|
||||
|
||||
public static ClassifierDescriptor getErrorClass() {
|
||||
@NotNull
|
||||
public static ClassDescriptor getErrorClass() {
|
||||
return ERROR_CLASS;
|
||||
}
|
||||
|
||||
|
||||
BIN
Binary file not shown.
+12
@@ -0,0 +1,12 @@
|
||||
package test
|
||||
|
||||
// To regenerate this test:
|
||||
// 1. Compile this file
|
||||
// 2. Delete test/E.class
|
||||
// 3. Pack test/ into jar
|
||||
|
||||
enum class E { ENTRY }
|
||||
|
||||
annotation class Anno(val e: E)
|
||||
|
||||
Anno(E.ENTRY) open class Class
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package test
|
||||
|
||||
class Subclass : Class()
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package test
|
||||
|
||||
internal final annotation class Anno : jet.Annotation {
|
||||
public constructor Anno(/*0*/ e: [ERROR : test.E])
|
||||
internal final val e: [ERROR : test.E]
|
||||
}
|
||||
|
||||
test.Anno(e = Unresolved enum entry: test.E.ENTRY: [ERROR : Unresolved enum entry: test.E.ENTRY]) internal open class Class {
|
||||
public constructor Class()
|
||||
}
|
||||
|
||||
internal final class Subclass : test.Class {
|
||||
public constructor Subclass()
|
||||
}
|
||||
+3
-1
@@ -34,6 +34,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.java.AnalyzerFacadeForJVM;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.test.TestCaseWithTmpdir;
|
||||
import org.jetbrains.jet.test.util.DescriptorValidator;
|
||||
import org.jetbrains.jet.test.util.NamespaceComparator;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -70,7 +71,8 @@ public abstract class AbstractCompileKotlinAgainstCustomJavaTest extends TestCas
|
||||
NamespaceDescriptor namespaceDescriptor = bindingContext.get(BindingContext.FQNAME_TO_NAMESPACE_DESCRIPTOR, namespaceFqn);
|
||||
assertNotNull("Failed to find namespace: " + namespaceFqn, namespaceDescriptor);
|
||||
|
||||
validateAndCompareNamespaceWithFile(namespaceDescriptor, NamespaceComparator.DONT_INCLUDE_METHODS_OF_OBJECT, expectedFile);
|
||||
validateAndCompareNamespaceWithFile(namespaceDescriptor, NamespaceComparator.DONT_INCLUDE_METHODS_OF_OBJECT.withValidationStrategy(
|
||||
DescriptorValidator.ValidationVisitor.ALLOW_ERROR_TYPES), expectedFile);
|
||||
}
|
||||
|
||||
private JetCoreEnvironment getEnvironment(File ktFile) {
|
||||
|
||||
+15
-1
@@ -31,7 +31,7 @@ import org.jetbrains.jet.jvm.compiler.AbstractCompileKotlinAgainstCustomJavaTest
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstCustomJava")
|
||||
@InnerTestClasses({CompileKotlinAgainstCustomJavaGenerated.DuplicateLibraries.class})
|
||||
@InnerTestClasses({CompileKotlinAgainstCustomJavaGenerated.DuplicateLibraries.class, CompileKotlinAgainstCustomJavaGenerated.MissingEnumReferencedInAnnotation.class})
|
||||
public class CompileKotlinAgainstCustomJavaGenerated extends AbstractCompileKotlinAgainstCustomJavaTest {
|
||||
public void testAllFilesPresentInCompileKotlinAgainstCustomJava() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/compileKotlinAgainstCustomJava"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -50,10 +50,24 @@ public class CompileKotlinAgainstCustomJavaGenerated extends AbstractCompileKotl
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/compileKotlinAgainstCustomJava/missingEnumReferencedInAnnotation")
|
||||
public static class MissingEnumReferencedInAnnotation extends AbstractCompileKotlinAgainstCustomJavaTest {
|
||||
public void testAllFilesPresentInMissingEnumReferencedInAnnotation() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/compileKotlinAgainstCustomJava/missingEnumReferencedInAnnotation"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("MissingEnumReferencedInAnnotation.kt")
|
||||
public void testMissingEnumReferencedInAnnotation() throws Exception {
|
||||
doTest("compiler/testData/compileKotlinAgainstCustomJava/missingEnumReferencedInAnnotation/MissingEnumReferencedInAnnotation.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("CompileKotlinAgainstCustomJavaGenerated");
|
||||
suite.addTestSuite(CompileKotlinAgainstCustomJavaGenerated.class);
|
||||
suite.addTestSuite(DuplicateLibraries.class);
|
||||
suite.addTestSuite(MissingEnumReferencedInAnnotation.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user