pmd-java8: checkstyle / formatting
This commit is contained in:
@ -1,12 +1,15 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.java.bugs;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||
import net.sourceforge.pmd.lang.LanguageVersionHandler;
|
||||
import net.sourceforge.pmd.lang.java.JavaLanguageModule;
|
||||
@ -21,8 +24,10 @@ public class InterfaceMethodTest {
|
||||
ASTCompilationUnit acu = parseAndTypeResolveForClass(UsesJavaStreams.class);
|
||||
}
|
||||
|
||||
// Note: If you're using Eclipse or some other IDE to run this test, you _must_ have the regress folder in
|
||||
// the classpath. Normally the IDE doesn't put source directories themselves directly in the classpath, only
|
||||
// Note: If you're using Eclipse or some other IDE to run this test, you
|
||||
// _must_ have the regress folder in
|
||||
// the classpath. Normally the IDE doesn't put source directories themselves
|
||||
// directly in the classpath, only
|
||||
// the output directories are in the classpath.
|
||||
private ASTCompilationUnit parseAndTypeResolveForClass(Class<?> clazz) {
|
||||
String sourceFile = clazz.getName().replace('.', '/') + ".java";
|
||||
@ -30,8 +35,10 @@ public class InterfaceMethodTest {
|
||||
if (is == null) {
|
||||
throw new IllegalArgumentException("Unable to find source file " + sourceFile + " for " + clazz);
|
||||
}
|
||||
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion("1.8").getLanguageVersionHandler();
|
||||
ASTCompilationUnit acu = (ASTCompilationUnit)languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new InputStreamReader(is));
|
||||
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(JavaLanguageModule.NAME)
|
||||
.getVersion("1.8").getLanguageVersionHandler();
|
||||
ASTCompilationUnit acu = (ASTCompilationUnit) languageVersionHandler
|
||||
.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new InputStreamReader(is));
|
||||
languageVersionHandler.getSymbolFacade().start(acu);
|
||||
languageVersionHandler.getTypeResolutionFacade(InterfaceMethodTest.class.getClassLoader()).start(acu);
|
||||
return acu;
|
||||
|
@ -1,11 +1,14 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.typeresolution;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.lang.LanguageRegistry;
|
||||
import net.sourceforge.pmd.lang.LanguageVersionHandler;
|
||||
import net.sourceforge.pmd.lang.java.JavaLanguageModule;
|
||||
@ -13,7 +16,6 @@ import net.sourceforge.pmd.lang.java.ast.ASTCompilationUnit;
|
||||
import net.sourceforge.pmd.typeresolution.testdata.UsesJavaStreams;
|
||||
import net.sourceforge.pmd.typeresolution.testdata.UsesRepeatableAnnotations;
|
||||
|
||||
|
||||
public class ClassTypeResolverJava8Test {
|
||||
|
||||
@Test
|
||||
@ -26,7 +28,6 @@ public class ClassTypeResolverJava8Test {
|
||||
ASTCompilationUnit acu = parseAndTypeResolveForClass18(UsesRepeatableAnnotations.class);
|
||||
}
|
||||
|
||||
|
||||
public static junit.framework.Test suite() {
|
||||
return new junit.framework.JUnit4TestAdapter(ClassTypeResolverJava8Test.class);
|
||||
}
|
||||
@ -35,8 +36,10 @@ public class ClassTypeResolverJava8Test {
|
||||
return parseAndTypeResolveForClass(clazz, "1.8");
|
||||
}
|
||||
|
||||
// Note: If you're using Eclipse or some other IDE to run this test, you _must_ have the regress folder in
|
||||
// the classpath. Normally the IDE doesn't put source directories themselves directly in the classpath, only
|
||||
// Note: If you're using Eclipse or some other IDE to run this test, you
|
||||
// _must_ have the regress folder in
|
||||
// the classpath. Normally the IDE doesn't put source directories themselves
|
||||
// directly in the classpath, only
|
||||
// the output directories are in the classpath.
|
||||
private ASTCompilationUnit parseAndTypeResolveForClass(Class<?> clazz, String version) {
|
||||
String sourceFile = clazz.getName().replace('.', '/') + ".java";
|
||||
@ -44,8 +47,10 @@ public class ClassTypeResolverJava8Test {
|
||||
if (is == null) {
|
||||
throw new IllegalArgumentException("Unable to find source file " + sourceFile + " for " + clazz);
|
||||
}
|
||||
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(JavaLanguageModule.NAME).getVersion(version).getLanguageVersionHandler();
|
||||
ASTCompilationUnit acu = (ASTCompilationUnit) languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new InputStreamReader(is));
|
||||
LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(JavaLanguageModule.NAME)
|
||||
.getVersion(version).getLanguageVersionHandler();
|
||||
ASTCompilationUnit acu = (ASTCompilationUnit) languageVersionHandler
|
||||
.getParser(languageVersionHandler.getDefaultParserOptions()).parse(null, new InputStreamReader(is));
|
||||
languageVersionHandler.getSymbolFacade().start(acu);
|
||||
languageVersionHandler.getTypeResolutionFacade(ClassTypeResolverJava8Test.class.getClassLoader()).start(acu);
|
||||
return acu;
|
||||
|
@ -1,15 +1,20 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.typeresolution.testdata;
|
||||
|
||||
public class UsesJavaStreams {
|
||||
interface WithStaticAndDefaultMethod {
|
||||
static void performOn() { }
|
||||
default void myToString() {}
|
||||
static void performOn() {
|
||||
}
|
||||
|
||||
default void myToString() {
|
||||
}
|
||||
}
|
||||
|
||||
class ImplWithStaticAndDefaultMethod implements WithStaticAndDefaultMethod {}
|
||||
class ImplWithStaticAndDefaultMethod implements WithStaticAndDefaultMethod {
|
||||
}
|
||||
|
||||
public void performStuff() {
|
||||
WithStaticAndDefaultMethod.performOn();
|
||||
|
@ -1,11 +1,13 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.typeresolution.testdata;
|
||||
|
||||
import java.lang.annotation.Repeatable;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
import net.sourceforge.pmd.typeresolution.testdata.UsesRepeatableAnnotations.Multitude;
|
||||
|
||||
@Multitude("1")
|
||||
@ -16,9 +18,13 @@ public class UsesRepeatableAnnotations {
|
||||
|
||||
@Repeatable(Multitudes.class)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Multitude { String value(); }
|
||||
@interface Multitude {
|
||||
String value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface Multitudes { Multitude[] value(); }
|
||||
@interface Multitudes {
|
||||
Multitude[] value();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user