diff options
author | Stephan Herrmann | 2014-05-11 17:28:35 +0000 |
---|---|---|
committer | Stephan Herrmann | 2014-05-14 21:38:06 +0000 |
commit | 3f60ba6c4328b89dbfaef12feb628451b43d7879 (patch) | |
tree | d27c93a34a5dd6ff72b7c40a8c0026a55d677401 /org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java | |
parent | e7fead4adac4e5d682bbdf8cb7aaa3f524aab927 (diff) | |
download | eclipse.jdt.core-3f60ba6c4328b89dbfaef12feb628451b43d7879.tar.gz eclipse.jdt.core-3f60ba6c4328b89dbfaef12feb628451b43d7879.tar.xz eclipse.jdt.core-3f60ba6c4328b89dbfaef12feb628451b43d7879.zip |
Bug 434570 - Generic type mismatch for parametrized class annotationI20140518-2000I20140517-1500I20140516-2000I20140515-2000I20140515-1230I20140514-2000
attribute with inner class
Diffstat (limited to 'org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java')
-rw-r--r-- | org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java index 3641963001..f3e1a1f498 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java @@ -25,6 +25,7 @@ * Bug 431408 - Java 8 (1.8) generics bug * Bug 432603 - [compile][1.7] ecj reports an Error while javac doesn't * Bug 399527 - Type inference problem + * Bug 434570 - Generic type mismatch for parametrized class annotation attribute with inner class *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.regression; @@ -4952,5 +4953,132 @@ public void testBug399527_comment1() { sourceString }); } +public void testBug434570() { + runConformTest( + new String[] { + "example/Example.java", + "package example;\n" + + "\n" + + "import example.Example.Config;\n" + + "import example.Example.CustomInitializer;\n" + + "\n" + + "@Config(initializers = CustomInitializer.class)\n" + + "public class Example {\n" + + "\n" + + " static interface Context {\n" + + " }\n" + + "\n" + + " static interface ConfigurableContext extends Context {\n" + + " }\n" + + "\n" + + " static abstract class AbstractContext implements ConfigurableContext {\n" + + " }\n" + + "\n" + + " static class GenericContext extends AbstractContext {\n" + + " }\n" + + "\n" + + " static interface Initializer<C extends ConfigurableContext> {\n" + + " }\n" + + "\n" + + " static @interface Config {\n" + + " Class<? extends Initializer<? extends ConfigurableContext>>[] initializers() default {};\n" + + " }\n" + + "\n" + + " static class CustomInitializer implements Initializer<GenericContext> {\n" + + " }\n" + + "\n" + + " @Config(initializers = CustomInitializer.class)\n" + + " static class CompilationSuccess {\n" + + " }\n" + + "\n" + + "}\n" + }); +} +public void testBug434630() { + runConformTest( + new String[] { + "Foo.java", + "interface Provider<T> {}\n" + + "@interface ProvidedBy {\n" + + " Class<? extends Provider<?>> value();" + + "}\n" + + "\n" + + "@ProvidedBy(Foo.SomeProvider.class)\n" + + "public interface Foo {\n" + + " \n" + + " public static class SomeProvider implements Provider<Foo> {\n" + + "\n" + + " public Foo get() {\n" + + " return null;\n" + + " }\n" + + " \n" + + " }\n" + + "}\n" + }); +} +public void _testBug434570_comment3() { + runConformTest( + new String[] { + "TestWontCompile.java", + "import org.bug.AnnotationWithClassParameter;\n" + + "import org.bug.CustomHandler;\n" + + "import org.bug.Handler;\n" + + "\n" + + "\n" + + "@AnnotationWithClassParameter(CustomHandler.class)\n" + + "public class TestWontCompile extends ATest<Object> {\n" + + " \n" + + " public static void main(String[] args) {\n" + + " Class<? extends Handler<?>> h = CustomHandler.class;\n" + + " }\n" + + "\n" + + "}\n", + "ATest.java", + "public abstract class ATest<T> {\n" + + "\n" + + "}\n", + "org/bug/Item.java", + "package org.bug;\n" + + "\n" + + "public interface Item {\n" + + "\n" + + "}\n", + "org/bug/CustomItem.java", + "package org.bug;\n" + + "\n" + + "public class CustomItem implements Item {\n" + + "\n" + + "}\n", + "org/bug/Handler.java", + "package org.bug;\n" + + "\n" + + "public abstract class Handler<T extends Item> {\n" + + "\n" + + "}\n", + "org/bug/CustomHandler.java", + "package org.bug;\n" + + "\n" + + "public class CustomHandler extends Handler<CustomItem> {\n" + + "\n" + + "}\n", + "org/bug/AnnotationWithClassParameter.java", + "package org.bug;\n" + + "\n" + + "import java.lang.annotation.Documented;\n" + + "import java.lang.annotation.ElementType;\n" + + "import java.lang.annotation.Retention;\n" + + "import java.lang.annotation.RetentionPolicy;\n" + + "import java.lang.annotation.Target;\n" + + "\n" + + "@Target(ElementType.TYPE)\n" + + "@Retention(RetentionPolicy.RUNTIME)\n" + + "@Documented\n" + + "public @interface AnnotationWithClassParameter {\n" + + " \n" + + " Class<? extends Handler<?>> value();\n" + + "\n" + + "}\n" + }); +} } |