leinardi / pylint-pycharm

A plugin providing both real-time and on-demand scanning of Python files with PyLint from within PyCharm/IDEA.
Apache License 2.0
198 stars 36 forks source link

Exception `ActionUpdateThread.OLD_EDT` is deprecated after updating to Intellij IDEA 2024.2.0 #105

Closed mbamba-np closed 1 month ago

mbamba-np commented 3 months ago

Step 1: Are you in the right place?

Step 2: Describe your environment

Step 3: Describe the problem:

Steps to reproduce:

Happens randomly working on python files. Then suddenly a popup comes up showing the exception and asking me to disable the pylint plugin.

Observed Results:

intellij_pylint_plugin_exception

Expected Results:

Relevant Code:

com.intellij.diagnostic.PluginException: `ActionUpdateThread.OLD_EDT` is deprecated and going to be removed soon. 'com.leinardi.pycharm.pylint.actions.ScanCurrentFile' must override `getActionUpdateThread()` and chose EDT or BGT. See ActionUpdateThread javadoc. [Plugin: com.leinardi.pycharm.pylint]
    at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:23)
    at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:90)
    at com.intellij.diagnostic.PluginException.reportDeprecatedUsage(PluginException.java:125)
    at com.intellij.openapi.actionSystem.ActionUpdateThreadAware.getActionUpdateThread(ActionUpdateThreadAware.java:21)
    at com.intellij.openapi.actionSystem.AnAction.getActionUpdateThread(AnAction.java:201)
jennifer-richards commented 2 months ago

In case it's useful to anyone, I've squelched the exceptions in this branch - https://github.com/jennifer-richards/pylint-pycharm/tree/get-action-update-thread

Caveat: I don't actually know what I'm doing or whether returning BGT for everything is appropriate. It seems to work for me. I hesitate to even post it, but perhaps it'll be helpful until the maintainers can make a proper update. (And thanks to them for their efforts!)

leinardi commented 1 month ago

@jennifer-richards Thanks for the help, I just created a PR that should fix this issue, if you have time could you take a look and confirm if it fixes it also for you? #106

jennifer-richards commented 1 month ago

@jennifer-richards Thanks for the help, I just created a PR that should fix this issue, if you have time could you take a look and confirm if it fixes it also for you? #106

Can confirm - did a quick test and it didn't throw any errors scaning a project and poking around in the UI.

Thanks for the fix!

quandaica commented 1 month ago

I got this error after upgrade to 0.16.3 version

The scan failed due to an exception: Use JsonReader.setLenient(true) to accept malformed JSON at path $ Root cause: Use JsonReader.setLenient(true) to accept malformed JSON at path $ com.squareup.moshi.JsonEncodingException: Use JsonReader.setLenient(true) to accept malformed JSON at path $ 
    at com.squareup.moshi.JsonReader.syntaxError(JsonReader.java:243) 
    at com.squareup.moshi.JsonUtf8Reader.checkLenient(JsonUtf8Reader.java:1152) 
    at com.squareup.moshi.JsonUtf8Reader.doPeek(JsonUtf8Reader.java:384) 
    at com.squareup.moshi.JsonUtf8Reader.peek(JsonUtf8Reader.java:206) 
    at com.squareup.moshi.internal.NullSafeJsonAdapter.fromJson(NullSafeJsonAdapter.java:38) 
    at com.squareup.moshi.JsonAdapter.fromJson(JsonAdapter.java:58) 
    at com.leinardi.pycharm.pylint.plapi.PylintRunner.scan(PylintRunner.java:280) 
    at com.leinardi.pycharm.pylint.checker.ScanFiles.scan(ScanFiles.java:109) 
    at com.leinardi.pycharm.pylint.checker.ScanFiles.checkFiles(ScanFiles.java:100) 
    at com.leinardi.pycharm.pylint.checker.ScanFiles.call(ScanFiles.java:74) 
    at com.leinardi.pycharm.pylint.checker.ScanFiles.call(ScanFiles.java:46) 
    at com.intellij.openapi.application.impl.RwLockHolder$executeOnPooledThread$2.call(RwLockHolder.kt:182) 
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) 
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702) 
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699) 
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) 
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699) 
    at java.base/java.lang.Thread.run(Thread.java:840) 
leinardi commented 1 month ago

Hi @quandaica, I'm unable to reproduce the issue. Would you be able to confirm that this is actually a regression? In theory the 0.16.3 changes should not affect this portion of the code so I'm just wondering if it is an unrelated issue. Is anyone else getting this? In any case doesn't seem related to the ActionUpdateThread.OLD_EDT, could you please open a dedicated issue and provide, if possible, a simple reproduction project?