Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 9, 2024
1 parent b46f89b commit 448e3b6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
15 changes: 15 additions & 0 deletions core/src/main/java/lucee/runtime/config/ConfigImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6331,4 +6331,19 @@ public void resetAll() throws IOException {
method.invoke(this);
}
}

/*
* public static void main(String[] args) throws IOException { List<Method> methods; Resource res =
* ResourcesImpl.getFileResourceProvider().getResource("/Users/mic/Tmp3/wwwwww");
* ResourceUtil.deleteContent(res, null); DynamicInvoker.getInstance(res);
*
* methods = Reflector.getMethods(lucee.runtime.config.ConfigWebImpl.class); methods =
* Reflector.getMethods(lucee.runtime.config.ConfigServerImpl.class);
*
* int max = 5; for (Method method: methods) { if (!method.getName().startsWith("reset") ||
* method.getName().equals("reset") || method.getName().equals("resetAll") ||
* method.getArgumentCount() != 0) continue; print.e("->" +
* method.getDeclaringProviderClassNameWithSameAccess() + ":" +
* method.getDeclaringProviderClassName() + ":" + method.getName()); // if (--max == 0) break; } }
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static String generateClassLoderId(Class<?> clazz) {
private ClazzDynamic(Class clazz, String clid, Log log) throws IOException {
this.clazz = clazz;
this.clid = clid;
Map<String, FunctionMember> members = _getFunctionMembers(this.clid, clazz, null, log);
Map<String, FunctionMember> members = _getFunctionMembers(this.clid, clazz, log);

LinkedList<FunctionMember> tmpMethods = new LinkedList<>();
LinkedList<FunctionMember> tmpDeclaredMethods = new LinkedList<>();
Expand Down Expand Up @@ -365,18 +365,16 @@ public List<Constructor> getDeclaredConstructors(int argumentLength) throws IOEx
return list;
}

private static Map<String, FunctionMember> _getFunctionMembers(String clid, final Class clazz, Map<String, FunctionMember> membersInput, Log log) throws IOException {
private static Map<String, FunctionMember> _getFunctionMembers(String clid, final Class clazz, Log log) throws IOException {
String key = clid + ":" + clazz.getName();
if (membersInput == null) membersInput = new LinkedHashMap<>();
final Map<String, FunctionMember> members = membersInput;
final Map<String, FunctionMember> members = new LinkedHashMap<>();

Map<String, FunctionMember> existing = membersCollection.get(key);
if (existing != null) {
for (Entry<String, FunctionMember> e: existing.entrySet()) {
members.put(e.getKey(), e.getValue());
}
return members;

}

final String classPath = clazz.getName().replace('.', '/') + ".class";
Expand Down Expand Up @@ -405,7 +403,7 @@ public void visit(int version, int access, String name, String signature, String
if (interfaces != null && interfaces.length > 0) {
for (String interf: interfaces) {
try {
_getFunctionMembers(clid, cl.loadClass(ASMUtil.getClassName(Type.getObjectType(interf))), members, log);
add(members, _getFunctionMembers(clid, cl.loadClass(ASMUtil.getClassName(Type.getObjectType(interf))), log));
}
catch (Exception e) {
if (log != null) log.error("dynamic", e);
Expand All @@ -414,7 +412,7 @@ public void visit(int version, int access, String name, String signature, String
}
if (superName != null) {
try {
_getFunctionMembers(clid, cl.loadClass(ASMUtil.getClassName(Type.getObjectType(superName))), members, log);
add(members, _getFunctionMembers(clid, cl.loadClass(ASMUtil.getClassName(Type.getObjectType(superName))), log));
}
catch (IllegalArgumentException iae) {
String v = ASMUtil.getJavaVersionFromException(iae, null);
Expand All @@ -437,6 +435,12 @@ public void visit(int version, int access, String name, String signature, String
super.visit(version, access, name, signature, superName, interfaces);
}

private void add(Map<String, FunctionMember> members, Map<String, FunctionMember> add) {
for (Entry<String, FunctionMember> e: add.entrySet()) {
members.put(e.getKey(), e.getValue());
}
}

@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
FunctionMemberDynamic fmCurrent = FunctionMemberDynamic.createInstance(clazz, name, access, descriptor, exceptions, classAccess.toInt());
Expand Down

0 comments on commit 448e3b6

Please sign in to comment.