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 and found no similar feature requirement.
Apache Dubbo Component
Java SDK (apache/dubbo)
Descriptions
- There are many unchecked issues in current dubbo-hessian-lite need to be checked or fixed.
- There are many
Class.forName
andgetDeclaredMethod
codes indubbo-hessian-lite
which should be refacted for performance optimization. e.g., LocalDateHandle.java
public LocalDateHandle(Object o) {
try {
Class c = Class.forName("java.time.LocalDate");
Method m = c.getDeclaredMethod("getYear");
this.year = (Integer) m.invoke(o);
m = c.getDeclaredMethod("getMonthValue");
this.month = (Integer) m.invoke(o);
m = c.getDeclaredMethod("getDayOfMonth");
this.day = (Integer) m.invoke(o);
} catch (Throwable t) {
// ignore
}
}
public Object readResolve() {
try {
Class c = Class.forName("java.time.LocalDate");
Method m = c.getDeclaredMethod("of", int.class, int.class, int.class);
return m.invoke(null, year, month, day);
} catch (Throwable t) {
// ignore
}
return null;
}
refact them by calling java.time.LocalDate methods directly ===>
java.time.LocalDate localDate = (java.time.LocalDate) o;
this.year = localDate.getYear();
...
return java.time.LocalDate.of(year, month, day);
see details at https://blog.csdn.net/chuohuanghan7401/article/details/101053165
Related issues
No response
Are you willing to submit a pull request to fix on your own?
- [ ] 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
Comment From: wcy666103
I'm working on it.