Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6215772

APT fails with "Could not create declaration for annotation type" on recursive annotation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 5.0
    • tools
    • None
    • apt
    • generic
    • generic

      With the attached test case, the following error occurs from APT:
      ------
      $ apt -J-Duser.language=en -version -nocompile -cp . foo/A.java
      apt 1.5.0_01
      error: Could not create declaration for annotation type foo.A
      do nothing
      1 error
      ------

      I noticed that DeclarationMaker.getTypeDeclaration returns a PackageSymbol
      (where it should be ClassSymbol), and that causes this method to return
      null, which in turn causes this failure. This PackageSymbol's EXISTS flag
      is false.

      Further looking at the code, this bogus PackageSymbol was created from
      around MemberEnter line 898:

      -------------
      // check that no package exists with same fully qualified name,
      // but admit classes in the empty package which have the same
      // name as a top-level package.
      if (checkClash &&
          c.owner.kind == PCK && c.owner != syms.emptyPackage &&
          reader.packageExists(c.fullname))
          {
              log.error(tree.pos, "clash.with.pkg.of.same.name", c);
          }
      -------------

      ###@###.### 2005-1-10 19:09:29 GMT

            darcy Joe Darcy
            kkawagucsunw Kohsuke Kawaguchi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: