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