How to Modify JVM Options Before Running a Method?

I’m planning to develop a plugin project for IntelliJ IDEA. The goal is that when you click the Run icon next to a method in IDEA, the IDE will run that method as usual. This plugin should add the following functionality:

  1. If the method has annotations like @JvmOption above it, extract the contents of these annotations in order and concatenate them. For example:
    @JvmOption("-XX:+UnlockExperimentalVMOptions")
    @JvmOption("-Xms512M -Xmx512M")
  2. Take the concatenated result and set it as the VM options for running the method.
  3. Then, run the method with these VM options.

I’m new to plugin development and not sure where to begin—I’ve only created a basic initial project so far. Are there any open-source projects you would recommend for reference or to help me learn best practices?

The problem is solved. I found the solution here: