Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x: Remove unused code from ConfigAsciidocGenerator #9617

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021 Oracle and/or its affiliates.
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -300,7 +300,7 @@ private static void processMethods(SortedMap<KindDesc, Map<AccessType, MethodDes
.collect(Collectors.joining(","));

AccessType accessType = AccessType.of(withDefault, optional);
MethodDesc methodDesc = new MethodDesc(kindDesc, methodName, params, accessType);
MethodDesc methodDesc = new MethodDesc(methodName, params);

Map<AccessType, MethodDesc> typeMethods = methods.computeIfAbsent(kindDesc, (tn) -> new HashMap<>());
if (typeMethods.containsKey(accessType)) {
Expand All @@ -321,12 +321,6 @@ private static String formatParams(String text) {
;
}

private static String methodToString(Method method) {
StringBuilder sb = new StringBuilder(method.getName());
sb.append(" (").append(Arrays.toString(method.getParameters())).append(" ) : " + method.getGenericReturnType());
return sb.toString();
}

private static class KindDesc implements Comparable<KindDesc> {
private boolean generic;
private String methodSuffix;
Expand Down Expand Up @@ -389,27 +383,19 @@ public boolean accept(Method method) {
}
if (firstParamClass != null && method.getParameterCount() > 0) {
Class<?> currentFirstParameterClass = method.getParameters()[0].getType();
if (firstParamClass.isAssignableFrom(currentFirstParameterClass)) {
return true;
} else {
//System.out.println("Not acceptable class: " + currentFirstParameterClass);
}
return firstParamClass.isAssignableFrom(currentFirstParameterClass);
}
return false;
}
}

private static class MethodDesc {
private KindDesc kind;
private String name;
private String params;
private AccessType accessType;

public MethodDesc(KindDesc kind, String name, String params, AccessType accessType) {
this.kind = kind;
public MethodDesc(String name, String params) {
this.name = name;
this.params = params;
this.accessType = accessType;
}

public String format() {
Expand All @@ -425,18 +411,14 @@ public String format() {
}

private enum AccessType {
COMMON("Common", false, false),
WITH_DEFAULT("With Default", true, false),
OPTIONAL("Optional", false, true);
COMMON("Common"),
WITH_DEFAULT("With Default"),
OPTIONAL("Optional");

private String desc;
private boolean withDefault;
private boolean optional;

AccessType(String desc, boolean withDefault, boolean optional) {
AccessType(String desc) {
this.desc = desc;
this.withDefault = withDefault;
this.optional = optional;
}

public static AccessType of(boolean withDefault, boolean optional) {
Expand Down