pmd-objectivec: checkstyle / formatting

This commit is contained in:
Andreas Dangel
2016-12-02 14:07:12 +01:00
parent cd90c3df96
commit dc7b0e2f00
10 changed files with 34 additions and 22 deletions

View File

@ -1,8 +1,8 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
package net.sourceforge.pmd.cpd;
/**
* Defines the Language module for Objective-C
@ -10,7 +10,8 @@ package net.sourceforge.pmd.cpd;
public class ObjectiveCLanguage extends AbstractLanguage {
/**
* Creates a new instance of {@link ObjectiveCLanguage} with the default extensions for Objective-C files.
* Creates a new instance of {@link ObjectiveCLanguage} with the default
* extensions for Objective-C files.
*/
public ObjectiveCLanguage() {
super("Objective-C", "objectivec", new ObjectiveCTokenizer(), ".h", ".m");

View File

@ -1,11 +1,14 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import java.io.Reader;
import java.io.StringReader;
import org.apache.commons.io.IOUtils;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.LanguageVersionHandler;
import net.sourceforge.pmd.lang.TokenManager;
@ -13,8 +16,6 @@ import net.sourceforge.pmd.lang.ast.TokenMgrError;
import net.sourceforge.pmd.lang.objectivec.ObjectiveCLanguageModule;
import net.sourceforge.pmd.lang.objectivec.ast.Token;
import org.apache.commons.io.IOUtils;
/**
* The Objective-C Tokenizer
*/
@ -28,8 +29,9 @@ public class ObjectiveCTokenizer implements Tokenizer {
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(ObjectiveCLanguageModule.NAME)
.getDefaultVersion().getLanguageVersionHandler();
reader = new StringReader(buffer.toString());
TokenManager tokenManager = languageVersionHandler.getParser(
languageVersionHandler.getDefaultParserOptions()).getTokenManager(sourceCode.getFileName(), reader);
TokenManager tokenManager = languageVersionHandler
.getParser(languageVersionHandler.getDefaultParserOptions())
.getTokenManager(sourceCode.getFileName(), reader);
Token currentToken = (Token) tokenManager.getNextToken();
while (currentToken.image.length() > 0) {
tokenEntries.add(new TokenEntry(currentToken.image, sourceCode.getFileName(), currentToken.beginLine));

View File

@ -1,6 +1,7 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.objectivec;
import net.sourceforge.pmd.lang.AbstractLanguageVersionHandler;

View File

@ -1,6 +1,7 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.objectivec;
import net.sourceforge.pmd.lang.BaseLanguageModule;
@ -16,7 +17,8 @@ public class ObjectiveCLanguageModule extends BaseLanguageModule {
public static final String TERSE_NAME = "objectivec";
/**
* Creates a new instance of {@link ObjectiveCLanguageModule} with the default file extensions for Objective-C.
* Creates a new instance of {@link ObjectiveCLanguageModule} with the
* default file extensions for Objective-C.
*/
public ObjectiveCLanguageModule() {
super(NAME, null, TERSE_NAME, null, "h", "m");

View File

@ -1,6 +1,7 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.objectivec;
import java.io.Reader;
@ -20,7 +21,9 @@ public class ObjectiveCParser extends AbstractParser {
/**
* Creates a new Objective-C Parser.
* @param parserOptions the options
*
* @param parserOptions
* the options
*/
public ObjectiveCParser(ParserOptions parserOptions) {
super(parserOptions);

View File

@ -1,6 +1,7 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.objectivec;
import java.io.Reader;
@ -17,7 +18,9 @@ public class ObjectiveCTokenManager implements TokenManager {
/**
* Creates a new Objective-C Token Manager from the given source code.
* @param source the source code
*
* @param source
* the source code
*/
public ObjectiveCTokenManager(Reader source) {
tokenManager = new ObjectiveCParserTokenManager(new SimpleCharStream(source));

View File

@ -1,17 +1,18 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd;
import java.util.Arrays;
import java.util.Collection;
import org.junit.runners.Parameterized.Parameters;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.LanguageVersion;
import net.sourceforge.pmd.lang.objectivec.ObjectiveCLanguageModule;
import org.junit.runners.Parameterized.Parameters;
public class LanguageVersionTest extends AbstractLanguageVersionTest {
public LanguageVersionTest(String name, String terseName, String version, LanguageVersion expected) {
@ -20,8 +21,7 @@ public class LanguageVersionTest extends AbstractLanguageVersionTest {
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
{ ObjectiveCLanguageModule.NAME, ObjectiveCLanguageModule.TERSE_NAME, "", LanguageRegistry.getLanguage(ObjectiveCLanguageModule.NAME).getDefaultVersion() }
});
return Arrays.asList(new Object[][] { { ObjectiveCLanguageModule.NAME, ObjectiveCLanguageModule.TERSE_NAME, "",
LanguageRegistry.getLanguage(ObjectiveCLanguageModule.NAME).getDefaultVersion(), }, });
}
}

View File

@ -1,16 +1,16 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import java.io.IOException;
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
public class ObjectiveCTokenizerTest extends AbstractTokenizerTest {
@ -25,8 +25,8 @@ public class ObjectiveCTokenizerTest extends AbstractTokenizerTest {
@Override
public String getSampleCode() throws IOException {
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME));
}
return IOUtils.toString(ObjectiveCTokenizer.class.getResourceAsStream(FILENAME));
}
@Test
public void tokenizeTest() throws IOException {

View File

@ -1,16 +1,16 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import java.io.IOException;
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
//Tests if the ObjectiveC tokenizer supports UTF-8 escapes in string literals
public class UTF8EscapesInStringLiteralObjCTokenizerTest extends AbstractTokenizerTest {

View File

@ -1,16 +1,16 @@
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
import java.io.IOException;
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
import org.apache.commons.io.IOUtils;
import org.junit.Before;
import org.junit.Test;
import net.sourceforge.pmd.testframework.AbstractTokenizerTest;
//Tests if the ObjectiveC tokenizer supports identifiers with unicode characters
public class UnicodeObjectiveCTokenizerTest extends AbstractTokenizerTest {