资 源 简 介
same is a GUI-based tool that detects duplicate code chunks within a set of Java files. In a sense it is the opposite of the UNIX diff tool. In a nutshell, same normalizes Java code and is able to find duplicate code chunks even when the formatting is radically different, when the variable name has changed, and even when constants have changed.
Same can run in three modes. It has a GUI which lets you see the code side by side.
Additionally, it can be invoked via the command line.
java -cp same-0_40.jar console.App --helpusage: App [-s null] [-d] [-v] [-t] [-l] -d,--dumpast dump ast representation -l,--literals anonymize literals -s,--statements minumum number of statements in a block. default 4 -t,--types anonymize types -v,--variables anonymize variable names
Or, Same can be invoked via Ant as part of the build process: