GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support deprecated tag. by kwin · Pull Request #2059 · apache/maven-resolver

Support deprecated tag. #2059

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.

Sign up for GitHub

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

Merged
kwin merged 1 commit into master from feature/deprecated-tag-support
Aug 18, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Support deprecated tag. #2059

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
2344268
Support deprecated tag.
kwin Aug 17, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

3 changes: 2 additions & 1 deletion 3 maven-resolver-tools/src/main/java/org/eclipse/aether/tools/CollectConfiguration.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public static void main(String[] args) {
"since",
"configurationSource",
"configurationType",
"supportRepoIdSuffix");
"supportRepoIdSuffix",
"deprecated");

/**
* Javadoc block tag marking a constant field as a configuration key.
Expand Down
76 changes: 71 additions & 5 deletions 76 ...n-resolver-tools/src/main/java/org/eclipse/aether/tools/ConfigurationCollectorDoclet.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.util.Properties;
import java.util.Set;

import com.sun.source.doctree.DeprecatedTree;
import com.sun.source.doctree.DocCommentTree;
import com.sun.source.doctree.DocTree;
import com.sun.source.doctree.EntityTree;
Expand Down Expand Up @@ -122,7 +123,9 @@ private record ConfigurationEntry(
String since,
String source,
String type,
boolean supportsRepoIdSuffix) {
boolean supportsRepoIdSuffix,
// is empty if not deprecated
String deprecated) {

public ConfigurationEntry {
Objects.requireNonNull(key);
Expand Down Expand Up @@ -188,7 +191,9 @@ public boolean run(DocletEnvironment environment) {
try {
return doRun(environment);
} catch (RuntimeException e) {
reportError("Error running ConfigurationCollectorDoclet: " + e.getMessage());
// catch all runtime exception, as the default javadoc tool emits a confusing message about reporting
// something with Oracle
reportError("Error running ConfigurationCollectorDoclet", e);
return false;
}
}
Expand Down Expand Up @@ -258,6 +263,10 @@ private boolean doRun(DocletEnvironment environment) {
*/
private void reportError(DocTreePath path, Throwable throwable) {
reportError(path, throwable.getMessage());
reportError(throwable);
}

private void reportError(Throwable throwable) {
// also emit stack trace
PrintWriter pw = reporter.getDiagnosticWriter();
if (pw == null) {
Expand All @@ -280,6 +289,17 @@ private void reportError(DocTreePath path, String message) {
}
}

/**
* Reports a global error message without location information.
*
* @param message the error message
* @param throwable the exception whose stack trace is printed
*/
private void reportError(String message, Throwable throwable) {
reporter.print(Diagnostic.Kind.ERROR, message);
reportError(throwable);
}

/**
* Reports a global error message without location information.
*
Expand Down Expand Up @@ -310,7 +330,42 @@ private ConfigurationEntry processResolverField(DocTreePath path, VariableElemen
getSince(path).orElse(""),
getConfigurationSource(path, blockTags).orElse(""),
getConfigurationType(path, blockTags),
isSupportsRepoIdSuffix(path, blockTags));
isSupportsRepoIdSuffix(path, blockTags),
getDeprecated(path, field).orElse(""));
}

private Optional<String> getDeprecated(DocTreePath path, Element element) {
Objects.requireNonNull(path, "path must not be null");
Objects.requireNonNull(element, "field must not be null");

// first check for deprecated annotation
if (element.getAnnotation(Deprecated.class) == null) {
// if not existing check enclosing elements recursively
return getDeprecated(element.getEnclosingElement());
}
Optional<? extends DocTree> deprecatedTag = path.getDocComment().getBlockTags().stream()
.filter(t -> com.sun.source.doctree.DocTree.Kind.DEPRECATED == t.getKind())
.findFirst();
if (deprecatedTag.isPresent()) {
return Optional.of(renderContent(DocTreePath.getPath(path, deprecatedTag.get()), RenderMode.HTML, true));
}
return Optional.of("");
}

private Optional<String> getDeprecated(Element element) {
if (element == null) {
return Optional.empty();
}
DocCommentTree docCommentTree = docTrees.getDocCommentTree(element);
if (docCommentTree == null) {
if (element.getAnnotation(Deprecated.class) != null) {
return Optional.of("");
}
// traverse to enclosing element
return getDeprecated(element.getEnclosingElement());
Comment thread
kwin marked this conversation as resolved.
Resolved

Uh oh!

There was an error while loading. Please reload this page.

} else {
return getDeprecated(new DocTreePath(docTrees.getPath(element), docCommentTree), element);
}
}

private boolean isSupportsRepoIdSuffix(DocTreePath path, Map<String, UnknownBlockTagTree> blockTags) {
Expand Down Expand Up @@ -380,7 +435,6 @@ private ConfigurationEntry processMavenField(DocTreePath path, VariableElement f
} else if (configurationType.startsWith("java.util.")) {
configurationType = configurationType.substring("java.util.".length());
}

return new ConfigurationEntry(
String.valueOf(field.getConstantValue()),
path.getDocComment() != null ? getFullBodyContent(path) : "",
Expand All @@ -389,7 +443,8 @@ private ConfigurationEntry processMavenField(DocTreePath path, VariableElement f
getSince(path).orElse(""),
source,
configurationType,
false);
false,
getDeprecated(path, field).orElse(""));
}

private AnnotationMirror getAnnotation(Element element, String fqName) {
Expand Down Expand Up @@ -427,12 +482,16 @@ private void writeEntry(Properties properties, ConfigurationEntry entry, String
properties.setProperty(prefix + "configurationSource", entry.source());
properties.setProperty(prefix + "configurationType", entry.type());
properties.setProperty(prefix + "supportRepoIdSuffix", toYesNo(entry.supportsRepoIdSuffix()));
properties.setProperty(prefix + "deprecated", entry.deprecated());
}

// --- Javadoc extraction helpers -------------------------------------------------------------------------------

private Map<String, UnknownBlockTagTree> collectBlockTags(DocCommentTree docComment) {
Map<String, UnknownBlockTagTree> result = new LinkedHashMap<>();
if (docComment == null) {
return result;
}
for (DocTree tag : docComment.getBlockTags()) {
if (tag instanceof UnknownBlockTagTree unknownBlockTree) {
result.put(unknownBlockTree.getTagName(), unknownBlockTree);
Expand Down Expand Up @@ -675,6 +734,13 @@ public String visitSince(SinceTree node, Void p) {
return escape(mode, node.getBody().toString());
}

@Override
public String visitDeprecated(DeprecatedTree node, Void p) {
StringBuilder sb = new StringBuilder();
node.getBody().forEach(child -> sb.append(child.accept(this, p)));
return sb.toString();
}

@Override
protected String defaultAction(DocTree node, Void p) {
// the default action internally calls node.toString(), which uses
Expand Down
2 changes: 1 addition & 1 deletion 2 maven-resolver-tools/src/main/resources/configuration.md.vm
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To modify this file, edit the template and regenerate.
| Key | Type | Description | Default Value | Since | Supports Repo ID suffix | Source |
| --- | --- | --- | --- | --- | --- | --- |
#foreach($key in $keys)
| `$key.key` | `$key.configurationType` | $key.description | #value( $key.defaultValue ) | $key.since | $key.supportRepoIdSuffix | $key.configurationSource |
| `$key.key` | `$key.configurationType` | #if($key.deprecated) **Deprecated**. *$key.deprecated*<br/>#end$key.description | #value( $key.defaultValue ) | $key.since | $key.supportRepoIdSuffix | $key.configurationSource |
#end

#[[
Expand Down
2 changes: 2 additions & 0 deletions 2 ...solver-tools/src/test/java/org/eclipse/aether/tools/ConfigurationCollectorDocletTest.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ void extractsBooleanStringAndEnumConfigurations(@TempDir Path tempDir) throws Ex
assertEquals("No", bool.get("supportRepoIdSuffix"));
assertEquals("Java System Properties", bool.get("configurationSource"));
assertEquals("A boolean flag.", bool.get("description"));
assertEquals("", bool.get("deprecated"));

Map<String, String> string = keys.get("sample.string");
assertNotNull(string, "string key missing");
Expand All @@ -118,6 +119,7 @@ void extractsBooleanStringAndEnumConfigurations(@TempDir Path tempDir) throws Ex
assertEquals("VALUE_A", enumKey.get("defaultValue"));
// no @configurationRepoIdSuffix -> defaults to "No"
assertEquals("No", enumKey.get("supportRepoIdSuffix"));
assertEquals("Use <code>#ENUM2_KEY</code> instead", enumKey.get("deprecated"));

Map<String, String> enum2Key = keys.get("sample.enum2");
assertNotNull(enum2Key, "enum key missing");
Expand Down
2 changes: 2 additions & 0 deletions 2 ...-resolver-tools/src/test/resources/org/eclipse/aether/sample/SampleConfigurationKeys.java
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public final class SampleConfigurationKeys {
* @configurationSource {@link System#getProperty(String,String)}
* @configurationType {@link SampleEnum}
* @configurationDefaultValue {@link #DEFAULT_ENUM}
* @deprecated Use {@link #ENUM2_KEY} instead
*/
@Deprecated()
public static final String ENUM_KEY = "sample.enum";

public static final SampleEnum DEFAULT_ENUM = SampleEnum.VALUE_A;
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.