开发者

Tool for checking source for dependencies on specific Java versions

Is there a quick way (e.g. tool) to detect, from the source (or maybe even from compiled classes), which parts of an application call Java API methods that are only implemented in a specific Java version? (e.g. which parts 开发者_Python百科of my app are Java6-specific)

I don't necessarily want to hop through all ClassMismatchErrors and avoid the trial-and-error-method. Let's say I only want to document which parts of an application won't work if they were writte for, e.g., Java6 and I want to run it in a version 5 JDK.

Is there something like this? Google did not help this time, nor did I find any solution here (a rare case indeed:)


The Animal Sniffer might be helpful for this, especially its Maven plugin.


If I understand you correctly, what you're describing doesn't sound like a very good idea to me.

It sounds like you want to build some library on JDK 6 (specifying -target 1.5), but let it be run on JDK 5 and just have certain classes or methods here and there just not work (because they needed a Java6-only API). I wouldn't do this. A method which should work might still trigger a class to be loaded which itself contains some reference to a class that's new in Java 6, and an Error will be thrown.

It's much better if you just choose which version is your minimum supported version and live with that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜