-
Bug
-
Resolution: Unresolved
-
Critical
-
MTA 8.0.1
-
None
Description of problem:
Annotations don't match if the import for the annotation itself in the target class is done using *.
For example, for spring-framework-5.x-to-6.0-web-applications-00001 (after the fix in MTA-6529) the following would match for the second GetMapping annotation:
import com.modern.insurance.dto.AgentDTO; import com.modern.insurance.dto.ApiResponse; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import java.util.List; @Controller @RequestMapping("/api/v1/agents") public interface AgentOperations { @GetMapping ResponseEntity<ApiResponse<List<AgentDTO>>> getAllAgents(); @GetMapping("/{id}/") ResponseEntity<ApiResponse<AgentDTO>> getAgentById(@PathVariable Long id); @GetMapping("/office/{location}") ResponseEntity<ApiResponse<List<AgentDTO>>> getAgentsByOffice(@PathVariable String location); }
But it wouldn't match on the GetMapping annotation on this:
package com.modern.insurance.controller; import com.modern.insurance.dto.ApiResponse; import com.modern.insurance.dto.ApplicationCreateDTO; import com.modern.insurance.dto.ApplicationDTO; import com.modern.insurance.service.ApplicationService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; @Api(tags = "Application Management", description = "Operations for managing policy applications") @RestController @RequestMapping("/api/v1/applications") public class ApplicationController { private static final Logger logger = LoggerFactory.getLogger(ApplicationController.class); @Autowired private ApplicationService applicationService; @ApiOperation(value = "Get pending applications") @GetMapping("/pending/") public ResponseEntity<ApiResponse<List<ApplicationDTO>>> getPendingApplications() { logger.info("GET request to fetch pending applications"); List<ApplicationDTO> applications = applicationService.getPendingApplications(); return ResponseEntity.ok(ApiResponse.success(applications)); } }
Version-Release number of selected component (if applicable):
MTA 8.0.1
How reproducible:
Always
Steps to Reproduce:
See explanation above
Additional info:
This was fixed for the IMPORT location in MTA-4027. Apparently it needs to be fixed for all locations, not only ANNOTATION like depicted on this issue.
- relates to
-
MTA-4027 [Ruleset] Import statements with * are not matched
-
- Closed
-