Incorrect instrumented code created when using generics in return type

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: High
    • 2.1.0
    • Affects Version/s: 2.0.3
    • Component/s: None
    • None

      When instrumenting code that has a generic in the return type, the code that is created does not properly add spaces inside the instrumented generic.

      The source code:

      @SuppressWarnings("unchecked")
      public Class<? extends Throwable> getExpectedException() throws IllegalStateException {
      
          final Annotation testAnnotation = getMethod().getAnnotation(this.testAnnotationClass);
          final Class<? extends Throwable> expectedAttribute = (Class<? extends Throwable>) AnnotationUtils.getValue(testAnnotation, "expected");
      
          Class<? extends Throwable> expectedException = testAnnotation != null && expectedAttribute != this.noneClass ? expectedAttribute : null;
          return expectedException;
      }    
      

      results in the following compilation error.

      public Class<? extends Throwable> getExpectedException() throws IllegalStateException {__CLR2_0_32qe2qefbt77v7t.R.globalSliceStart(getClass(),3556);int p=0;java.lang.Throwable t=null;try{Class<?extendsThrowable> r=__CLR2_0_3jx7tkw2qs();p=1;return r;}catch(java.lang.Error e){t=e;throw e;}catch(java.lang.RuntimeException e){t=e;throw e;}finally{__CLR2_0_32qe2qefbt77v7t.R.globalSliceEnd(getClass(),3556,p,t);}}public Class<?extendsThrowable>  __CLR2_0_3jx7tkw2qs() throws IllegalStateException{__CLR2_0_32qe2qefbt77v7t.R.E[3556]++;
      

      Note the segment that says try{Class<?extendsThrowable> r= and how it is missing two spaces.

            Assignee:
            Nick
            Reporter:
            Ben Hale
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: