playframework / play1

Play framework
https://www.playframework.com/documentation/1.4.x/home
Other
1.58k stars 683 forks source link

IO / play precompile broken #1450

Open JohannesBeranek opened 9 months ago

JohannesBeranek commented 9 months ago

Play Version (1.5.x / etc)

framework/src/play/libs/IO.java broken in d6dae446e6bf3f61cc9b21431fae1713b6d782fe

Issue

We've been using play 1 for about 10 years now, together with lombok.

Recently tried to update to master and hit an issue where our lombok module python before() method was not executed - turned out the commands.py wasn't copied.

By going back and forth with versions and individual files I could nail down the file and revision at fault.

I don't know the exact change yet, but in 576fcc0de4a0a071dc7a2e6197d97d9c88b7ce43

everything works.

Going to d6dae446e6bf3f61cc9b21431fae1713b6d782fe our lombok module isn't running anymore when precompile is executed.

Switching just framework/src/play/libs/IO.java back to the previous commit 576fcc0de4a0a071dc7a2e6197d97d9c88b7ce43 everything works again.

Same with master - if I just switch that single file back, everything works again.

Reproducible Test Case

Add a module with a before(...) function in commands.py and add some print statement there. Now run play precompile and you should see the difference. Didn't test this exact case, as this is just fyi, as we're probably going to fork play going forward, as it seems there won't be much development happening anymore.

aleksandy commented 9 months ago

Hi, @JohannesBeranek. I'm the author of the d6dae446e6bf3f61cc9b21431fae1713b6d782fe. Could you provide the minimal example are reproducing the issue? Or output (stdout/stderr) of the precompile process at least.

JohannesBeranek commented 9 months ago

@aleksandy Besides what I wrote under "Reproducible Test Case", try the attached module lombok-module.zip

Then just use some lombok, e.g.

import lombok.Getter;

class Whatever {
   @Getter
   private int testValue = 5;

   public static int test() {
    var x = new Whatever();
    return x.getTestValue();
   }
}

The precompile phase will err out due to "method getTest() does not exist" or something similar (depending on your exact java version etc).

aleksandy commented 9 months ago

I'm not too familiar with python but in my opinion the cause is here. Because your module defines javaagent in before-hook but the method does not take into account the available value of "-javaagent:".

JohannesBeranek commented 9 months ago

@aleksandy no, it works with that code. I've put print statements in python and java code and with the latest version the before just isn't triggered anymore on precompile. It's pretty simple to reproduce probable - add a module with a before hook in commands.py that just prints some statement (e.g. print("BEFORE")) and compare the 1.7.1 release zip version to latest master when doing precompile.

JohannesBeranek commented 9 months ago

Also @aleksandy just switching framework/src/play/libs/IO.java fixes the issue, so some change there broke it.