Eclipse plugin obfuscated method.

Questions about YourKit Java Profiler
Post Reply
qdolan
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Eclipse plugin obfuscated method.

Post by qdolan »

I have a custom eclipse launch configuration type that I had previously added YourKit support to by wrapping and delegating logic for various calls to the YourKit eclipse plugin. This worked well up until recently, but due to recent changes to the YourKit eclipse plugin is currently broken. In the process of fixing things to work with the updated plugin I noticed that com.yourkit.eclipse34Plugin.Plugin.canLaunchWithProfiler() is now obfuscated.

Is it possible to have this method exposed again as a public static please.

Thanks.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Eclipse plugin obfuscated method.

Post by Anton Katilin »

Hi,

Just to clarify: do you use the plugin from the latest build 15058?

Do you remember the last version in which it used to work for you?

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

Re: Eclipse plugin obfuscated method.

Post by Anton Katilin »

By the way, could you please provide detail on how you use canLaunchWithProfiler().

This method checks two conditions: (a) that the plugin settings are OK and (b) that it is possible to detect whether the Java to launch the profilee is 32 or 64-bit. It returns OK if everything is fine and false otherwise. It has no side effects. If it returns false the plugin shows corresponding error message.

If you delegate to YourKit plugin I don't see why you want to explicitly call this method at all, as it is called inside YourKit plugin's code. Alternatively, you may assume that it always returns true.
qdolan
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Eclipse plugin obfuscated method.

Post by qdolan »

The method exists in the YK 2014 plugin, but is obfuscated in the 2015 version. I only recently updated to check support and noticed that it's no longer compatible. In fact I need to completely rewrite how my delegate works since the tab group implementation was added in 2015, but I can still make it work, I think. The issue I will next is that I want to support both 2015 and 2014 users at the same time somehow.

I cannot delegate the actual launching to the the YK plugin because the class is final and provides no mechanism for providing a delegate for adding VM arguments at launch time (which, just like the YK plugin, my launch delegate provides runtime resolved VM arguments). So my launch delegate needs to ask the YK plugin what VM arguments it needs to include, which conveniently in 2015 is now a static method call, however to replicate a similar "canLaunchWithProfiler()" logic in the launch method I can't just call the static method directly anymore.

In an ideal world the plugin classes wouldn't be final (or any of the methods). The plugin wouldn't be obfuscated (it's just for eclipse, is that really necessary?), the declared packages would be properly exported on the plugin manifest, and your update site would be a valid p2 repository so I can use it with maven. That would make my life much easier, but I can work with just being able to call a couple of static methods to implement my own launch delegate that approximates what the real one does.

My ultimate goal is to provide seamless support for YourKit just like regular java launch config, you make it harder than it needs to be, but I have made it work until now.
qdolan
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Eclipse plugin obfuscated method.

Post by qdolan »

Actually on closer inspection, I think the new YkWrapperDelegate might already do what I need.
qdolan
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Eclipse plugin obfuscated method.

Post by qdolan »

Excellent, indeed it does. I don't need any custom code at all to make it work, just a plugin with an icon and some extension point declarations.

Now that next question is can Yk2014 users safely use the Yk2015 eclipse plugin or are they incompatible?
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Eclipse plugin obfuscated method.

Post by Anton Katilin »

Hi,

The YourKit plugins are never designed to work with a different version of the profiler UI. They should always be used in a pair.

Technically, the incompatibility can be caused by the following factors:
(a) different setting file name and/or format in ~/.yjp defining the agent path and the profiler UI launcher;
(b) different ways to store properties in Eclipse for run configurations;
(c) different communication protocols between the plugin and the profiler UI implementing the Open in IDE action functionality;
(d) different agent startup options.

If I'm not mistaken, there were no changes in (a),(b) and (c) between versions 2014 and 2015, but there were changes in (d) because version 2015 introduced new startup options. So if the v2015 plugin feeds these new options to the v2014 agent it simply won't start, i.e. the Profile action will fail.

Furthermore, the settings file ~/.yjp/ide2014.txt mentioned under (a) stores paths to only one, current profiler version. To use v2015 plugin with v2014 you should run the integration wizard from within v2015 then manually edit the generated file to correct the paths so they point to v2014.

Maybe there will be other issues - honestly, we never considered such mixed plugin-profiler combinations and didn't actually test it.

Also, we do not support version 2014 after the release of version 2015 and strongly recommend all users to always use the latest and greatest version, which offers the best functionality and stability.

Best regards,
Anton
qdolan
Posts: 10
Joined: Sat Jan 17, 2015 11:33 pm

Re: Eclipse plugin obfuscated method.

Post by qdolan »

Thanks for the insight. I appreciate the help. Since not everyone who uses the tool will be upgrading their license right away there is going to be some reasonable amount of time where there will be a mix of 2014 and 2015 licenses that need supporting. Also, since 2015 doesn't work with the 2014 native agent, if our production servers are still deployed with the 2014 agent, then there is little point in upgrading until a server upgrade is completed because you still need both versions. I have to keep both versions installed for this very reason.

It would be great if at some point in future you could use a single eclipse plugin to supported multiple versions of YourKit, and make it so that future versions can still attach to prior versions of the native agent.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Eclipse plugin obfuscated method.

Post by Anton Katilin »

Hi,

If I'm not missing something important, I suppose there are two more or less independent goals:

1) let your own plugin co-exist with either v2014 and v2015 plugins, whichever installed;
and
2) allow a particular user to have both versions 2014 and 2015 installed in parallel AND let them both be integrated with IDE.

As far as I understand, you can achieve the first goal.

As for the second goal, I don't think it makes much sense to achieve. If a user can upgrade the UI to v2015, it is strongly recommended to do so, including the Eclipse plugin. (If a user cannot upgrade to v2015 there is obviously no multi-version situation at all as the user may only install v2014.) If necessary, the user can additionally install v2014 in parallel but do not integrate it with an IDE, using v2014 solely to control profiling in a v2014-profiling-enabled server. If I'm not mistaken, v2014 snapshots open just fine in v2015 UI, so you can use it for their analysis too. The navigation to source feature (F7) should work from within v2014 and v2015 UIs with v2015 plugin. You will not be able to use v2015 plugin's Profile action to launch profiled applications with v2014, but why might one need this? Eclipse runs on local machine, hence no "we can't upgrade a server for some reason" problem should arise.

There is absolutely no reason to use an older version if you are allowed to use the newest one unless you need to profile a server running an older agent which you can't upgrade. Not only does the newest version provide better functionality, but also offers all bug fixes and stability improvements missing in older ones.

Best regards,
Anton
Post Reply