Skip to content

Be more strict in the NameResolver.Factory javadocs Β #8543

Closed
@ST-DDT

Description

@ST-DDT

Is your feature request related to a problem?

It's related to a problem/change of behavior of the NameResolverRegistry introduced in #8323
Due to that change the NameResolvers will only be invoked if their getDefaultScheme() matches the specified scheme.
I previously watched for/used both the "default" scheme and an alias.

Describe the solution you'd like

Please change the javadocs to contain a hint, that the scheme used in the newNameResolver must be the same and only as the default scheme (or at least that no other schemes will be checked).

Describe alternatives you've considered

Add a new method that assumes that the check has already been done, with the newNameResolver being implemented to do the checks and then invoke the new method. Later that method should be marked as final to disallow invalid behavior.

@Nullable
public final NameResolver newNameResolver(URI targetUri, NameResolver.Args args) {
    if (getDefaultScheme().equals(targetUri.getScheme())) {
        return createNameResolver(targetUri, args);
    }
    return null;
}

@NotNull
protected abstract NameResolver createNameResolver(URI targetUri, NameResolver.Args args);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions