Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Probe classes in 2017.02 are stripped of generic parameters

Moderators: Vladimir Kondratyev, Anton Katilin

Probe classes in 2017.02 are stripped of generic parameters

Postby qdolan » Thu Jun 01, 2017 12:22 pm

I have some custom probes that were written against the 2015_15074 probe API classes. It appears that the constructors of some classes in the 2017.02 probe API are no longer ABI compatible with this older version. While attempting to update and recompile my probes I have discovered that the classes included in 2017.02 have been stripped of their generic parameter types, unlike the previous version I was using. I assume this is an obfuscation byproduct that needs to be corrected.

2015 version:
public class com.yourkit.probes.MasterResourceRegistry<T> extends com.yourkit.probes.ResourceRegistry<T, java.lang.Object> {
public com.yourkit.probes.MasterResourceRegistry(java.lang.Class<?>, java.lang.String, java.lang.String, java.lang.String);
public long openOnEnter();
public void openOnExit(long, java.lang.String, T, java.lang.Throwable, com.yourkit.probes.FailedEventPolicy);
}

2017.02 version:
public class com.yourkit.probes.MasterResourceRegistry extends com.yourkit.probes.ResourceRegistry {
public com.yourkit.probes.MasterResourceRegistry(java.lang.Class, java.lang.String, java.lang.String);
public long openOnEnter();
public void openOnExit(long, java.lang.String, java.lang.Object, java.lang.Throwable, com.yourkit.probes.FailedEventPolicy);
}

Also, is it possible to get these classes distributed separately, or even deployed to maven central. It would be nice to be able to compile custom probes without having to extract classes from embedded jars after every update.
qdolan
 
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby Anton Katilin » Thu Jun 01, 2017 1:55 pm

Hi,

Yes, we have changed the obfuscator in the recent release, and the issue indeed seems related.

Nevertheless, the class MasterResourceRegistry is not part of public API, and we have never given any promises regarding its API or ABI compatibility.

How big is the problem for you? Can you simply recompile your classes against version 2017.02? Older versions are not supported anyway, and we encourage not to use them anymore.

Best regards,
Anton
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby qdolan » Thu Jun 01, 2017 10:06 pm

All the classes have been stripped of their generic type signatures, so I would need to alter my code to remove all generic type references and add explicit casts before it will compile.

The MasterResourceRegistry is used in probes/src/com/yourkit/probes/builtin/Databases.java which is one of the files I originally used as a reference to model my code off. How do I know what classes aren't public API?

The lack of backward compatibility poses an issue for me, because our servers are still deployed with the 2016.02 agent, so updating doesn't happen quickly. Currently I need to find a way to support both versions or remove support completely to prevent it crashing on launch when the profiler is attached.
qdolan
 
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby Anton Katilin » Fri Jun 02, 2017 6:26 am

Public API is described in the Help. Other classes are not.

Is MasterResourceRegistry the only problematic binary incompatible class? You may compile against a mock class (e.g. using the source code snippet like in your original post) or mock classes if necessary.

From our side we'll check if we can change obfuscation options to keep generic parameters for these classes.
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby qdolan » Wed Jun 07, 2017 2:59 am

Well the help quite literally says:

Please see Javadoc for detail.
...
Please find examples of the API usage in the built-in probes source code.

And the JavaDoc includes (along with all the other probes classes) MasterResourceRegistry:
https://www.yourkit.com/docs/java/api/c ... istry.html

Nowhere in the help or JavaDoc does it give any indication that any of these probe classes are not public API.

As for recompiling, even if I switched to using ResourceRegistry instead of MasterResourceRegistry, and make everything compile it's still not ABI compatible with 2016.02 because of the ResourceRegistry constructor arguments changed:

java.lang.NoSuchMethodError: com.yourkit.probes.ResourceRegistry.<init>(Ljava/lang/Class;Lcom/yourkit/probes/ResourceRegistry;Ljava/lang/String;Ljava/lang/String;)V

Currently I am just recommending against upgrading to 2017.02
qdolan
 
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby Anton Katilin » Wed Jun 07, 2017 9:53 am

It's your right not to upgrade, but we always recommend to use the newest version whenever possible.

Regarding the javadoc, you are right and I was wrong: it contains that class, hence it may be considered part of the API.

We'll investigate whether it is possible to keep generics for these classes with current obfuscation.
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby qdolan » Wed Jun 07, 2017 10:40 am

Since it is public API that has been changed without notice, or any workaround, do you think you could possibly add back the methods and constructors that were changed or removed and instead deprecate them until 2018.01. At least that way we have a migration path for supporting the current and previous release simultaneously.

Currently there is no way for me to support both.
qdolan
 
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Probe classes in 2017.02 are stripped of generic paramet

Postby Vladimir Kondratyev » Thu Jun 08, 2017 1:58 pm

We've just released 2017.02b61 which addresses this issue https://www.yourkit.com/java/profiler/download/

Please confirm that all is fixed.

Best regards,
Vladimir Kondratyev
YourKit GmbH
http://www.yourkit.com
"Don't get lost in data, get information!"
Vladimir Kondratyev
 
Posts: 1444
Joined: Tue Aug 10, 2004 7:52 pm
Location: Düsseldorf, Germany


Return to Java Profiler

Who is online

Users browsing this forum: Bing [Bot] and 8 guests

cron