-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P3
-
Affects Version/s: None
-
Component/s: core-libs
-
b149
-
Not verified
Class.isAnonymousClass is implemented as:
public boolean isAnonymousClass() {
return "".equals(getSimpleName());
}
However, getSimpleName generates quite a few superfluous objects that could be avoided if isAnonymousClass was implemented to check the conditions that will lead it to return "" more directly:
public boolean isAnonymousClass() {
return !isArray() && getEnclosingMethodInfo() != null &&
getSimpleBinaryName0() == null;
}
This reduces the average cost of isAnonymousClass by around 65%, which should be worthwhile since this is both a public API and a component of other internal methods in wide internal use.
public boolean isAnonymousClass() {
return "".equals(getSimpleName());
}
However, getSimpleName generates quite a few superfluous objects that could be avoided if isAnonymousClass was implemented to check the conditions that will lead it to return "" more directly:
public boolean isAnonymousClass() {
return !isArray() && getEnclosingMethodInfo() != null &&
getSimpleBinaryName0() == null;
}
This reduces the average cost of isAnonymousClass by around 65%, which should be worthwhile since this is both a public API and a component of other internal methods in wide internal use.