RFR: 6996: Properly support converters [v6]

Gunnar Morling github.com+28612+gunnarmorling at openjdk.java.net
Fri Nov 27 17:22:54 UTC 2020


On Fri, 27 Nov 2020 15:18:16 GMT, Marcus Hirt <hirt at openjdk.org> wrote:

>> Including simple test to verify that the resulting instrumented methods are ok.
>
> Marcus Hirt has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixing JMX serialization

Some more small comments.

agent/src/main/java/org/openjdk/jmc/agent/util/TypeUtils.java line 224:

> 222: 		/*
> 223: 		 * if (convertable.getConverterClassName() != null) { return false; }
> 224: 		 */

A left-over?

agent/src/main/java/org/openjdk/jmc/agent/impl/ResolvedConvertable.java line 71:

> 69: 
> 70: 	public Class<?> getConverterClass() {
> 71: 		return converterClass;

I think you could avoid the field by returning `converterMethod.getDeclaringClass()`.

agent/src/main/java/org/openjdk/jmc/agent/impl/ResolvedConvertable.java line 87:

> 85: 		for (Method m : converterClass.getDeclaredMethods()) {
> 86: 			if (methodName.equals(m.getName())) {
> 87: 				if ((!Modifier.isStatic(m.getModifiers())) || m.getParameterCount() != 1) {

I'd suggest to also filter out abstract (or interface) methods here, with a more meaningful exception as then trying to invoke them later on.

-------------

PR: https://git.openjdk.java.net/jmc/pull/168


More information about the jmc-dev mailing list