Skip to content

Commit

Permalink
dsldevkit#22: SCA configuration - missed cleanups
Browse files Browse the repository at this point in the history
 - Catch some final cleanups of PMD - phase 2

Issue: dsldevkit#22
  • Loading branch information
[email protected] authored and [email protected] committed Dec 20, 2017
1 parent 06c69f8 commit a91fcb3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Class<? extends IGeneratorConfigProvider> bindIGeneratorConfigProvider()
* @return IXtextEditorCallback.NullImpl
*/
@Override
public Class<? extends org.eclipse.xtext.ui.editor.IXtextEditorCallback> bindIXtextEditorCallback() {
public Class<? extends IXtextEditorCallback> bindIXtextEditorCallback() {
return IXtextEditorCallback.NullImpl.class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ private void assertNoDiagnostics(final Diagnostic diagnostics) {
* the message
* @return true, if given list of errors contains an error with given message
*/
public static boolean containsError(final EList<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors, final String message) {
public static boolean containsError(final EList<Resource.Diagnostic> errors, final String message) {
return !Iterables.isEmpty(errors) && Iterables.contains(Iterables.transform(errors, new Function<Resource.Diagnostic, String>() {
@Override
public String apply(final Resource.Diagnostic d) {
Expand Down Expand Up @@ -727,7 +727,7 @@ public static void assertNoErrorsOnResource(final EObject object) {
*/
public static void assertNoErrorsOnResource(final EObject object, final String... messages) {
List<String> messageList = Lists.newArrayList(messages);
final EList<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = object.eResource().getErrors();
final EList<Resource.Diagnostic> errors = object.eResource().getErrors();
for (String errorMessage : HELPER.getErrorMessages(errors)) {
assertFalse(NO_ERRORS_FOUND_ON_RESOURCE_MESSAGE + " with message '" + errorMessage + "'.", messageList.contains(errorMessage));
}
Expand Down Expand Up @@ -778,7 +778,7 @@ public static void assertLinkingErrorsOnResourceExist(final EObject object, fina
* the error strings
*/
public static void assertErrorsOnResourceExist(final EObject object, final String... errorStrings) {
final EList<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = object.eResource().getErrors();
final EList<Resource.Diagnostic> errors = object.eResource().getErrors();
final List<String> errorMessages = HELPER.getErrorMessages(errors);
for (final String s : errorStrings) {
assertTrue(NLS.bind("Expected error \"{0}\" but could not find it", s), errorMessages.contains(s));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Map;
import java.util.Set;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheStats;
import com.google.common.cache.Weigher;
Expand All @@ -32,12 +33,9 @@
*/
public class MapCache<K, V> implements ICache<K, V>, Map<K, V> {

private final com.google.common.cache.Cache<K, V> backend;
private final Cache<K, V> backend;
private final String name;

/**
* New instances should be created through {@link CacheManager}.
*/
MapCache(final String name, final CacheConfiguration config) {
this.name = name;

Expand Down Expand Up @@ -84,15 +82,7 @@ public void clear() {
backend.invalidateAll();
}

/**
* Stores an entry if it does not yet exist in the cache.
*
* @param key
* the key, must not be {@code null}
* @param value
* the value, must not be {@code null}
* @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key
*/
@Override
public V putIfAbsent(final K key, final V value) {
V oldValue = get(key);
if (oldValue == null) {
Expand Down Expand Up @@ -152,8 +142,8 @@ public void putAll(final Map<? extends K, ? extends V> m) {
}

@Override
public Set<java.util.Map.Entry<K, V>> entrySet() {
public Set<Map.Entry<K, V>> entrySet() {
return backend.asMap().entrySet();
}
}

}

0 comments on commit a91fcb3

Please sign in to comment.