Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10570

AnnotationCollector produces unspecified errors when used in Java

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 4.0.1
    • 2.5.17, 3.0.11, 4.0.2
    • Compiler
    • None

    Description

      I have an AnnotationCollector that refers to some Java classes (type converters). The stub generator has an error generating the stub, so I tried writing the annotation itself in Java. While this compiled correctly, when compiling tests using that annotation I get a BUG! in the Groovy compiler:

      BUG! exception in phase 'semantic analysis' in source unit '/home/christopher/git/.../IgnoreMetaClassAttributeConverterProviderTest.groovy' com.example.DynamoDbRecord.value()
      ...
      Caused by: java.lang.NoSuchMethodException: com.example.DynamoDbRecord.value()
          at java.lang.Class.getMethod (Class.java:2108)
          at org.codehaus.groovy.transform.AnnotationCollectorTransform.getTargetListFromClass (AnnotationCollectorTransform.java:276)
          at org.codehaus.groovy.transform.AnnotationCollectorTransform.getMeta (AnnotationCollectorTransform.java:76)
          at org.codehaus.groovy.transform.AnnotationCollectorTransform.getStoredTargetList (AnnotationCollectorTransform.java:226)
          at org.codehaus.groovy.transform.AnnotationCollectorTransform.getTargetAnnotationList (AnnotationCollectorTransform.java:356)
          at org.codehaus.groovy.transform.AnnotationCollectorTransform.visit (AnnotationCollectorTransform.java:383)
          at org.codehaus.groovy.transform.ASTTransformationCollectorCodeVisitor.findCollectedAnnotations (ASTTransformationCollectorCodeVisitor.java:207)
          at org.codehaus.groovy.transform.ASTTransformationCollectorCodeVisitor.visitAnnotations (ASTTransformationCollectorCodeVisitor.java:93)
      

      Adding a String value default "" to the annotation produces an NPE.

      It would make sense to me to learn that using AnnotationCollector in Java is unsupported, but the Groovy compiler should probably have a better error report.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            emilles Eric Milles
            chrylis Christopher Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 50m
              50m

              Slack

                Issue deployment