diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b70a3..96410f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ # PMDPlugin Changelog ## [Unreleased] +### Added +- Update to PMD version 7.2.0 +- Fix issue with disabled PMD predefined rules menu + ## [2.0.0] ### Added - Update to PMD version 7.1.0 diff --git a/build.gradle.kts b/build.gradle.kts index b20efae..4d727f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile fun properties(key: String) = project.findProperty(key).toString() -val pmdVersion = "7.1.0" +val pmdVersion = "7.2.0" plugins { id("java") diff --git a/gradle.properties b/gradle.properties index ba73099..061b6ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ # pluginGroup = com.intellij.plugins.bodhi.pmd pluginName = PMDPlugin -pluginVersion = 2.0.0 +pluginVersion = 2.0.1 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. diff --git a/src/main/java/com/intellij/plugins/bodhi/pmd/actions/PreDefinedMenuGroup.java b/src/main/java/com/intellij/plugins/bodhi/pmd/actions/PreDefinedMenuGroup.java index 09deeb5..eee34f2 100644 --- a/src/main/java/com/intellij/plugins/bodhi/pmd/actions/PreDefinedMenuGroup.java +++ b/src/main/java/com/intellij/plugins/bodhi/pmd/actions/PreDefinedMenuGroup.java @@ -9,6 +9,7 @@ import com.intellij.plugins.bodhi.pmd.PMDUtil; import org.jetbrains.annotations.Nullable; +import java.io.InputStream; import java.util.Properties; /** @@ -45,7 +46,7 @@ public void actionPerformed(AnActionEvent e) { Properties props = new Properties(); try { //Load the property file which has all the rulesets. - props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream(RULESETS_PROPERTY_FILE)); + props.load(getRuleResourceStream()); String[] rulesetFilenames = props.getProperty(RULESETS_FILENAMES_KEY).split(PMDInvoker.RULE_DELIMITER); //We have 'All' rules in addition to the rulesets @@ -67,11 +68,18 @@ public void actionPerformed(AnActionEvent e) { children.add(ruleAction); } } catch (Exception e) { - //Should not happen - //e.printStackTrace(); + throw new RuntimeException(e); } } + private @Nullable InputStream getRuleResourceStream() { + InputStream resourceAsStream = getClass().getClassLoader().getResourceAsStream(RULESETS_PROPERTY_FILE); + if (resourceAsStream == null) { + return Thread.currentThread().getContextClassLoader().getResourceAsStream(RULESETS_PROPERTY_FILE); + } + return resourceAsStream; + } + public AnAction[] getChildren(@Nullable AnActionEvent event) { return new AnAction[]{this.children}; }