repo stringlengths 1 191 ⌀ | file stringlengths 23 351 | code stringlengths 0 5.32M | file_length int64 0 5.32M | avg_line_length float64 0 2.9k | max_line_length int64 0 288k | extension_type stringclasses 1 value |
|---|---|---|---|---|---|---|
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/RedundantFieldInitializerTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class RedundantFieldInitializerTest extends PmdRuleTst {
// no additional unit tests
}
| 291 | 23.333333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/UseArraysAsListTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseArraysAsListTest extends PmdRuleTst {
// no additional unit tests
}
| 281 | 22.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/AvoidFileStreamTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidFileStreamTest extends PmdRuleTst {
// no additional unit tests
}
| 281 | 22.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/AvoidCalendarDateCreationTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidCalendarDateCreationTest extends PmdRuleTst {
// no additional unit tests
}
| 291 | 23.333333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/UseStringBufferLengthTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseStringBufferLengthTest extends PmdRuleTst {
// no additional unit tests
}
| 287 | 23 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/AvoidArrayLoopsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidArrayLoopsTest extends PmdRuleTst {
// no additional unit tests
}
| 281 | 22.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/AppendCharacterWithCharTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AppendCharacterWithCharTest extends PmdRuleTst {
// no additional unit tests
}
| 289 | 23.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/UseIOStreamsWithApacheCommonsFileItemTest.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseIOStreamsWithApacheCommonsFileItemTest extends PmdRuleTst {
// no additional unit tests
}
| 302 | 24.25 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/StringInstantiationTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class StringInstantiationTest extends PmdRuleTst {
// no additional unit tests
}
| 285 | 22.833333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/InefficientEmptyStringCheckTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class InefficientEmptyStringCheckTest extends PmdRuleTst {
// no additional unit tests
}
| 293 | 23.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/UseArrayListInsteadOfVectorTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseArrayListInsteadOfVectorTest extends PmdRuleTst {
// no additional unit tests
}
| 293 | 23.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/BigIntegerInstantiationTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class BigIntegerInstantiationTest extends PmdRuleTst {
// no additional unit tests
}
| 289 | 23.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/InefficientStringBufferingTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class InefficientStringBufferingTest extends PmdRuleTst {
// no additional unit tests
}
| 292 | 23.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/UseStringBufferForStringAppendsTest.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseStringBufferForStringAppendsTest extends PmdRuleTst {
// no additional unit tests
}
| 296 | 23.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class InsufficientStringBufferDeclarationTest extends PmdRuleTst {
// no additional unit tests
}
| 301 | 24.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/AddEmptyStringTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AddEmptyStringTest extends PmdRuleTst {
// no additional unit tests
}
| 280 | 22.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/OptimizableToArrayCallTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class OptimizableToArrayCallTest extends PmdRuleTst {
// no additional unit tests
}
| 288 | 23.083333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/AvoidInstantiatingObjectsInLoopsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidInstantiatingObjectsInLoopsTest extends PmdRuleTst {
// no additional unit tests
}
| 298 | 23.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/UseIndexOfCharTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseIndexOfCharTest extends PmdRuleTst {
// no additional unit tests
}
| 280 | 22.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/inefficientemptystringcheck/StringTrimLength.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.inefficientemptystringcheck;
public class StringTrimLength {
String get() {
return "foo";
}
void bar() {
if (get().trim().length() == 0) {
// violation
}
if (this.get().trim().length() == 0) {
// violation
}
String bar = get();
if (bar.trim().length() == 0) {
// violation
}
if (bar.toString().trim().length() == 0) {
// violation
}
}
}
| 627 | 20.655172 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/inefficientemptystringcheck/StringTrimMethodArgument.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.inefficientemptystringcheck;
public class StringTrimMethodArgument {
public String get() {
return "foo";
}
public void bar() {
String bar = "foo";
System.out.println(bar.trim().isEmpty()); // violation missing
System.out.println(bar.trim().length() == 0);
System.out.println(get().trim().isEmpty());
System.out.println(get().trim().length() == 0);
System.out.println(this.get().trim().isEmpty());
System.out.println(this.get().trim().length() == 0);
}
}
| 679 | 29.909091 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/inefficientemptystringcheck/StringTrimIsEmpty.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.inefficientemptystringcheck;
public class StringTrimIsEmpty {
String get() {
return "foo";
}
void bar() {
if (get().trim().isEmpty()) {
// violation
}
if (this.get().trim().isEmpty()) {
// violation
}
String bar = get();
if (bar.trim().isEmpty()) {
// violation
}
if (bar.toString().trim().isEmpty()) {
// violation
}
}
}
| 612 | 20.137931 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/stringtostring/Issue2080.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.stringtostring;
public final class Issue2080 {
String value;
public void foo() {
A a = new A();
value = a.value.toString(); // false positive
}
class A {
B value;
}
class B { }
}
| 374 | 16.857143 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/stringtostring/Car.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.stringtostring;
public class Car {
}
| 182 | 17.3 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/stringtostring/StringToStringFP.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.stringtostring;
public class StringToStringFP {
private String s;
public void print(A a) {
this.s = a.getB().getC().toString(); // line 5 - false positive
this.s = String.valueOf(a.getB().getC()); // workaround
System.out.println(s);
}
public String getC() {
return "";
}
interface A {
B getB();
}
interface B {
Character getC();
}
}
| 566 | 19.25 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/performance/stringtostring/User.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.performance.stringtostring;
import java.util.Locale;
public class User {
public String getName() {
return "username";
}
private String convert(String s) {
return s.toLowerCase(Locale.ROOT);
}
}
| 361 | 18.052632 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryImportTest.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryImportTest extends PmdRuleTst {
// these 2 methods are used for a test case, do not delete
public static void assertTrue(String message, boolean condition) {
if (!condition) {
System.out.println(message);
}
}
public static void assertSomething(String message, boolean condition) {
if (!condition) {
System.out.println(message);
}
}
}
| 626 | 25.125 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/PrematureDeclarationTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class PrematureDeclarationTest extends PmdRuleTst {
// no additional unit tests
}
| 284 | 22.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/IdenticalCatchBranchesTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class IdenticalCatchBranchesTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ShortClassNameTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ShortClassNameTest extends PmdRuleTst {
// no additional unit tests
}
| 278 | 22.25 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseDiamondOperatorTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseDiamondOperatorTest extends PmdRuleTst {
// no additional unit tests
}
| 282 | 22.583333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ExtendsObjectTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ExtendsObjectTest extends PmdRuleTst {
// no additional unit tests
}
| 277 | 22.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/PackageCaseTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class PackageCaseTest extends PmdRuleTst {
// no additional unit tests
}
| 275 | 22 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/FieldDeclarationsShouldBeAtStartOfClassTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class FieldDeclarationsShouldBeAtStartOfClassTest extends PmdRuleTst {
// no additional unit tests
}
| 303 | 24.333333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/TooManyStaticImportsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class TooManyStaticImportsTest extends PmdRuleTst {
// no additional unit tests
}
| 284 | 22.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/AvoidProtectedMethodInFinalClassNotExtendingTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidProtectedMethodInFinalClassNotExtendingTest extends PmdRuleTst {
// no additional unit tests
}
| 308 | 24.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ClassNamingConventionsTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/FormalParameterNamingConventionsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class FormalParameterNamingConventionsTest extends PmdRuleTst {
// no additional unit tests
}
| 296 | 23.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalVariableNamingConventionsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class LocalVariableNamingConventionsTest extends PmdRuleTst {
// no additional unit tests
}
| 294 | 23.583333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodArgumentCouldBeFinalTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class MethodArgumentCouldBeFinalTest extends PmdRuleTst {
// no additional unit tests
}
| 290 | 23.25 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/GenericsNamingTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class GenericsNamingTest extends PmdRuleTst {
// no additional unit tests
}
| 278 | 22.25 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryModifierTest extends PmdRuleTst {
// no additional unit tests
}
| 283 | 22.666667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ConfusingTernaryTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ConfusingTernaryTest extends PmdRuleTst {
// no additional unit tests
}
| 280 | 22.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/BooleanGetMethodNameTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class BooleanGetMethodNameTest extends PmdRuleTst {
// no additional unit tests
}
| 284 | 22.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/OnlyOneReturnTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class OnlyOneReturnTest extends PmdRuleTst {
// no additional unit tests
}
| 277 | 22.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryReturnTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryReturnTest extends PmdRuleTst {
// no additional unit tests
}
| 281 | 22.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/AvoidUsingNativeCodeTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidUsingNativeCodeTest extends PmdRuleTst {
// no additional unit tests
}
| 284 | 22.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/EmptyControlStatementTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class EmptyControlStatementTest extends PmdRuleTst {
// no additional unit tests
}
| 285 | 22.833333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/FinalParameterInAbstractMethodTest.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class FinalParameterInAbstractMethodTest extends PmdRuleTst {
// no additional unit tests
}
| 293 | 23.5 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/RemoteInterfaceNamingConventionTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class RemoteInterfaceNamingConventionTest extends PmdRuleTst {
// no additional unit tests
}
| 295 | 23.666667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UselessQualifiedThisTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UselessQualifiedThisTest extends PmdRuleTst {
// no additional unit tests
}
| 284 | 22.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/AvoidDollarSignsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidDollarSignsTest extends PmdRuleTst {
// no additional unit tests
}
| 280 | 22.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/FieldNamingConventionsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class FieldNamingConventionsTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/AvoidProtectedFieldInFinalClassTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AvoidProtectedFieldInFinalClassTest extends PmdRuleTst {
// no additional unit tests
}
| 295 | 23.666667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryConstructorTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryConstructorTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryCastTest.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryCastTest extends PmdRuleTst {
// no additional unit tests
}
| 279 | 20.538462 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessarySemicolonTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessarySemicolonTest extends PmdRuleTst {
// no additional unit tests
}
| 284 | 22.75 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryAnnotationValueElementTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryAnnotationValueElementTest extends PmdRuleTst {
// no additional unit tests
}
| 297 | 23.833333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/RemoteSessionInterfaceNamingConventionTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class RemoteSessionInterfaceNamingConventionTest extends PmdRuleTst {
// no additional unit tests
}
| 302 | 24.25 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ControlStatementBracesTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ControlStatementBracesTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/NoPackageTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class NoPackageTest extends PmdRuleTst {
// no additional unit tests
}
| 273 | 21.833333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryLocalBeforeReturnTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryLocalBeforeReturnTest extends PmdRuleTst {
// no additional unit tests
}
| 292 | 23.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/MethodNamingConventionsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class MethodNamingConventionsTest extends PmdRuleTst {
// no additional unit tests
}
| 287 | 23 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UselessParenthesesTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import net.sourceforge.pmd.lang.java.JavaParsingHelper;
import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
import net.sourceforge.pmd.lang.java.ast.ASTExpression;
import net.sourceforge.pmd.lang.java.rule.codestyle.UselessParenthesesRule.Necessity;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UselessParenthesesTest extends PmdRuleTst {
Executable testImpl(String expression, Necessity necessity) {
return () -> {
String file = "class Foo {{ int a,b,c,d; float f1, f2, f3; String s; Object e = " + expression + ";}}";
ASTCompilationUnit acu = JavaParsingHelper.DEFAULT.parse(file);
ASTExpression paren = acu.descendants(ASTExpression.class).crossFindBoundaries().first(ASTExpression::isParenthesized);
assertNotNull(paren, "No parenthesized expression in " + expression);
UselessParenthesesRule.Necessity result = UselessParenthesesRule.needsParentheses(paren, paren.getParent());
assertEquals(necessity, result, "In " + expression);
};
}
Executable clarifying(String expression) {
return testImpl(expression, Necessity.CLARIFYING);
}
Executable balancing(String expression) {
return testImpl(expression, Necessity.BALANCING);
}
Executable necessary(String expression) {
return testImpl(expression, Necessity.ALWAYS);
}
Executable unnecessary(String expression) {
return testImpl(expression, Necessity.NEVER);
}
@Test
void testOuterLambdas() {
assertAll(
unnecessary("() -> (a + b)"),
unnecessary("() -> (() -> b)"),
unnecessary("() -> (a ? b : c)"), // clarifying?
necessary("a ? () -> (a ? b : c) : d")
);
}
@Test
void testInnerLambda() {
assertAll(
necessary("(() -> 1) + 2"),
unnecessary("((() -> 1)) + 2"),
necessary("(() -> 1) * 2"),
// necessary("(() -> 1) = 2"), (impossible)
unnecessary("a = (() -> 1)")
);
}
@Test
void testAssignments() {
// (a = b) = c (impossible)
assertAll(
necessary("a * (b = c)"),
unnecessary("a * ((b = c))"),
necessary("a ? (b = c) : d"),
unnecessary("a = (b = c)")
);
}
@Test
void testConditionals() {
assertAll(
unnecessary("a ? b : (c ? d : e)"),
necessary("a ? (b ? c : d) : e"),
unnecessary("a ? ((b ? c : d)) : e"),
necessary("(a ? b : c) ? d : e"),
clarifying("(a == b) ? c : d"),
unnecessary("(s.toString()) ? c : d")
);
}
@Test
void testAdditiveMul() {
// remember, a,b,c,d are ints
// fp1,2,3 are floats
assertAll(
unnecessary("a + (b + c)"),
unnecessary("a + (b - c)"),
clarifying("a + (b * c)"),
unnecessary("(a + b) + c"),
unnecessary("(f1 + f1) + f2"),
unnecessary("(a + b) - c"),
necessary("(a + b) * c"),
necessary("(a + b) / c"),
necessary("x / (a + d)"),
// those mix floating-point operations
necessary("a + (f1 + b)"),
necessary("a + (f1 - b)"),
necessary("a + (b + f1)"),
necessary("a + (b - f1)"),
necessary("f1 + (f1 + b)"),
necessary("f1 + (f1 - b)"),
necessary("f1 + (b + f1)"),
necessary("f1 + (b - f1)")
);
}
@Test
void testMultiplicative() {
assertAll(
unnecessary("(a * b) * c"),
unnecessary("a * (b * c)"),
necessary("a * (b / c)"),
necessary("a * (b % c)"),
necessary("a / (b * c)"),
necessary("a / (b / c)"),
necessary("a / (b % c)"),
necessary("a % (b * c)"),
necessary("a % (b / c)"),
necessary("a % (b % c)")
);
}
@Test
void testConcatenation() {
assertAll(
necessary("\"\" + (1 + 4)"),
unnecessary("\"\" + (\"\" + 4)"),
unnecessary("\"\" + (4 + \"\")"),
clarifying("(1 + 4) + \"\"")
);
}
@Test
void testEquality() {
assertAll(
necessary("a == null == (b == null)"),
unnecessary("a == null == ((b == null))"),
balancing("(a == null) == (b == null)"),
unnecessary("(a == true) == b == true"),
// the same with some !=
necessary("a == null != (b == null)"),
unnecessary("a == null != ((b == null))"),
balancing("(a == null) == (b != null)"),
unnecessary("(a != true) == b == true")
);
}
@Test
void testRelational() {
assertAll(
clarifying("a <= b == (b <= c)"),
clarifying("(a <= b) == (b <= c)"),
necessary("(a == b) >= 0"),
clarifying("(a + b) >= 0")
);
}
@Test
void testUnaries() {
assertAll(
unnecessary("(String) ((String) c)"),
unnecessary("(String) (+1)"),
unnecessary("a + +((char) 1)"),
unnecessary("a + ~((char) 1)"),
clarifying("a + ((char) 1)"),
clarifying("a * ((char) 1)"),
clarifying("((char) 1) * a"),
unnecessary("-(-1)"),
unnecessary("-(+1)")
);
}
@Test
void testSwitches() {
assertAll(
unnecessary(" a + (switch (1) { })"),
unnecessary("(switch (1) { }) + 1")
);
}
}
| 6,128 | 28.047393 | 131 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryFullyQualifiedNameTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryFullyQualifiedNameTest extends PmdRuleTst {
// Do not delete these two enums - it is needed for a test case
// see:
// /pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml
// #1436 UnnecessaryFullyQualifiedName false positive on clashing static
// imports with enums
public enum ENUM1 {
A, B;
}
public enum ENUM2 {
C, D;
}
// Do not delete these classes - it is needed for a test case
// see: /pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryFullyQualifiedName.xml
// #1546 part 1 UnnecessaryFullyQualifiedName doesn't take into consideration conflict resolution
// #1546 part 2 UnnecessaryFullyQualifiedName doesn't take into consideration conflict resolution
public static class PhonyMockito {
public static final int TWO = 2;
public static <T> T mock(Class<T> clazz) {
return null;
}
}
static class Container {
public static class PhonyMockito {
public static <T> T mock(Class<T> clazz) {
return null;
}
}
}
public static class MockitoInherited extends PhonyMockito {
// static method PhonyMockito::mock is static imported
// if MockitoInherited is imported on demand
}
}
| 1,598 | 29.75 | 123 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ShortVariableTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ShortVariableTest extends PmdRuleTst {
// no additional unit tests
}
| 277 | 22.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LongVariableTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class LongVariableTest extends PmdRuleTst {
// no additional unit tests
}
| 276 | 22.083333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ForLoopShouldBeWhileLoopTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ForLoopShouldBeWhileLoopTest extends PmdRuleTst {
// no additional unit tests
}
| 288 | 23.083333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/AtLeastOneConstructorTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class AtLeastOneConstructorTest extends PmdRuleTst {
// no additional unit tests
}
| 285 | 22.833333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/EmptyMethodInAbstractClassShouldBeAbstractTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class EmptyMethodInAbstractClassShouldBeAbstractTest extends PmdRuleTst {
// no additional unit tests
}
| 306 | 24.583333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalVariableCouldBeFinalTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class LocalVariableCouldBeFinalTest extends PmdRuleTst {
// no additional unit tests
}
| 289 | 23.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LinguisticNamingTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class LinguisticNamingTest extends PmdRuleTst {
// no additional unit tests
}
| 280 | 22.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/MDBAndSessionBeanNamingConventionTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class MDBAndSessionBeanNamingConventionTest extends PmdRuleTst {
// no additional unit tests
}
| 297 | 23.833333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/CallSuperInConstructorTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class CallSuperInConstructorTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalHomeNamingConventionTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class LocalHomeNamingConventionTest extends PmdRuleTst {
// no additional unit tests
}
| 289 | 23.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/LocalInterfaceSessionNamingConventionTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class LocalInterfaceSessionNamingConventionTest extends PmdRuleTst {
// no additional unit tests
}
| 301 | 24.166667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseShortArrayInitializerTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseShortArrayInitializerTest extends PmdRuleTst {
// no additional unit tests
}
| 286 | 22.916667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryBoxingTest.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UnnecessaryBoxingTest extends PmdRuleTst {
// no additional unit tests
}
| 280 | 22.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class CommentDefaultAccessModifierTest extends PmdRuleTst {
// no additional unit tests
}
| 292 | 23.416667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/ShortMethodNameTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class ShortMethodNameTest extends PmdRuleTst {
// no additional unit tests
}
| 279 | 22.333333 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/UseUnderscoresInNumericLiteralsTest.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle;
import net.sourceforge.pmd.testframework.PmdRuleTst;
class UseUnderscoresInNumericLiteralsTest extends PmdRuleTst {
// no additional unit tests
}
| 295 | 23.666667 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/Deprecated.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname;
/**
* This class should not be confused with the annotation java.lang.Deprecated.
*/
public final class Deprecated {
}
| 294 | 23.583333 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/MyClass.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname;
public class MyClass {
}
| 199 | 19 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/TestClass.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname;
@org.junit.Ignore("Rule has not been updated yet")
public class TestClass {
protected class SomeInnerClass {
public void alsoDoSomething() {
System.out.println("alsoDoSomething");
}
}
}
| 398 | 21.166667 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/ClassA.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname;
/**
* Test case for #4133
*/
public class ClassA {
public static class Foo implements net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname.Foo {
}
}
| 355 | 22.733333 | 119 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/Container.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname;
public class Container {
public static class MyClass {
}
}
| 242 | 17.692308 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/Foo.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname;
public interface Foo {
}
| 198 | 21.111111 | 83 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/subpackage/MyAnnotation.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname.subpackage;
public @interface MyAnnotation {
}
| 220 | 21.1 | 94 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryfullyqualifiedname/subpackage/MyClass.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryfullyqualifiedname.subpackage;
@org.junit.Ignore("Rule has not been updated yet")
public class MyClass {
}
| 262 | 20.916667 | 94 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/commentdefaultaccessmodifier/OnlyForTesting.java | /**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.commentdefaultaccessmodifier;
public @interface OnlyForTesting {
}
| 211 | 20.2 | 82 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/ClassWithStringConstants.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
public class ClassWithStringConstants {
private ClassWithStringConstants() {
// Utility class
}
public static final String CONST1 = "a";
public static final String CONST2 = "b";
}
| 367 | 22 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/PublicUtils.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
public class PublicUtils {
private PublicUtils() {
}
public static int g1(int x) {
return x + 1;
}
public static int g2(int x) {
return x + 1;
}
public static int g3(int x) {
return x + 1;
}
}
| 413 | 17 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/Issue2016.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
import java.util.Objects;
/**
* Note: In order for this test case to work, the class "Issue2016" must also be compiled and available
* on the auxclasspath.
*/
public class Issue2016 {
public void testFunction() {
Objects.toString(null);
}
}
| 422 | 22.5 | 103 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/ClassWithConstants.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
import java.util.Arrays;
import java.util.List;
public class ClassWithConstants {
private ClassWithConstants() {
// Utility class
}
/*package*/ static final List<String> LIST1 = Arrays.asList("A");
/*package*/ static final List<String> LIST2 = Arrays.asList("B");
}
| 454 | 22.947368 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/Hello.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
import net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport.ConcFlow.Subscription;
abstract class Hello {
public static void sayHello() {
//...
Subscription x;
}
}
| 361 | 21.625 | 92 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/PackagePrivateUtils.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
final class PackagePrivateUtils {
private PackagePrivateUtils() {
}
static int f1(int x) {
return x + 1;
}
static int f2(int x) {
return x + 1;
}
static int f3(int x) {
return x + 1;
}
}
| 407 | 16.73913 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/ConcFlow.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
/**
* Minimized version of https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/concurrent/Flow.java
*/
public class ConcFlow {
public interface Subscription { }
public interface Subscriber<T> { }
public interface Publisher<T> { }
}
| 445 | 22.473684 | 130 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/NonStaticContainer.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
/**
* Minimized version of https://github.com/openjdk/jdk/blob/jdk-11%2B28/src/java.base/share/classes/java/util/concurrent/Flow.java
*/
public class NonStaticContainer {
private NonStaticContainer() {
}
public static void foo() {
}
public class NonStatic { }
public static class Static { }
}
| 485 | 20.130435 | 130 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/HelloMore.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport;
class HelloMore extends Hello {
// ...
}
| 206 | 19.7 | 79 | java |
pmd | pmd-master/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/rule/codestyle/unnecessaryimport/javalang/String.java | /*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.rule.codestyle.unnecessaryimport.javalang;
public class String {
}
| 194 | 20.666667 | 80 | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.