Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1934

Allow usage of explicit "this" as first method argument (JSR 308)

    • Severity 3 - Minor

      A follow up of CLOV-1839

      JSR 308 (type annotations) allows to annotate any occurrence of the type.

      As all instance methods have an implicit "this" argument, in order to make it possible to annotate it, the JSR specification extended the grammar for method signatures, so that you can use "this" keyword as argument name (only for a first argument). 

      These two methods are equivalent for javac:

      class A { public String toString() { ... } }   
      
      class A { public String toString(A this) { ... } }
      
      

       

      Currently Clover throws parse exception if encounters "this" keyword as name of an argument.

       

            [CLOV-1934] Allow usage of explicit "this" as first method argument (JSR 308)

            Michael Andreacchio made changes -
            Resolution New: Won't Fix [ 2 ]
            Status Original: Open [ 1 ] New: Closed [ 6 ]
            jonah (Inactive) made changes -
            Symptom Severity New: Minor [ 14432 ]
            Owen made changes -
            Workflow Original: New Clover Workflow [ 1147678 ] New: New Clover Workflow - Restricted [ 1475131 ]
            Marek Parfianowicz made changes -
            Description Original: A follow up of CLOV-1839

            JSR 308 (type annotations) allows to annotate any occurrence of the type.

            As all instance methods have an implicit "this" argument, in order to make it possible to annotate it, the JSR specification extended the grammar for method signatures, so that you can use "this" keyword as argument name. 

            These two methods are equivalent for javac:

            {code}

            class A { public String toString() { ... } }   

            class A { public String toString(A this) { ... } }

            {code}

             

            Currently Clover throws parse exception if encounters "this" keyword as name of an argument.

             
            New: A follow up of CLOV-1839

            JSR 308 (type annotations) allows to annotate any occurrence of the type.

            As all instance methods have an implicit "this" argument, in order to make it possible to annotate it, the JSR specification extended the grammar for method signatures, so that you can use "this" keyword as argument name (only for a first argument). 

            These two methods are equivalent for javac:

            {code}

            class A { public String toString() { ... } }   

            class A { public String toString(A this) { ... } }

            {code}

             

            Currently Clover throws parse exception if encounters "this" keyword as name of an argument.

             
            Marek Parfianowicz made changes -
            Link New: This issue is related to CLOV-1839 [ CLOV-1839 ]
            Marek Parfianowicz created issue -

              Unassigned Unassigned
              mparfianowicz Marek Parfianowicz
              Affected customers:
              0 This affects my team
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: