Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid deprecated and internal API usage #83

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [#77](https://github.com/pmd/pmd-designer/pull/77) Enable PMD checks with PMD 7 by [@adangel](https://github.com/adangel)
* [#78](https://github.com/pmd/pmd-designer/pull/78) Fix deprecations from PMD 7 (getTerseName -> getId) by [@adangel](https://github.com/adangel)
* [#79](https://github.com/pmd/pmd-designer/pull/79) Update to latest PMD 7.0.0-SNAPSHOT by [@adangel](https://github.com/adangel)
* [#83](https://github.com/pmd/pmd-designer/pull/83) Avoid deprecated and internal API usage by [@adangel](https://github.com/adangel)

## 7.0.0-rc4

Expand Down
10 changes: 9 additions & 1 deletion config/pmd-check.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@
<properties>
<property name="xpath">
<value><![CDATA[
//ImportDeclaration[starts-with(@PackageName, "net.sourceforge.pmd.") and contains(@PackageName, ".internal")]
//ImportDeclaration
[ends-with(@ImportedName, 'InternalApiBridge')]
|
//ImportDeclaration
[starts-with(@PackageName, "net.sourceforge.pmd.") and contains(@PackageName, ".internal")]
(: allow PropertyTypeId - the designer is for now the only client. Until then it stays internal,
but is used by the designer.
:)
[@ImportedName != 'net.sourceforge.pmd.properties.internal.PropertyTypeId']
]]></value>
</property>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.reactfx.value.SuspendableVar;
import org.reactfx.value.Val;
import org.reactfx.value.Var;
import org.slf4j.event.Level;

import net.sourceforge.pmd.lang.JvmLanguagePropertyBundle;
import net.sourceforge.pmd.lang.Language;
Expand All @@ -42,7 +40,7 @@
import net.sourceforge.pmd.util.fxdesigner.model.ParseAbortedException;
import net.sourceforge.pmd.util.fxdesigner.util.AuxLanguageRegistry;
import net.sourceforge.pmd.util.fxdesigner.util.Tuple3;
import net.sourceforge.pmd.util.log.MessageReporter;
import net.sourceforge.pmd.util.log.PmdReporter;


/**
Expand All @@ -53,24 +51,7 @@
*/
public class ASTManagerImpl implements ASTManager {

public static final MessageReporter NOOP_REPORTER = new MessageReporter() { // todo replace with MessageReporter.noop
@Override
public boolean isLoggable(Level level) {
return false;
}


@Override
public void logEx(Level level, @Nullable String s, Object[] objects, @Nullable Throwable throwable) {
// noop
}


@Override
public int numErrors() {
return 0;
}
};
public static final PmdReporter NOOP_REPORTER = PmdReporter.quiet();

private final DesignerRoot designerRoot;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import net.sourceforge.pmd.properties.NumericConstraints;
import net.sourceforge.pmd.properties.PropertyBuilder;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.properties.PropertyTypeId;
import net.sourceforge.pmd.properties.internal.PropertyTypeId;
import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsOwner;
import net.sourceforge.pmd.util.fxdesigner.util.beans.SettingsPersistenceUtil.PersistentProperty;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.reactfx.value.Var;

import net.sourceforge.pmd.properties.PropertySerializer;
import net.sourceforge.pmd.properties.PropertyTypeId;
import net.sourceforge.pmd.properties.internal.PropertyTypeId;
import net.sourceforge.pmd.util.fxdesigner.app.ApplicationComponent;
import net.sourceforge.pmd.util.fxdesigner.app.DesignerRoot;
import net.sourceforge.pmd.util.fxdesigner.model.PropertyDescriptorSpec;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.rule.RulePriority;
import net.sourceforge.pmd.lang.rule.xpath.XPathVersion;
import net.sourceforge.pmd.properties.PropertyTypeId;
import net.sourceforge.pmd.properties.internal.PropertyTypeId;
import net.sourceforge.pmd.util.fxdesigner.app.DesignerRoot;
import net.sourceforge.pmd.util.fxdesigner.model.ObservableRuleBuilder;
import net.sourceforge.pmd.util.fxdesigner.model.ObservableXPathRuleBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.document.TextRegion;
import net.sourceforge.pmd.lang.rule.RulePriority;
import net.sourceforge.pmd.properties.PropertyTypeId;
import net.sourceforge.pmd.properties.internal.PropertyTypeId;
import net.sourceforge.pmd.util.fxdesigner.util.AuxLanguageRegistry;
import net.sourceforge.pmd.util.fxdesigner.util.beans.converters.Serializer;
import net.sourceforge.pmd.util.fxdesigner.util.beans.converters.SerializerRegistrar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,8 @@ private void updateAttr(@Nullable Attribute attr) {
return;
}

String replacement = attr.replacementIfDeprecated();
if (replacement != null) {
if (attr.isDeprecated()) {
String txt = "This attribute is deprecated";
if (!replacement.isEmpty()) {
txt += ", please use " + replacement + " instead";
}
Tooltip t = new Tooltip(txt);
tooltip = t;
getStyleClass().add(DEPRECATED_CSS_CLASS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.reactfx.value.Val;
import org.reactfx.value.Var;

import net.sourceforge.pmd.properties.PropertyTypeId;
import net.sourceforge.pmd.properties.internal.PropertyTypeId;
import net.sourceforge.pmd.util.fxdesigner.app.ApplicationComponent;
import net.sourceforge.pmd.util.fxdesigner.app.DesignerRoot;
import net.sourceforge.pmd.util.fxdesigner.model.ObservableXPathRuleBuilder;
Expand Down