Skip to content

Commit

Permalink
Issue checkstyle#4137: Split and Organize Checkstyle inputs by Test f…
Browse files Browse the repository at this point in the history
…or ClassTypeParameterName
  • Loading branch information
Kietzmann authored and timurt committed May 6, 2017
1 parent dd18756 commit 3975109
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 5 deletions.
Expand Up @@ -36,7 +36,9 @@ public class ClassTypeParameterNameCheckTest
@Override
protected String getPath(String filename) throws IOException {
return super.getPath("checks" + File.separator
+ "naming" + File.separator + filename);
+ "naming" + File.separator
+ "classtypeparametername" + File.separator
+ filename);
}

@Test
Expand All @@ -56,11 +58,11 @@ public void testClassDefault()
final String pattern = "^[A-Z]$";

final String[] expected = {
"5:38: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern),
"5:42: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern),
"13:14: " + getCheckMessage(MSG_INVALID_PATTERN, "foo", pattern),
"27:24: " + getCheckMessage(MSG_INVALID_PATTERN, "foo", pattern),
};
verify(checkConfig, getPath("InputTypeParameterName.java"), expected);
verify(checkConfig, getPath("InputClassTypeParameterName.java"), expected);
}

@Test
Expand All @@ -73,10 +75,10 @@ public void testClassFooName()
final String pattern = "^foo$";

final String[] expected = {
"5:38: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern),
"5:42: " + getCheckMessage(MSG_INVALID_PATTERN, "t", pattern),
"33:18: " + getCheckMessage(MSG_INVALID_PATTERN, "T", pattern),
};
verify(checkConfig, getPath("InputTypeParameterName.java"), expected);
verify(checkConfig, getPath("InputClassTypeParameterName.java"), expected);
}

@Test
Expand Down
@@ -0,0 +1,62 @@
package com.puppycrawl.tools.checkstyle.checks.naming.classtypeparametername;

import java.io.Serializable;

public class InputClassTypeParameterName<t>
{
public <TT> void foo() { }

<e_e> void foo(int i) {
}
}

class Other <foo extends Serializable & Cloneable> {

foo getOne() {
return null;//comment
}

<Tfo$o2T extends foo> /*comment*/Tfo$o2T getTwo(Tfo$o2T a) {
return null;
}

<foo extends Runnable> foo getShadow() {
return null;
}

static class Junk <foo> {
<_fo extends foo> void getMoreFoo() {
}
}
}

class MoreOther <T extends Cloneable> {

<E extends T> void getMore() {
new Other() {
<T> void getMoreFoo() {
}
};

// Other o = new Other() {
// <EE> void getMoreFoo() {
// }
// };
}
}

interface Boo<Input> {
Input boo();
}

interface FooInterface<T> {
T foo();
}

interface FooInterface2 {
Input foo();
}

class Input {

}

0 comments on commit 3975109

Please sign in to comment.