Skip to content

Commit

Permalink
Update to checkstyle 6.7 Fixes #351
Browse files Browse the repository at this point in the history
TokenTypes methods getTokenId() and getTokenName() moved to Utils in
checkstyle 6.7.

DefaultLogger now trows UnsupportedEncodingExpection in 6.7.
  • Loading branch information
oyarzun authored and romani committed Sep 7, 2015
1 parent a5c4441 commit 247addb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sevntu-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.5</version>
<version>6.7</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private Utils()
public static void reportInvalidToken(int token)
{
throw new IllegalArgumentException("Found unsupported token: "
+ TokenTypes.getTokenName(token));
+ com.puppycrawl.tools.checkstyle.Utils.getTokenName(token));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.HashSet;
import java.util.Set;

import com.puppycrawl.tools.checkstyle.Utils;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void setAnnotationTargets(String[] targets)
if (targets != null) {
annotationTargets = new int[targets.length];
for (int i = 0; i < targets.length; i++) {
annotationTargets[i] = TokenTypes.getTokenId(targets[i]);
annotationTargets[i] = Utils.getTokenId(targets[i]);
}
Arrays.sort(annotationTargets);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package com.github.sevntu.checkstyle.checks.coding;

import com.puppycrawl.tools.checkstyle.Utils;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
Expand Down Expand Up @@ -70,7 +71,7 @@ public void setTargetConstantTypes(String[] targets) {
if (targets != null) {
targetConstantTypes = new int[targets.length];
for (int i = 0; i < targets.length; i++) {
targetConstantTypes[i] = TokenTypes.getTokenId(targets[i]);
targetConstantTypes[i] = Utils.getTokenId(targets[i]);
}
Arrays.sort(targetConstantTypes);
}
Expand Down Expand Up @@ -134,4 +135,4 @@ private static DetailAST[] getBothChildren(DetailAST logicNode) {
private boolean isTargetConstantType(int targetType) {
return Arrays.binarySearch(targetConstantTypes, targetType) > -1;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.puppycrawl.tools.checkstyle.Utils;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
Expand Down Expand Up @@ -124,7 +125,7 @@ public final void setIgnoreOccurrenceContext(String[] strRep)
{
ignoreOccurrenceContext.clear();
for (final String s : strRep) {
final int type = TokenTypes.getTokenId(s);
final int type = Utils.getTokenId(s);
ignoreOccurrenceContext.set(type);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.List;

import com.google.common.collect.Lists;
import com.puppycrawl.tools.checkstyle.Utils;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
Expand Down Expand Up @@ -102,7 +103,7 @@ public void setBlockTypes(final String[] blockTypes)
{
this.blockTypes = new int[blockTypes.length];
for (int i = 0; i < blockTypes.length; i++) {
this.blockTypes[i] = TokenTypes.getTokenId(blockTypes[i]);
this.blockTypes[i] = Utils.getTokenId(blockTypes[i]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.List;
import java.util.Locale;
Expand All @@ -31,7 +32,7 @@ public abstract class BaseCheckTestSupport extends Assert
protected static class BriefLogger extends DefaultLogger
{

public BriefLogger(OutputStream out)
public BriefLogger(OutputStream out) throws UnsupportedEncodingException
{
super(out, true);
}
Expand Down

0 comments on commit 247addb

Please sign in to comment.