apache / apache/dubbo

[Feature] Improve AddressMatch CIDR field naming while keeping backward compatibility

Open
#16,314 1 comment 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

### Pre-check

- [x] I am sure that all the content I provide is in English.

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar feature requirement.

### Apache Dubbo Component

Java SDK (apache/dubbo)

### Descriptions

While working on PR #16309, I noticed that `AddressMatch` uses `cird` as the field and accessor method name:
```java
private String cird;

public String getCird() {
return cird;
}

public void setCird(String cird) {
this.cird = cird;
}
```
Based on the address matching logic, this field is used for `CIDR/IP` expression matching. It seems that `cird` may be a typo of `cidr`, since the correct networking term is `CIDR`, which stands for Classless Inter-Domain Routing.
Since `getCird` / `setCird` may already be used by configuration binding, serialization, or external code, directly renaming them may introduce compatibility risks.
I would like to propose adding backward-compatible `cidr` accessors while keeping the existing `cird` accessors.
```java
private String cidr;

public String getCidr() {
return cidr;
}

public void setCidr(String cidr) {
this.cidr = cidr;
}

/**
* @deprecated use {@link #getCidr()} instead.
*/
@Deprecated
public String getCird() {
return cidr;
}

/**
* @deprecated use {@link #setCidr(String)} instead.
*/
@Deprecated
public void setCird(String cird) {
this.cidr = cird;
}
```
This keeps backward compatibility while making the intended CIDR naming clearer for future usage.

### Related issues

_No response_

### Are you willing to submit a pull request to fix on your own?

- [x] Yes I am willing to submit a pull request on my own!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Start by locating the AddressMatch class and reading its existing cird accessors and address-matching callers, including the changes discussed in PR #16309. Check how configuration binding and serialization use these accessors, then run the relevant existing tests; done means CIDR-named accessors work while the deprecated cird accessors remain compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.