Skip to content

Commit

Permalink
Add option to disable inner classes names validation (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicPlayerA10 authored Aug 17, 2024
1 parent 4eb3409 commit 934ec9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/org/jetbrains/java/decompiler/main/ClassesProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ else if (simpleName != null &&
if (enclClassName == null || innerName.equals(enclClassName)) {
continue; // invalid name or self reference
}
if (rec.type == ClassNode.Type.MEMBER && !innerName.equals(enclClassName + '$' + entry.simpleName)) {
if (DecompilerContext.getOption(IFernflowerPreferences.VALIDATE_INNER_CLASSES_NAMES) &&
rec.type == ClassNode.Type.MEMBER && !innerName.equals(enclClassName + '$' + entry.simpleName)) {
continue; // not a real inner class
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ public interface IFernflowerPreferences {
@Type(Type.STRING)
String EXCLUDED_CLASSES = "excluded-classes";

@Name("Validate inner classes names")
@Description("Validates that the inner class name is correct (if it is separated using \"$\" for example BaseClass$InnerClass). If not then inner class won't be processed.")
@Type(Type.STRING)
String VALIDATE_INNER_CLASSES_NAMES = "validate-inner-classes-names";

Map<String, Object> DEFAULTS = getDefaults();

static Map<String, Object> getDefaults() {
Expand Down Expand Up @@ -458,6 +463,7 @@ static Map<String, Object> getDefaults() {
defaults.put(REMOVE_IMPORTS, "0");
defaults.put(MARK_CORRESPONDING_SYNTHETICS, "0");
defaults.put(EXCLUDED_CLASSES, "");
defaults.put(VALIDATE_INNER_CLASSES_NAMES, "1");

return Collections.unmodifiableMap(defaults);
}
Expand Down

0 comments on commit 934ec9a

Please sign in to comment.