Use Java 7+ diamond operator in compiler modules

This commit is contained in:
Alexander Udalov
2017-04-01 02:28:36 +03:00
parent 37f435da93
commit d440f07111
187 changed files with 512 additions and 533 deletions
@@ -106,7 +106,7 @@ public abstract class KotlinMultiFileTestWithJava<M, F> extends KotlinTestWithEn
String expectedText = KotlinTestUtils.doLoadFile(file);
Map<String, ModuleAndDependencies> modules = new HashMap<String, ModuleAndDependencies>();
Map<String, ModuleAndDependencies> modules = new HashMap<>();
List<F> testFiles =
KotlinTestUtils.createTestFiles(file.getName(), expectedText, new KotlinTestUtils.TestFileFactory<M, F>() {
@@ -45,7 +45,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
protected void doMultiFileTest(@NotNull File wholeFile, @NotNull List<TestFile> files, @Nullable File javaFilesDir) throws Exception {
TestJdkKind jdkKind = getJdkKind(files);
List<String> javacOptions = new ArrayList<String>(0);
List<String> javacOptions = new ArrayList<>(0);
for (TestFile file : files) {
if (InTextDirectivesUtils.isDirectiveDefined(file.content, "WITH_RUNTIME")) {
addRuntime = true;
@@ -79,7 +79,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
@NotNull
protected static List<String> findJavaSourcesInDirectory(@NotNull File directory) {
List<String> javaFilePaths = new ArrayList<String>(1);
List<String> javaFilePaths = new ArrayList<>(1);
FileUtil.processFilesRecursively(directory, file -> {
if (file.isFile() && FilesKt.getExtension(file).equals(JavaFileType.DEFAULT_EXTENSION)) {
@@ -134,7 +134,7 @@ public abstract class AbstractCheckLocalVariablesTableTest extends TestCaseWithT
@NotNull
private static List<LocalVariable> readLocalVariable(ClassReader cr, String methodName) throws Exception {
class Visitor extends ClassVisitor {
List<LocalVariable> readVariables = new ArrayList<LocalVariable>();
List<LocalVariable> readVariables = new ArrayList<>();
public Visitor() {
super(Opcodes.ASM5);
@@ -83,7 +83,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
System.out.println(result);
throw ExceptionUtilsKt.rethrow(e);
}
return new Pair<ClassFileFactory, ClassFileFactory>(factoryA, factoryB);
return new Pair<>(factoryA, factoryB);
}
private void invokeBox(@NotNull String className) throws Exception {
@@ -82,9 +82,7 @@ public abstract class AbstractLineNumberTest extends TestCaseWithTmpdir {
throw ExceptionUtilsKt.rethrow(e);
}
return new Pair<KtFile, KotlinCoreEnvironment>(
KotlinTestUtils.createFile(file.getName(), text, environment.getProject()), environment
);
return new Pair<>(KotlinTestUtils.createFile(file.getName(), text, environment.getProject()), environment);
}
private void doTest(@NotNull String filename, boolean custom) {
@@ -206,8 +204,8 @@ public abstract class AbstractLineNumberTest extends TestCaseWithTmpdir {
@NotNull
private static List<String> readAllLineNumbers(@NotNull ClassReader reader) {
List<String> result = new ArrayList<String>();
Set<String> visitedLabels = new HashSet<String>();
List<String> result = new ArrayList<>();
Set<String> visitedLabels = new HashSet<>();
reader.accept(new ClassVisitor(Opcodes.ASM5) {
@Override
@@ -39,7 +39,7 @@ public abstract class AbstractTopLevelMembersInvocationTest extends AbstractByte
@Override
public void doTest(@NotNull String filename) throws Exception {
File root = new File(filename);
List<String> sourceFiles = new ArrayList<String>(2);
List<String> sourceFiles = new ArrayList<>(2);
FileUtil.processFilesRecursively(root, file -> {
if (file.getName().endsWith(".kt")) {
@@ -143,7 +143,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
@NotNull List<TestFile> testFilesWithConfigurationDirectives,
@NotNull CompilerConfiguration configuration
) {
List<String> kotlinConfigurationFlags = new ArrayList<String>(0);
List<String> kotlinConfigurationFlags = new ArrayList<>(0);
LanguageVersion explicitLanguageVersion = null;
for (TestFile testFile : testFilesWithConfigurationDirectives) {
kotlinConfigurationFlags.addAll(InTextDirectivesUtils.findListWithPrefixes(testFile.content, "// KOTLIN_CONFIGURATION_FLAGS:"));
@@ -288,10 +288,10 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
public static CodegenTestFiles loadMultiFiles(@NotNull List<TestFile> files, @NotNull Project project) {
Collections.sort(files);
List<KtFile> ktFiles = new ArrayList<KtFile>(files.size());
List<KtFile> ktFiles = new ArrayList<>(files.size());
for (TestFile file : files) {
if (file.name.endsWith(".kt")) {
String content = CheckerTestUtil.parseDiagnosedRanges(file.content, new ArrayList<CheckerTestUtil.DiagnosedRange>(0));
String content = CheckerTestUtil.parseDiagnosedRanges(file.content, new ArrayList<>(0));
ktFiles.add(KotlinTestUtils.createFile(file.name, content, project));
}
}
@@ -436,7 +436,7 @@ public abstract class CodegenTestCase extends KtUsefulTestCase {
SimpleVerifier verifier = new SimpleVerifier();
verifier.setClassLoader(loader);
Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(verifier);
Analyzer<BasicValue> analyzer = new Analyzer<>(verifier);
boolean noErrors = true;
for (MethodNode method : classNode.methods) {
@@ -87,7 +87,7 @@ public class CodegenTestFiles {
}
public static CodegenTestFiles create(Project project, String[] names, String testDataPath) {
List<KtFile> files = new ArrayList<KtFile>(names.length);
List<KtFile> files = new ArrayList<>(names.length);
for (String name : names) {
try {
String content = KotlinTestUtils.doLoadFile(testDataPath + "/codegen/", name);
@@ -103,7 +103,7 @@ public class CodegenTestFiles {
@NotNull
public static CodegenTestFiles create(@NotNull String fileName, @NotNull String contentWithDiagnosticMarkup, @NotNull Project project) {
String content = CheckerTestUtil.parseDiagnosedRanges(contentWithDiagnosticMarkup, new ArrayList<CheckerTestUtil.DiagnosedRange>());
String content = CheckerTestUtil.parseDiagnosedRanges(contentWithDiagnosticMarkup, new ArrayList<>());
KtFile file = KotlinTestUtils.createFile(fileName, content, project);
List<PsiErrorElement> ranges = AnalyzingUtils.getSyntaxErrorRanges(file);
assert ranges.isEmpty() : "Syntax errors found in " + file + ": " + ranges;
@@ -114,13 +114,13 @@ public class CodegenTestUtil {
) {
try {
File javaClassesTempDirectory = KotlinTestUtils.tmpDir("java-classes");
List<String> classpath = new ArrayList<String>();
List<String> classpath = new ArrayList<>();
classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath());
classpath.add(ForTestCompileRuntime.reflectJarForTests().getPath());
classpath.add(KotlinTestUtils.getAnnotationsJar().getPath());
classpath.addAll(additionalClasspath);
List<String> options = new ArrayList<String>(Arrays.asList(
List<String> options = new ArrayList<>(Arrays.asList(
"-classpath", StringsKt.join(classpath, File.pathSeparator),
"-d", javaClassesTempDirectory.getPath()
));
@@ -98,7 +98,7 @@ public abstract class AbstractWriteFlagsTest extends CodegenTestCase {
private static List<TestedObject> parseExpectedTestedObject(String testDescription) {
String[] testObjectData = testDescription.substring(testDescription.indexOf("// TESTED_OBJECT_KIND")).split("\n\n");
List<TestedObject> objects = new ArrayList<TestedObject>();
List<TestedObject> objects = new ArrayList<>();
for (String testData : testObjectData) {
if (testData.isEmpty()) continue;
@@ -28,8 +28,8 @@ import java.util.ArrayList;
import java.util.List;
public class ForTestCompileRuntime {
private static volatile SoftReference<ClassLoader> reflectJarClassLoader = new SoftReference<ClassLoader>(null);
private static volatile SoftReference<ClassLoader> runtimeJarClassLoader = new SoftReference<ClassLoader>(null);
private static volatile SoftReference<ClassLoader> reflectJarClassLoader = new SoftReference<>(null);
private static volatile SoftReference<ClassLoader> runtimeJarClassLoader = new SoftReference<>(null);
@NotNull
public static File runtimeJarForTests() {
@@ -81,7 +81,7 @@ public class ForTestCompileRuntime {
ClassLoader loader = reflectJarClassLoader.get();
if (loader == null) {
loader = createClassLoader(runtimeJarForTests(), reflectJarForTests(), scriptRuntimeJarForTests(), kotlinTestJarForTests());
reflectJarClassLoader = new SoftReference<ClassLoader>(loader);
reflectJarClassLoader = new SoftReference<>(loader);
}
return loader;
}
@@ -91,7 +91,7 @@ public class ForTestCompileRuntime {
ClassLoader loader = runtimeJarClassLoader.get();
if (loader == null) {
loader = createClassLoader(runtimeJarForTests(), scriptRuntimeJarForTests());
runtimeJarClassLoader = new SoftReference<ClassLoader>(loader);
runtimeJarClassLoader = new SoftReference<>(loader);
}
return loader;
}
@@ -99,7 +99,7 @@ public class ForTestCompileRuntime {
@NotNull
private static ClassLoader createClassLoader(@NotNull File... files) {
try {
List<URL> urls = new ArrayList<URL>(2);
List<URL> urls = new ArrayList<>(2);
for (File file : files) {
urls.add(file.toURI().toURL());
}
@@ -55,7 +55,7 @@ public class ExpectedLoadErrorsUtil {
}
private static Map<SourceElement, List<String>> getExpectedLoadErrors(@NotNull PackageViewDescriptor packageFromJava) {
Map<SourceElement, List<String>> map = new HashMap<SourceElement, List<String>>();
Map<SourceElement, List<String>> map = new HashMap<>();
packageFromJava.acceptVoid(new DeclarationDescriptorVisitorEmptyBodies<Void, Void>() {
@Override
@@ -107,7 +107,7 @@ public class ExpectedLoadErrorsUtil {
}
private static Map<SourceElement, List<String>> getActualLoadErrors(@NotNull BindingContext bindingContext) {
Map<SourceElement, List<String>> result = new HashMap<SourceElement, List<String>>();
Map<SourceElement, List<String>> result = new HashMap<>();
Collection<DeclarationDescriptor> descriptors = bindingContext.getKeys(JvmBindingContextSlices.LOAD_FROM_JAVA_SIGNATURE_ERRORS);
for (DeclarationDescriptor descriptor : descriptors) {
@@ -72,10 +72,10 @@ public class LoadDescriptorUtil {
@NotNull ConfigurationKind configurationKind,
boolean isBinaryRoot
) {
List<File> javaBinaryRoots = new ArrayList<File>();
List<File> javaBinaryRoots = new ArrayList<>();
javaBinaryRoots.add(KotlinTestUtils.getAnnotationsJar());
List<File> javaSourceRoots = new ArrayList<File>();
List<File> javaSourceRoots = new ArrayList<>();
javaSourceRoots.add(new File("compiler/testData/loadJava/include"));
if (isBinaryRoot) {
javaBinaryRoots.add(javaRoot);
@@ -59,7 +59,7 @@ public class ExpectedResolveDataUtil {
Project project = environment.getProject();
KotlinBuiltIns builtIns = DefaultBuiltIns.getInstance();
Map<String, DeclarationDescriptor> nameToDescriptor = new HashMap<String, DeclarationDescriptor>();
Map<String, DeclarationDescriptor> nameToDescriptor = new HashMap<>();
nameToDescriptor.put("kotlin::Int.plus(Int)", standardFunction(builtIns.getInt(), "plus", project, builtIns.getIntType()));
FunctionDescriptor descriptorForGet = standardFunction(builtIns.getArray(), "get", project, builtIns.getIntType());
nameToDescriptor.put("kotlin::Array.get(Int)", descriptorForGet.getOriginal());
@@ -74,7 +74,7 @@ public class ExpectedResolveDataUtil {
@NotNull
public static Map<String, PsiElement> prepareDefaultNameToDeclaration(@NotNull KotlinCoreEnvironment environment) {
Project project = environment.getProject();
Map<String, PsiElement> nameToDeclaration = new HashMap<String, PsiElement>();
Map<String, PsiElement> nameToDeclaration = new HashMap<>();
PsiClass java_util_Collections = findClass("java.util.Collections", environment);
nameToDeclaration.put("java::java.util.Collections.emptyList()", findMethod(java_util_Collections, "emptyList"));
@@ -154,7 +154,7 @@ public class ExpectedResolveDataUtil {
TemporaryBindingTrace traceWithFakeArgumentInfo =
TemporaryBindingTrace.create(context.trace, "trace to store fake argument for", name);
List<KtExpression> fakeArguments = new ArrayList<KtExpression>(parameterTypes.length);
List<KtExpression> fakeArguments = new ArrayList<>(parameterTypes.length);
for (KotlinType type : parameterTypes) {
fakeArguments.add(ExpressionTypingUtils.createFakeExpressionOfType(
project, traceWithFakeArgumentInfo, "fakeArgument" + fakeArguments.size(), type
@@ -69,7 +69,7 @@ public final class InTextDirectivesUtils {
@NotNull
public static List<String> findListWithPrefixes(@NotNull String fileText, @NotNull String... prefixes) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
for (String line : findLinesWithPrefixesRemoved(fileText, prefixes)) {
String unquoted = StringUtil.unquoteString(line);
@@ -115,7 +115,7 @@ public final class InTextDirectivesUtils {
@NotNull
public static List<String> findLinesWithPrefixesRemoved(String fileText, boolean trim, String... prefixes) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
List<String> cleanedPrefixes = cleanDirectivesFromComments(Arrays.asList(prefixes));
for (String line : fileNonEmptyCommentedLines(fileText)) {
@@ -183,7 +183,7 @@ public final class InTextDirectivesUtils {
@NotNull
private static List<String> fileNonEmptyCommentedLines(String fileText) {
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();
try {
try (BufferedReader reader = new BufferedReader(new StringReader(fileText))) {
@@ -36,7 +36,7 @@ import java.util.*;
* with IDEA package test runner.
*/
public class JUnit3RunnerWithInners extends Runner implements Filterable, Sortable {
private static final Set<Class> requestedRunners = new HashSet<Class>();
private static final Set<Class> requestedRunners = new HashSet<>();
private JUnit38ClassRunner delegateRunner;
private final Class<?> klass;
@@ -126,8 +126,8 @@ public class JUnit3RunnerWithInners extends Runner implements Filterable, Sortab
}
private static Test createTreeTestSuite(Class root) {
Set<Class> classes = new LinkedHashSet<Class>(collectDeclaredClasses(root, true));
Map<Class, TestSuite> classSuites = new HashMap<Class, TestSuite>();
Set<Class> classes = new LinkedHashSet<>(collectDeclaredClasses(root, true));
Map<Class, TestSuite> classSuites = new HashMap<>();
for (Class aClass : classes) {
classSuites.put(aClass, hasTestMethods(aClass) ? new TestSuite(aClass) : new TestSuite(aClass.getCanonicalName()));
@@ -143,7 +143,7 @@ public class JUnit3RunnerWithInners extends Runner implements Filterable, Sortab
}
private static Set<Class> unprocessedClasses(Collection<Class> classes) {
Set<Class> result = new LinkedHashSet<Class>();
Set<Class> result = new LinkedHashSet<>();
for (Class aClass : classes) {
if (!requestedRunners.contains(aClass)) {
result.add(aClass);
@@ -154,7 +154,7 @@ public class JUnit3RunnerWithInners extends Runner implements Filterable, Sortab
}
private static List<Class> collectDeclaredClasses(Class klass, boolean withItself) {
List<Class> result = new ArrayList<Class>();
List<Class> result = new ArrayList<>();
if (withItself) {
result.add(klass);
}
@@ -100,7 +100,7 @@ public class KotlinTestUtils {
public static final String TEST_GENERATOR_NAME = "org.jetbrains.kotlin.generators.tests.TestsPackage";
public static final String PLEASE_REGENERATE_TESTS = "Please regenerate tests (GenerateTests.kt)";
private static final List<File> filesToDelete = new ArrayList<File>();
private static final List<File> filesToDelete = new ArrayList<>();
/**
* Syntax:
@@ -486,7 +486,7 @@ public class KotlinTestUtils {
public static void resolveAllKotlinFiles(KotlinCoreEnvironment environment) throws IOException {
List<ContentRoot> paths = environment.getConfiguration().get(JVMConfigurationKeys.CONTENT_ROOTS);
if (paths == null) return;
List<KtFile> ktFiles = new ArrayList<KtFile>();
List<KtFile> ktFiles = new ArrayList<>();
for (ContentRoot root : paths) {
if (!(root instanceof KotlinSourceRoot)) continue;
@@ -718,7 +718,7 @@ public class KotlinTestUtils {
}
public static String getLastCommentedLines(@NotNull Document document) {
List<CharSequence> resultLines = new ArrayList<CharSequence>();
List<CharSequence> resultLines = new ArrayList<>();
for (int i = document.getLineCount() - 1; i >= 0; i--) {
int lineStart = document.getLineStartOffset(i);
int lineEnd = document.getLineEndOffset(i);
@@ -796,7 +796,7 @@ public class KotlinTestUtils {
private static boolean compileJavaFiles(@NotNull Collection<File> files, List<String> options, @Nullable File javaErrorFile) throws IOException {
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>();
DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<>();
try (StandardJavaFileManager fileManager =
javaCompiler.getStandardFileManager(diagnosticCollector, Locale.ENGLISH, Charset.forName("utf-8"))) {
Iterable<? extends JavaFileObject> javaFileObjectsFromFiles = fileManager.getJavaFileObjectsFromFiles(files);
@@ -44,7 +44,7 @@ import static org.junit.Assert.assertEquals;
public class MockLibraryUtil {
private static SoftReference<ClassLoader> compilerClassLoader = new SoftReference<ClassLoader>(null);
private static SoftReference<ClassLoader> compilerClassLoader = new SoftReference<>(null);
@NotNull
public static File compileLibraryToJar(
@@ -105,7 +105,7 @@ public class MockLibraryUtil {
List<File> javaFiles = FileUtil.findFilesByMask(Pattern.compile(".*\\.java"), srcFile);
if (!javaFiles.isEmpty()) {
List<String> classpath = new ArrayList<String>();
List<String> classpath = new ArrayList<>();
classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath());
classpath.add(KotlinTestUtils.getAnnotationsJar().getPath());
Collections.addAll(classpath, extraClasspath);
@@ -200,13 +200,13 @@ public class MockLibraryUtil {
boolean allowKotlinPackage,
@NotNull String... extraClasspath
) {
List<String> classpath = new ArrayList<String>();
List<String> classpath = new ArrayList<>();
if (new File(sourcesPath).isDirectory()) {
classpath.add(sourcesPath);
}
Collections.addAll(classpath, extraClasspath);
List<String> args = new ArrayList<String>();
List<String> args = new ArrayList<>();
args.add(sourcesPath);
args.add("-d");
args.add(outDir.getAbsolutePath());
@@ -220,7 +220,7 @@ public class MockLibraryUtil {
}
private static void compileKotlin2JS(@NotNull String sourcesPath, @NotNull File outputFile) {
List<String> args = new ArrayList<String>();
List<String> args = new ArrayList<>();
args.add("-meta-info");
args.add("-output");
@@ -250,7 +250,7 @@ public class MockLibraryUtil {
ClassLoader classLoader = compilerClassLoader.get();
if (classLoader == null) {
classLoader = createCompilerClassLoader();
compilerClassLoader = new SoftReference<ClassLoader>(classLoader);
compilerClassLoader = new SoftReference<>(classLoader);
}
return classLoader.loadClass(compilerClassName);
}
@@ -55,8 +55,8 @@ public abstract class KtUsefulTestCase extends TestCase {
private static final String ORIGINAL_TEMP_DIR = FileUtil.getTempDirectory();
private static final Map<String, Long> TOTAL_SETUP_COST_MILLIS = new HashMap<String, Long>();
private static final Map<String, Long> TOTAL_TEARDOWN_COST_MILLIS = new HashMap<String, Long>();
private static final Map<String, Long> TOTAL_SETUP_COST_MILLIS = new HashMap<>();
private static final Map<String, Long> TOTAL_TEARDOWN_COST_MILLIS = new HashMap<>();
private Application application;
@@ -73,7 +73,7 @@ public abstract class KtUsefulTestCase extends TestCase {
};
private static final String ourPathToKeep = null;
private final List<String> myPathsToKeep = new ArrayList<String>();
private final List<String> myPathsToKeep = new ArrayList<>();
private String myTempDir;
@@ -180,7 +180,7 @@ public abstract class KtUsefulTestCase extends TestCase {
List<String> list;
synchronized (DELETE_ON_EXIT_HOOK_CLASS) {
if (DELETE_ON_EXIT_HOOK_DOT_FILES.isEmpty()) return;
list = new ArrayList<String>(DELETE_ON_EXIT_HOOK_DOT_FILES);
list = new ArrayList<>(DELETE_ON_EXIT_HOOK_DOT_FILES);
}
for (int i = list.size() - 1; i >= 0; i--) {
String path = list.get(i);
@@ -310,7 +310,7 @@ public abstract class KtUsefulTestCase extends TestCase {
String erroMsg,
Iterable<? extends T> actual,
Collection<? extends T> expected) {
ArrayList<T> list = new ArrayList<T>();
ArrayList<T> list = new ArrayList<>();
for (T t : actual) {
list.add(t);
}
@@ -337,9 +337,9 @@ public abstract class KtUsefulTestCase extends TestCase {
public static <T> void assertSameElements(String message, Collection<? extends T> collection, Collection<T> expected) {
assertNotNull(collection);
assertNotNull(expected);
if (collection.size() != expected.size() || !new HashSet<T>(expected).equals(new HashSet<T>(collection))) {
if (collection.size() != expected.size() || !new HashSet<>(expected).equals(new HashSet<T>(collection))) {
Assert.assertEquals(message, toString(expected, "\n"), toString(collection, "\n"));
Assert.assertEquals(message, new HashSet<T>(expected), new HashSet<T>(collection));
Assert.assertEquals(message, new HashSet<>(expected), new HashSet<T>(collection));
}
}
@@ -36,7 +36,7 @@ import java.util.Map;
public class MockPsiManager extends PsiManagerEx {
private final Project myProject;
private final Map<VirtualFile,PsiDirectory> myDirectories = new THashMap<VirtualFile, PsiDirectory>();
private final Map<VirtualFile,PsiDirectory> myDirectories = new THashMap<>();
private MockFileManager myMockFileManager;
private PsiModificationTrackerImpl myPsiModificationTracker;
@@ -174,7 +174,7 @@ public class RecursiveDescriptorComparator {
@NotNull
private MemberScope getPackageScopeInModule(@NotNull PackageViewDescriptor descriptor, @NotNull ModuleDescriptor module) {
// See LazyPackageViewDescriptorImpl#memberScope
List<MemberScope> scopes = new ArrayList<MemberScope>();
List<MemberScope> scopes = new ArrayList<>();
for (PackageFragmentDescriptor fragment : descriptor.getFragments()) {
if (isFromModule(fragment, module)) {
scopes.add(fragment.getMemberScope());
@@ -31,7 +31,7 @@ public class RecursiveDescriptorProcessor {
D data,
@NotNull DeclarationDescriptorVisitor<Boolean, D> visitor
) {
return descriptor.accept(new RecursiveVisitor<D>(visitor), data);
return descriptor.accept(new RecursiveVisitor<>(visitor), data);
}
private static class RecursiveVisitor<D> implements DeclarationDescriptorVisitor<Boolean, D> {