diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java index c5a75b4..4dd61ee 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java @@ -48,7 +48,7 @@ // Static initializer to specify tests subset using TESTS_* static variables // All specified tests which do not belong to the class are skipped... static { -// TESTS_NAMES = new String[] { "testBug384663" }; + TESTS_NAMES = new String[] { "testBug386356" }; // TESTS_NUMBERS = new int[] { 297 }; // TESTS_RANGE = new int[] { 294, -1 }; } @@ -10637,4 +10637,64 @@ }; runConformTest(testFiles); } + +// Bug 386356 - Type mismatch error with annotations and generics +// test case from comment 9 +public void testBug386356_1() { + runConformTest( + new String[] { + "p/X.java", + "package p;\n" + + "import javax.xml.bind.annotation.adapters.XmlAdapter;\n" + + "public abstract class X extends XmlAdapter {\n" + + "}", + + "p/package-info.java", + "@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(value = X.class, type = X.class) })\n" + + "package p;\n" + + "import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; \n" + + "import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;" + + }); +} + +//Bug 386356 - Type mismatch error with annotations and generics +//test case from comment 6 +public void testBug386356_2() { + runConformTest( + new String[] { + "com/ermahgerd/Ermahgerd.java", + "package com.ermahgerd;\n" + + "\n" + + "public class Ermahgerd {\n" + + "}", + + "com/ermahgerd/package-info.java", + "@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(value = ErmahgerdXmlAdapter.class, type = Ermahgerd.class) })\n" + + "package com.ermahgerd;\n" + + "import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;\n" + + "import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;", + + "com/ermahgerd/ErmahgerdXmlAdapter.java", + "package com.ermahgerd;\n" + + "\n" + + "import javax.xml.bind.annotation.adapters.XmlAdapter;\n" + + "\n" + + "public class ErmahgerdXmlAdapter extends XmlAdapter {\n" + + "\n" + + " @Override\n" + + " public String marshal(Ermahgerd arg0) throws Exception {\n" + + " // TODO Auto-generated method stub\n" + + " return null;\n" + + " }\n" + + "\n" + + " @Override\n" + + " public Ermahgerd unmarshal(String arg0) throws Exception {\n" + + " // TODO Auto-generated method stub\n" + + " return null;\n" + + " }\n" + + "}" + + }); +} } diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index a8fbc59..096b544 100644 --- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java @@ -1100,8 +1100,6 @@ this.modifiers |= ClassFileConstants.AccDeprecated; } } - if (CharOperation.equals(this.sourceName, TypeConstants.PACKAGE_INFO_NAME)) - getAnnotationTagBits(); // initialize } // ensure the receiver knows its hierarchy & fields/methods so static imports can be resolved correctly