Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.6.0-alpha-1
    • Component/s: None
    • Labels:
      None

      Description

      Potential cases to consider.

      Known to pass with the current grammar:

      // method receiver parameters (works with existing grammar)
      void tempCalc(@ReadOnly Weather this){ ... }
      
      // on arrays
      // Annotating the int type:
      @ReadOnly int [] nums;
      

      Fail with `unexpected token: @ at line: xx, column: yy`:

      // constructor usage
      Forecast currentForecast = new @Interned Forecast()
      
      // type casts
      Object myObject = (@NotNull Object) obj
      
      // exception in catch block
      catch (@Critical Exception e) { ... }
      
      // on arrays
      // Annotating the array type int[]:
      int @ReadOnly [] nums
      // Annotating the array type int[][]:
      int @ReadOnly [][] nums
      // Annotating the type int[], which is a component type of int[][]:
      int [] @ReadOnly [] nums
      

      Fail with `unexpected token: < at line: xx, column: yy`:

      // generics
      List<@NonNull Integer> nums = []
      List<? extends @NonNull File> fileList = null
      

      Fail with 'expecting an identifier, found '@' at line: xx, column: yy':

      // inheritance
      class MyForecast<T> implements @NonEmpty List<T>
      

      Fails with 'unexpected token: throws at line: xx, column: yy':

      // exception in method declaration
      def foo() throws @NonNull Exception { }
      

      Adapted mostly from: http://www.oracle.com/technetwork/articles/java/ma14-architect-annotations-2177655.html

        Attachments

          Activity

            People

            • Assignee:
              daniel_sun Daniel Sun
              Reporter:
              paulk Paul King
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: