Permalink
Browse files

Bump checkstyle to 8.8 and add more checks

- RedundantModifier
- ModifierOrder
  • Loading branch information...
Flowdalic committed Apr 4, 2018
1 parent f014f79 commit 42e2fb41002a117e87ccb0b283a21585b8003d03
Showing with 87 additions and 84 deletions.
  1. +1 −0 build.gradle
  2. +2 −0 config/checkstyle.xml
  3. +3 −3 jxmpp-core/src/main/java/org/jxmpp/stringprep/XmppStringprep.java
  4. +1 −1 jxmpp-core/src/main/java/org/jxmpp/stringprep/simple/SimpleXmppStringprep.java
  5. +3 −3 jxmpp-core/src/main/java/org/jxmpp/util/XmppDateTime.java
  6. +2 −2 jxmpp-core/src/main/java/org/jxmpp/xml/splitter/CompleteElementCallback.java
  7. +2 −2 jxmpp-core/src/main/java/org/jxmpp/xml/splitter/DeclarationCallback.java
  8. +2 −2 jxmpp-core/src/main/java/org/jxmpp/xml/splitter/ProcessingInstructionCallback.java
  9. +5 −5 jxmpp-core/src/main/java/org/jxmpp/xml/splitter/XmlSplitter.java
  10. +2 −2 jxmpp-core/src/main/java/org/jxmpp/xml/splitter/XmlSplitterFactory.java
  11. +3 −3 jxmpp-core/src/main/java/org/jxmpp/xml/splitter/XmppElementCallback.java
  12. +3 −3 jxmpp-core/src/test/java/org/jxmpp/xml/splitter/XmlSplitterTestUtil.java
  13. +4 −4 jxmpp-jid/src/main/java/org/jxmpp/jid/EntityJid.java
  14. +1 −1 jxmpp-jid/src/main/java/org/jxmpp/jid/FullJid.java
  15. +38 −38 jxmpp-jid/src/main/java/org/jxmpp/jid/Jid.java
  16. +1 −1 jxmpp-jid/src/main/java/org/jxmpp/jid/impl/DomainAndResourcepartJid.java
  17. +2 −2 jxmpp-jid/src/main/java/org/jxmpp/jid/impl/LocalAndDomainpartJid.java
  18. +2 −2 jxmpp-jid/src/main/java/org/jxmpp/jid/impl/LocalDomainAndResourcepartJid.java
  19. +3 −3 jxmpp-stringprep-icu4j/src/main/java/org/jxmpp/stringprep/icu4j/Icu4jXmppStringprep.java
  20. +6 −6 jxmpp-util-cache/src/main/java/org/jxmpp/util/cache/Cache.java
  21. +1 −1 jxmpp-util-cache/src/main/java/org/jxmpp/util/cache/ExpirationCache.java
@@ -176,6 +176,7 @@ subprojects {

checkstyle {
configFile = new File(rootConfigDir, 'checkstyle.xml')
toolVersion = '8.8'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
@@ -63,6 +63,8 @@
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<module name="RedundantImport"/>
<module name="RedundantModifier"/>
<module name="ModifierOrder"/>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<!--
@@ -36,7 +36,7 @@
* @return the prepared String.
* @throws XmppStringprepException if there is an error.
*/
public String localprep(String string) throws XmppStringprepException;
String localprep(String string) throws XmppStringprepException;

/**
* Performs String preparation on the domainpart String of a JID. In RFC 61ss terms, this means applying the
@@ -46,13 +46,13 @@
* @return the prepared String.
* @throws XmppStringprepException if there is an error.
*/
public String domainprep(String string) throws XmppStringprepException;
String domainprep(String string) throws XmppStringprepException;

/**
* Performs String preparation on the resourcepart String of a JID. In RFC 6122 terms this means applying the <i>resourceprep</i> profile of Stringprep.
* @param string the String to transform.
* @return the prepared String.
* @throws XmppStringprepException if there is an error.
*/
public String resourceprep(String string) throws XmppStringprepException;
String resourceprep(String string) throws XmppStringprepException;
}
@@ -52,7 +52,7 @@ private SimpleXmppStringprep() {
* From 6122bis-18 § 3.3.1 and PRECIS IdentifierClass which forbids U+0020
*/
// @formatter:off
private final static char[] LOCALPART_FURTHER_EXCLUDED_CHARACTERS = new char[] {
private static final char[] LOCALPART_FURTHER_EXCLUDED_CHARACTERS = new char[] {
'"', // U+0022 (QUOTATION MARK) , i.e., "
'&', // U+0026 (AMPERSAND), i.e., &
'\'', // U+0027 (APOSTROPHE), i.e., '
@@ -95,7 +95,7 @@ protected DateFormat initialValue() {
private static final Pattern xep0091Pattern = Pattern.compile("^\\d+T\\d+:\\d+:\\d+$");

@SuppressWarnings("ImmutableEnumChecker")
private static enum DateFormatType {
private enum DateFormatType {
// @formatter:off
XEP_0082_DATE_PROFILE("yyyy-MM-dd"),
XEP_0082_DATETIME_PROFILE("yyyy-MM-dd'T'HH:mm:ssZ"),
@@ -120,7 +120,7 @@ protected DateFormat initialValue() {
*/
private final boolean HANDLE_MILLIS;

private DateFormatType(String dateFormat) {
DateFormatType(String dateFormat) {
FORMAT_STRING = dateFormat;
FORMATTER = new ThreadLocal<DateFormat>() {
@Override
@@ -408,7 +408,7 @@ public int compare(Calendar o1, Calendar o2) {
final Pattern pattern;
final DateFormatType formatter;

public PatternCouplings(Pattern datePattern, DateFormatType dateFormat) {
PatternCouplings(Pattern datePattern, DateFormatType dateFormat) {
pattern = datePattern;
formatter = dateFormat;
}
@@ -1,6 +1,6 @@
/**
*
* Copyright © 2015 Florian Schmaus
* Copyright © 2015-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,6 @@
*
* @param completeElement the complete XML element.
*/
public void onCompleteElement(String completeElement);
void onCompleteElement(String completeElement);

}
@@ -1,6 +1,6 @@
/**
*
* Copyright 2017 Florian Schmaus
* Copyright 2017-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,6 @@
*
* @param declaration the declaration string that was splitted.
*/
public void onDeclaration(String declaration);
void onDeclaration(String declaration);

}
@@ -1,6 +1,6 @@
/**
*
* Copyright 2017 Florian Schmaus
* Copyright 2017-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,6 @@
*
* @param processingInstruction the string of the splitted Processing Instruction.
*/
public void onProcessingInstruction(String processingInstruction);
void onProcessingInstruction(String processingInstruction);

}
@@ -75,7 +75,7 @@

final char c;

private AttributeValueQuotes(char c) {
AttributeValueQuotes(char c) {
this.c = c;
}
}
@@ -354,13 +354,13 @@ private void onEndTagFinished() {
state = State.START;
}

private final String getToken() {
private String getToken() {
String token = tokenBuffer.toString();
tokenBuffer.setLength(0);
return token;
}

private final void onProcessingInstructionOrDeclaration(String processingInstructionOrDeclaration) {
private void onProcessingInstructionOrDeclaration(String processingInstructionOrDeclaration) {
if (processingInstructionOrDeclaration.startsWith("<?xml ")) {
if (declarationCallback != null) {
declarationCallback.onDeclaration(processingInstructionOrDeclaration);
@@ -372,12 +372,12 @@ private final void onProcessingInstructionOrDeclaration(String processingInstruc
}
}

private final static String extractPrefix(String qName) {
private static String extractPrefix(String qName) {
int index = qName.indexOf(':');
return index > -1 ? qName.substring(0, index) : qName;
}

private final static String extractLocalpart(String qName) {
private static String extractLocalpart(String qName) {
int index = qName.indexOf(':');
return index > -1 ? qName.substring(index + 1) : qName;
}
@@ -1,6 +1,6 @@
/**
*
* Copyright 2015-2017 Florian Schmaus
* Copyright 2015-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
* @param processingInstructionCallback a optional callback for Processing Instructions.
* @return a new splitter.
*/
public XmlSplitter createXmlSplitter(CompleteElementCallback callback, DeclarationCallback declarationCallback,
XmlSplitter createXmlSplitter(CompleteElementCallback callback, DeclarationCallback declarationCallback,
ProcessingInstructionCallback processingInstructionCallback);

}
@@ -1,6 +1,6 @@
/**
*
* Copyright © 2015 Florian Schmaus
* Copyright © 2015-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,11 +30,11 @@
* @param prefix the prefix of the 'stream' element.
* @param attributes the attributes of the 'stream' element.
*/
public void streamOpened(String prefix, Map<String, String> attributes);
void streamOpened(String prefix, Map<String, String> attributes);

/**
* Invoked when a XMPP 'stream' close tag has been read.
*/
public void streamClosed();
void streamClosed();

}
@@ -39,8 +39,8 @@ public XmlSplitter createXmlSplitter(CompleteElementCallback callback, Declarati
}, elementParts);
}

private final static String STREAM_OPEN_SUBSTITUTE = "<stream>";
private final static String STREAM_CLOSE_SUBSTITUTE = "</stream>";
private static final String STREAM_OPEN_SUBSTITUTE = "<stream>";
private static final String STREAM_CLOSE_SUBSTITUTE = "</stream>";

public static void xmppSplitterTest(String... elements) throws IOException {
Element[] elementParts = elementsFrom(elements);
@@ -163,7 +163,7 @@ public void onProcessingInstruction(String processingInstruction) {
return (P) part;
}

static abstract class SplittedPart {
abstract static class SplittedPart {
final String part;

protected SplittedPart(String part) {
@@ -1,6 +1,6 @@
/**
*
* Copyright © 2014-2016 Florian Schmaus
* Copyright © 2014-2018 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,20 +37,20 @@
*
* @return the localpart.
*/
public Localpart getLocalpart();
Localpart getLocalpart();

/**
* Return the bare JID of this entity JID.
*
* @return the bare JID.
*/
public EntityBareJid asEntityBareJid();
EntityBareJid asEntityBareJid();

/**
* Return the bare JID string of this full JID.
*
* @return the bare JID string.
*/
public String asEntityBareJidString();
String asEntityBareJidString();

}
@@ -37,6 +37,6 @@
*
* @return the resourcepart.
*/
public Resourcepart getResourcepart();
Resourcepart getResourcepart();

}
Oops, something went wrong.

0 comments on commit 42e2fb4

Please sign in to comment.