soot-oss / SootUp

A new version of Soot with a completely overhauled architecture
https://soot-oss.github.io/SootUp/
GNU Lesser General Public License v2.1
590 stars 81 forks source link

add HasAnnotation for JavaSootClass, JavaSootField and JavaSootMethod #1107

Closed Liyw979 closed 1 month ago

Liyw979 commented 1 month ago

like sootup.core.model.HasPosition

In the follwing case, I want to get urls from class(/fruit) and method (/lychee) and get the full url.

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/fruits")
public class LycheeController {

    @GetMapping("/lychee")
    public String getLychee() {
        return "Here is a fresh lychee!";
    }
}

by adding the HasPosition interface, users could write functions like

String getUrl(has: HasAnnotation) { // "has" could be JavaSootClass or JavaSootMethod
    has.getAnnotations .....
}
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 72.26%. Comparing base (ba277d8) to head (df89fa8). Report is 100 commits behind head on develop.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1107 +/- ## ============================================== + Coverage 39.69% 72.26% +32.57% - Complexity 4446 4975 +529 ============================================== Files 657 439 -218 Lines 29522 18671 -10851 Branches 4803 3091 -1712 ============================================== + Hits 11719 13493 +1774 + Misses 16894 4096 -12798 - Partials 909 1082 +173 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.