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

Integer literal not accepted for primitive short annotation attribute

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.9
    • 4.0.4
    • Compiler

    Description

      This is a follow-up of GROOVY-6019

      Regarding this PR https://github.com/groovy/groovy-core/pull/143
      I'm trying to use spring-data-elasticsearch annotations

      Document.java
      @Persistent
      @Inherited
      @Retention(RetentionPolicy.RUNTIME)
      @Target({ElementType.TYPE})
      public @interface Document {
      	String indexName();
      	String type() default "";
      	short shards() default 5;
      	short replicas() default 1;
      	String refreshInterval() default "1s";
      	String indexStoreType() default "fs";
      }
      

      Using groovy 2.3.9 and java 1.8.0_25 with this annotation:

      @Document(indexName = "articles", type = "article", shards = 1, replicas = 0, refreshInterval = "-1", indexStoreType = "memory")
      

      I get the following errors:
      Error:(13, 62) Groovyc: Attribute 'shards' should have type 'java.lang.Short'; but found type 'int' in @org.springframework.data.elasticsearch.annotations.Document
      Error:(13, 76) Groovyc: Attribute 'replicas' should have type 'java.lang.Short'; but found type 'int' in @org.springframework.data.elasticsearch.annotations.Document

      Could this be a regression?

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              wavyx Eric Rodriguez
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: