1

I have a code generator which generates classes with a lot of private code like:

class A {

  private void meth1() { ... }
  private int var1;

  private class SubA { private void meth2() {...} }
}

I'm looking for a tool which would remove all unused private fields/methods and inner classes without human intervention. I would also like it to work on source code instead of byte code to be able to conduct metrics on the generated source code. Changing the code generator would be possible but I'm looking for something simpler.

4

2 回答 2

1

Eclipse是一个很棒的想法,它内置了这个特性。它会自动让你知道在一个类中没有使用的私有方法/成员。

于 2011-05-22T19:28:58.743 回答
0

ProGuard在对象级别上做得很好。它可以为您提供一个报告,您可以使用该报告来追踪源中未使用的方法。我不知道有一种工具可以自动去除未使用方法的来源。

于 2011-05-22T19:21:15.990 回答