Skip to content

GlobalDataFlow - support qualified static variables #83

Description

@crankydillo

What problem are you trying to solve?

I need to modify parts of the project based on the state of String literals that are scattered around the code-base. Ideally there would be a guarantee that any 'sink' traces back to a value that is immutable. I don't fully understand the code behind the GlobalDataFlow accumulator, but it does seem to cover quite a few of our case. However, it does not seem to work (at least in the way we expect it when a sink deals with a qualified constant (e.g. Constants.FOO).

Initially discussed here.

I have a similar use-case for enums, but I'll create a separate issue for that.

Have you considered any alternatives or workarounds?

For (public) constants, it's kind of easy to find those via a Scanning Recipe; however, there is an issue with tracking access if not public. Same for enums. But I haven't been able to solve a 'method chain' back to them, which I believe is one of the fundamental purposes of GlobalDataFlow.

Are you interested in contributing this feature to OpenRewrite?

Minimally, I'll create a test case. I have been trying to debug the code, but I'm not sure yet where the best place to work on this is. I can see that's it not going in as an 'edge', but not sure if that would be even appropriate.. Is the 'edge' the class, the qualified constant or neither:)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions