Skip to content

Commit

Permalink
Modify the implementation of isUnnamedClass()
Browse files Browse the repository at this point in the history
Change the order of the checks to do modifier check first

Closes eclipse-openj9#17725

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
  • Loading branch information
hangshao0 committed Jul 11, 2023
1 parent a499fcf commit 0e3e1bc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions jcl/src/java.base/share/classes/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -5782,12 +5782,13 @@ public Set<AccessFlag> accessFlags() {
*/
public boolean isUnnamedClass() {
boolean rc = false;
if ((null == getEnclosingObjectClass())
&& (null == getDeclaringClass())
&& isSynthetic()
&& (Modifier.FINAL == (getModifiers() & Modifier.FINAL))
) {
rc = true;
if (!isArray()) {
int rawModifiers = getModifiersImpl();
if ((Modifier.FINAL | SYNTHETIC) == (rawModifiers & (Modifier.FINAL | SYNTHETIC))) {
if ((null == getEnclosingObjectClass()) && (null == getDeclaringClass())) {
rc = true;
}
}
}
return rc;
}
Expand Down

0 comments on commit 0e3e1bc

Please sign in to comment.