use pmd core to test supported jdk values -> no need to keep updating the

code here for newly supported jdk versions.


git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@5684 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2007-12-02 19:19:20 +00:00
parent 649d1a0751
commit b274df49ec
2 changed files with 6 additions and 16 deletions

View File

@@ -320,14 +320,9 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
if (javaProject.exists()) {
final String compilerCompliance = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
log.debug("compilerCompliance = " + compilerCompliance);
if (JavaCore.VERSION_1_3.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_13);
} else if (JavaCore.VERSION_1_4.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_14);
} else if (JavaCore.VERSION_1_5.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_15);
} else if (JavaCore.VERSION_1_6.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_16);
final SourceType s = SourceType.getSourceTypeForId("java " + compilerCompliance);
if (s != null) {
pmdEngine.setJavaVersion(s);
} else {
throw new CommandException("The target JDK, " + compilerCompliance + " is not yet supported"); // TODO:
// NLS

View File

@@ -137,14 +137,9 @@ public class ReviewResourceForRuleCommand extends AbstractDefaultCommand {
if (javaProject.exists()) {
final String compilerCompliance = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
log.debug("compilerCompliance = " + compilerCompliance);
if (JavaCore.VERSION_1_3.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_13);
} else if (JavaCore.VERSION_1_4.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_14);
} else if (JavaCore.VERSION_1_5.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_15);
} else if (JavaCore.VERSION_1_6.equals(compilerCompliance)) {
pmdEngine.setJavaVersion(SourceType.JAVA_16);
final SourceType s = SourceType.getSourceTypeForId("java " + compilerCompliance);
if (s != null) {
pmdEngine.setJavaVersion(s);
} else {
throw new CommandException("The target JDK, " + compilerCompliance + " is not yet supported"); // TODO:
// NLS