Task.deleteAllActions() has been deprectaed, what is the best alternative to fix this

Task.deleteAllActions() has been deprectaed in gradle 5, since I am upgrading gradle from 3.5 to 5.5.1, what should i do to fix this deprecated method call.

i replaced Task.deleteAllActions() with Task.setActions Arrays.asList() but now i am getting below error.

java.lang.OutOfMemoryError: Java heap space 13:56:58 at com.sun.tools.javac.code.Scope$ImportScope.makeEntry(Scope.java:530) 13:56:58 at com.sun.tools.javac.code.Scope.enter(Scope.java:220) 13:56:59 at com.sun.tools.javac.comp.MemberEnter$2.importFrom(MemberEnter.java:229) 13:56:59 at com.sun.tools.javac.comp.MemberEnter$2.run(MemberEnter.java:234)

Although I am not sure if this error is due to replacing Task.deleteAllActions() with Task.setActions Arrays.asList().

Please can someone suggest what is the best way to handle Task.deleteAllActions() call.

Actually, you should avoid doing that unless you have a really good reason. :slight_smile:

If you do have one, I’d just use getActions().clear().

I wouldn’t expect the OOM to be related to setting the actions to an empty list though.

1 Like

Thanks for the response @Vampire