@@ -100,28 +100,44 @@ class SpringResponseBodyAnnotationType extends AnnotationType {
100
100
}
101
101
}
102
102
103
+ private class SpringRequestMappingAnnotation extends Annotation {
104
+ SpringRequestMappingAnnotation ( ) { this .getType ( ) instanceof SpringRequestMappingAnnotationType }
105
+ }
106
+
107
+ private Expr getProducesExpr ( RefType rt ) {
108
+ result = rt .getAnAnnotation ( ) .( SpringRequestMappingAnnotation ) .getValue ( "produces" )
109
+ or
110
+ rt .getAnAnnotation ( ) .( SpringRequestMappingAnnotation ) .getValue ( "produces" ) .( ArrayInit ) .getSize ( ) =
111
+ 0 and
112
+ result = getProducesExpr ( rt .getASupertype ( ) )
113
+ }
114
+
103
115
/**
104
116
* A method on a Spring controller that is executed in response to a web request.
105
117
*/
106
118
class SpringRequestMappingMethod extends SpringControllerMethod {
107
- Annotation requestMappingAnnotation ;
119
+ SpringRequestMappingAnnotation requestMappingAnnotation ;
108
120
109
121
SpringRequestMappingMethod ( ) {
110
122
// Any method that declares the @RequestMapping annotation, or overrides a method that declares
111
123
// the annotation. We have to do this explicit check because the @RequestMapping annotation is
112
124
// not declared with @Inherited.
113
125
exists ( Method superMethod |
114
126
this .overrides * ( superMethod ) and
115
- requestMappingAnnotation = superMethod .getAnAnnotation ( ) and
116
- requestMappingAnnotation .getType ( ) instanceof SpringRequestMappingAnnotationType
127
+ requestMappingAnnotation = superMethod .getAnAnnotation ( )
117
128
)
118
129
}
119
130
120
131
/** Gets a request mapping parameter. */
121
132
SpringRequestMappingParameter getARequestParameter ( ) { result = getAParameter ( ) }
122
133
123
134
/** Gets the "produces" @RequestMapping annotation value, if present. */
124
- Expr getProducesExpr ( ) { result = requestMappingAnnotation .getValue ( "produces" ) }
135
+ Expr getProducesExpr ( ) {
136
+ result = requestMappingAnnotation .getValue ( "produces" )
137
+ or
138
+ requestMappingAnnotation .getValue ( "produces" ) .( ArrayInit ) .getSize ( ) = 0 and
139
+ result = getProducesExpr ( this .getDeclaringType ( ) )
140
+ }
125
141
126
142
/** Gets the "produces" @RequestMapping annotation value, if present. */
127
143
Expr getAProducesExpr ( ) {
0 commit comments