intellij-platform-gradle-plugin icon indicating copy to clipboard operation
intellij-platform-gradle-plugin copied to clipboard

instrumented code persists even using Gradle IntelliJ Plugin Version 1.13.3 -- How do I get rid of it??

Open nissenbenyitskhak opened this issue 2 years ago • 2 comments

Describe the bug After switching to Gradle IntelliJ Plugin Version 1.13.0, my project got "infected" by a bunch of classes and jars containing "instrumented code" and I am no longer able to edit or debug code in my project. The editor accepts changes, but upon a complete rebuild, none of my changes are present in the executable code during debugging. Instead, the old class files are still being used, so the debugger complains that the source and executables do not match. Apparently, the class files being used are in the "instrumented code" somewhere.

I found https://github.com/JetBrains/gradle-intellij-plugin/issues/1310 which said that the problem was in 1.13.0 and was fixed in 1.13.1. I upgraded to the latest Gradle IntelliJ Plugin Version 1.13.3, and rebuilt my project, and it still finds the old code while debugging. I tried to find all the places where instrumented code might be and hand-deleted all the files I found, but it still finds the old classes when I debug my project!

The debugger happily lets me step through my code, but reports that the source and class files are out of sync, and ends up with the cursor sitting on comments, and other nonsense. Looking at the local variables as I step, it is clear that the debugger is stepping through the old code, not the latest source, even though it displays the latest source. I have tried Invalidating Cache and doing a complete rebuild. Nothing seems to get me out of this "hell".

To Reproduce AFAIK, build a complex project with Gradle IntelliJ Plugin Version 1.13.0 and see that there is "instrumented" and "instrumentCode" subdirectories under all the "build" folders. Switch to 1.13.3, invalidate caches, do a complete rebuild, and still see all that "instrumentCode". Try deleting all the "instrumentCode" directories and try again. Still have the problem. Also note that I am debugging tests of my project through Gradle, as well as just debugging the code.

Expected behavior There should not be any instrumented code, and if there is, it should get recompiled during a complete rebuild so the class files match the source.

Environment:

  • OS: MacOS 13.2.1 M1 Processor
  • Gradle IntelliJ Plugin Version 1.13.3
  • Gradle Version [e.g. 7.5]
  • IJ 2022.3.2 Ultimate 223.8617.56

nissenbenyitskhak avatar Apr 04 '23 18:04 nissenbenyitskhak

There are a ton of "instrumented" directories, including "instrumented", "instrumentCode", "instrumentTestCode", "instrumentJar", and "instrumented--SNAPSHOT.jar". They are all over the place. I tried the following in my project: % find . -name "*instrument*" -exec rm -rf {} \; which deletes all the jars, directories, etc. that have "instrument" anywhere in their name. I still see the debugger bringing up my latest source file, but clearly executing the old code. FYI, here are the "instrument" files that were found in my project: `% find . -name "instrument"

./ij-studio/build/tmp/instrumentTestCode ./ij-studio/build/tmp/instrumentedJar ./ij-studio/build/idea-sandbox/plugins/ij-studio/lib/instrumented-ij-studio-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar ./build/tmp/instrumentedJar ./build/idea-sandbox/plugins/aggregate/lib/instrumented-aggregate.jar ./build/idea-sandbox/plugins/ij-studio/lib/instrumented-ij-studio-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar ./build/idea-sandbox/plugins/ij-gosu/lib/instrumented-ij-gosu-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar ./build/idea-sandbox/plugins/ij-studio-extras/lib/instrumented-ij-studio-extras-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar ./ij-gosu/build/tmp/instrumentTestCode ./ij-gosu/build/tmp/instrumentedJar ./ij-gosu/build/idea-sandbox/plugins/ij-gosu/lib/instrumented-ij-gosu-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar ./ij-studio-extras/build/libs/instrumented-ij-studio-extras-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar ./ij-studio-extras/build/tmp/instrumentedJar ./ij-studio-extras/build/idea-sandbox/plugins/ij-studio-extras/lib/instrumented-ij-studio-extras-dev-latest-bob-d22-ISSTUDIO-1010-SNAPSHOT.jar `

nissenbenyitskhak avatar Apr 04 '23 18:04 nissenbenyitskhak

I am now using 1.13.3. I have deleted by hand all the "instrumented" files and they are no longer being recreated by a rebuild. Yet I still see at debug-time the old, obsolete class with the source displayed as the new source.

nissenbenyitskhak avatar Apr 04 '23 21:04 nissenbenyitskhak

Obsolete in 2.0

hsz avatar Jul 19 '24 20:07 hsz