]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3182 Remove unused code
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 7 May 2012 12:16:48 +0000 (18:16 +0600)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 8 May 2012 15:02:54 +0000 (21:02 +0600)
sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java [deleted file]
sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java [deleted file]
sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/AbstractLanguageTest.java [deleted file]

diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/AbstractLanguage.java
deleted file mode 100644 (file)
index 7237e68..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-
-package net.sourceforge.pmd.cpd;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-public abstract class AbstractLanguage implements Language {
-  private final Tokenizer tokenizer;
-  private final FilenameFilter fileFilter;
-
-  public AbstractLanguage(Tokenizer tokenizer, String... extensions) {
-    this.tokenizer = tokenizer;
-    fileFilter = new ExtensionsFilter(extensions);
-  }
-
-  /**
-   * @deprecated in 2.14, seems that not used in Sonar ecosystem - we don't scan directories.
-   */
-  @Deprecated
-  public FilenameFilter getFileFilter() {
-    return fileFilter;
-  }
-
-  public Tokenizer getTokenizer() {
-    return tokenizer;
-  }
-
-  private static class ExtensionsFilter implements FilenameFilter {
-    private final String[] extensions;
-
-    public ExtensionsFilter(String... extensions) {
-      this.extensions = new String[extensions.length];
-      for (int i = 0; i < extensions.length; i++) {
-        this.extensions[i] = extensions[i].toUpperCase();
-      }
-    }
-
-    public boolean accept(File dir, String name) {
-      File file = new File(dir, name);
-      if (file.isDirectory()) {
-        return true;
-      }
-      String uppercaseName = name.toUpperCase();
-      for (String extension : extensions) {
-        if (uppercaseName.endsWith(extension)) {
-          return true;
-        }
-      }
-      return false;
-    }
-  }
-}
diff --git a/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java b/sonar-duplications/src/main/java/net/sourceforge/pmd/cpd/Language.java
deleted file mode 100644 (file)
index 8fb352c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-package net.sourceforge.pmd.cpd;
-
-import java.io.FilenameFilter;
-
-public interface Language {
-
-  Tokenizer getTokenizer();
-
-  FilenameFilter getFileFilter();
-
-}
diff --git a/sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/AbstractLanguageTest.java b/sonar-duplications/src/test/java/net/sourceforge/pmd/cpd/AbstractLanguageTest.java
deleted file mode 100644 (file)
index 404df71..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Sonar, open source software quality management tool.
- * Copyright (C) 2008-2012 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * Sonar is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * Sonar is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with Sonar; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02
- */
-package net.sourceforge.pmd.cpd;
-
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * We use modified version of {@link AbstractLanguage} in comparison with PMD - it doesn't use package "net.sourceforge.pmd.util.filter",
- * so goal of this test is to verify that behavior wasn't changed:
- * filter should always accept directories and files with a specified set of extensions (comparison is case insensitive).
- */
-public class AbstractLanguageTest {
-
-  @Test
-  public void shouldCreateCorrectFilenameFilterForExtensions() {
-    AbstractLanguage language = new AbstractLanguage(null, "java") {
-    };
-
-    FilenameFilter filter = language.getFileFilter();
-    assertThat(filter.accept(new File("test-resources"), "org"), is(true));
-    assertThat(filter.accept(new File("test-resources/org/sonar/duplications/cpd/CPDTest"), "CPDFile1.java"), is(true));
-    assertThat(filter.accept(new File("test-resources/org/sonar/duplications/cpd/CPDTest"), "CPDFile1.cpp"), is(false));
-
-    language = new AbstractLanguage(null, "Java") {
-    };
-    assertThat(filter.accept(new File("test-resources/org/sonar/duplications/cpd/CPDTest"), "CPDFile1.java"), is(true));
-
-    language = new AbstractLanguage(null, new String[] {}) {
-    };
-    assertThat(filter.accept(new File("test-resources/org/sonar/duplications/cpd/CPDTest"), "CPDFile1.java"), is(true));
-  }
-
-  @Test(expected = NullPointerException.class)
-  public void shouldThrowException() {
-    new AbstractLanguage(null, (String) null) {
-    };
-  }
-
-  @Test(expected = NullPointerException.class)
-  public void shouldAlsoThrowException() {
-    new AbstractLanguage(null, (String[]) null) {
-    };
-  }
-
-}