From 28646d6e6aff45b999a34d202d1fd5bbd8325d54 Mon Sep 17 00:00:00 2001 From: nsingh Date: Wed, 24 Jan 2018 16:12:56 -0800 Subject: [PATCH] Missing changes --- .../commons/jandex/JandexClasspath.java | 19 +++--- .../vscode/commons/java/ClasspathData.java | 60 +++++++++++++++++++ 2 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/java/ClasspathData.java diff --git a/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/jandex/JandexClasspath.java b/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/jandex/JandexClasspath.java index cbca86b7a..78b5878c9 100644 --- a/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/jandex/JandexClasspath.java +++ b/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/jandex/JandexClasspath.java @@ -57,17 +57,12 @@ public abstract class JandexClasspath implements IClasspath { Log.log(e); } return new JandexIndex(classpathEntries.map(p -> p.toFile()).collect(Collectors.toList()), jarFile -> findIndexFile(jarFile), classpathResource -> { - try { - switch (providerType) { - case JAVA_PARSER: - return createParserJavadocProvider(classpathResource); - default: - return createHtmlJavdocProvider(classpathResource); - } - } catch (Exception e) { - Log.log(e); + switch (providerType) { + case JAVA_PARSER: + return createParserJavadocProvider(classpathResource); + default: + return createHtmlJavdocProvider(classpathResource); } - return null; }, getBaseIndices()); } @@ -108,8 +103,8 @@ public abstract class JandexClasspath implements IClasspath { return javaIndex.get().findClasspathResourceForType(fqName); } - abstract protected IJavadocProvider createParserJavadocProvider(File classpathResource) throws Exception; + abstract protected IJavadocProvider createParserJavadocProvider(File classpathResource); - abstract protected IJavadocProvider createHtmlJavdocProvider(File classpathResource) throws Exception; + abstract protected IJavadocProvider createHtmlJavdocProvider(File classpathResource); } diff --git a/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/java/ClasspathData.java b/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/java/ClasspathData.java new file mode 100644 index 000000000..ba7fa9653 --- /dev/null +++ b/headless-services/commons/commons-java/src/main/java/org/springframework/ide/vscode/commons/java/ClasspathData.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2018 Pivotal, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.commons.java; + +import java.nio.file.Path; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.springframework.ide.vscode.commons.util.Log; + +import com.google.common.base.Objects; + +public class ClasspathData { + + final public static ClasspathData EMPTY_CLASSPATH_DATA = new ClasspathData(null, Collections.emptySet(), + Collections.emptySet(), null); + + final public String name; + final public Set classpathEntries; + final public Set classpathResources; + final public Path outputFolder; + + public ClasspathData(String name, Set classpathEntries, Set classpathResources, Path outputFolder) { + this.name = name; + this.classpathEntries = classpathEntries; + this.classpathResources = classpathResources; + this.outputFolder = outputFolder; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof ClasspathData) { + ClasspathData other = (ClasspathData) obj; + try { + return Objects.equal(name, other.name) && Objects.equal(classpathEntries, other.classpathEntries) + && Objects.equal(classpathResources, other.classpathResources) + && Objects.equal(outputFolder, outputFolder); + } catch (Throwable t) { + Log.log(t); + } + } + return false; + } + + public static ClasspathData from(String name, Collection classpathEntries, + Collection classpathResources, Path outputFolder) { + return new ClasspathData(name, new LinkedHashSet<>(classpathEntries), new LinkedHashSet<>(classpathResources), + outputFolder); + } +} \ No newline at end of file