skylot/jadx · error · IllegalArgumentException
Class alias can't be empty
Error message
Class alias can't be empty
What it means
IllegalArgumentException thrown by the ClassAliasInfo constructor when the supplied short class alias name is null or empty (StringUtils.isEmpty). It is a precondition guard ensuring every class alias has a non-blank name. This is one of the few errors thrown as IllegalArgumentException rather than JadxRuntimeException.
Source
Thrown at jadx-core/src/main/java/jadx/core/dex/info/ClassAliasInfo.java:16
package jadx.core.dex.info;
import org.jetbrains.annotations.Nullable;
import jadx.core.utils.StringUtils;
class ClassAliasInfo {
private final String shortName;
@Nullable
private final String pkg;
@Nullable
private String fullName;
ClassAliasInfo(@Nullable String pkg, String shortName) {
if (StringUtils.isEmpty(shortName)) {
throw new IllegalArgumentException("Class alias can't be empty");
}
this.pkg = pkg;
this.shortName = shortName;
}
@Nullable
public String getPkg() {
return pkg;
}
public String getShortName() {
return shortName;
}
@Nullable
public String getFullName() {
return fullName;
}View on GitHub (pinned to e738a26571)
Solutions
- Validate the alias is non-blank before renaming: reject empty/whitespace and prompt the user.
- If the intent is to clear/reset an alias, use the API path that removes the alias (set alias to null) rather than setting an empty short name.
- Trim and check: if (name == null || name.trim().isEmpty()) do not call the constructor.
- Catch IllegalArgumentException at the rename-call boundary to give a user-friendly message in GUI/script contexts.
Example fix
// before
ClassAliasInfo alias = new ClassAliasInfo(pkg, newName); // throws if newName empty
// after
String name = newName == null ? "" : newName.trim();
if (name.isEmpty()) {
// clear alias instead of creating an empty one
classInfo.removeAlias();
} else {
ClassAliasInfo alias = new ClassAliasInfo(pkg, name);
} Defensive patterns
Strategy: validation
Validate before calling
String name = newName == null ? "" : newName.trim();
if (name.isEmpty()) {
// do not create an empty alias; clear it instead
return;
} Type guard
static boolean isValidAliasName(String s) {
return s != null && !s.trim().isEmpty();
} Try / catch
try {
classInfo.changeShortName(newName);
} catch (IllegalArgumentException e) {
// surface a user-friendly message in GUI/script contexts
throw new ValidationException("Class alias name must not be empty");
} Prevention
- Trim and validate alias names before renaming.
- To clear an alias, use the remove/clear API rather than an empty string.
- Catch IllegalArgumentException at the rename-call boundary for user-facing tools.
When it happens
Trigger: Calling rename/alias APIs (ClassInfo.changeShortName or anything that builds a ClassAliasInfo) with an empty or null short name - e.g. user-driven rename in the GUI with a blank field, or programmatic aliasing with an empty string.
Common situations: User clears a class alias in the jadx GUI; a deobfuscation/rename script supplies an empty name; trimming user input to empty; null passed by mistake from a mapping file.
Related errors
- Can't change package for inner class: {}
- Can't change package for inner class
- Read limit exceeded
- Please specify input file
- File not found ${file.getAbsolutePath()}
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/27c6e9b2dd8ffc82.
Report an issue: GitHub.