Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add -Werror everywhere and fix the final errors
  • Loading branch information
henri-tremblay committed Jul 13, 2018
1 parent 9ba8e62 commit 0d53e2d
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 34 deletions.
8 changes: 0 additions & 8 deletions clustered/client/build.gradle
Expand Up @@ -48,11 +48,3 @@ test {
jvmArgs += ['--add-modules', 'java.xml.bind']
}
}

compileJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}

compileTestJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}
Expand Up @@ -85,7 +85,7 @@ public class ClusteringCacheManagerServiceConfigurationParserTest {
@Test
public void testServiceLocator() throws Exception {
String expectedParser = ClusteringCacheManagerServiceConfigurationParser.class.getName();
@SuppressWarnings({"unchecked ", "rawtypes"})
@SuppressWarnings({"unchecked", "rawtypes"})
ServiceLoader<CacheManagerServiceConfigurationParser<? extends Service>> parsers = (ServiceLoader)
ClassLoading.libraryServiceLoaderFor(CacheManagerServiceConfigurationParser.class);

Expand Down
Expand Up @@ -69,6 +69,7 @@
import static org.junit.Assert.assertTrue;
import static org.terracotta.testing.rules.BasicExternalClusterBuilder.newCluster;

@SuppressWarnings("rawtypes") // Need to suppress because of a Javac bug giving a rawtype on AbstractManageableNode::isManageable.
public abstract class AbstractClusteringManagementTest extends ClusteredTests {

private static final String RESOURCE_CONFIG =
Expand Down
7 changes: 0 additions & 7 deletions clustered/server/build.gradle
Expand Up @@ -32,10 +32,3 @@ dependencies {
providedImplementation "org.terracotta:standard-cluster-services:$terracottaApisVersion"
providedImplementation "org.terracotta:runnel:$terracottaPlatformVersion"
}

compileJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}
compileTestJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}
4 changes: 0 additions & 4 deletions core/build.gradle
Expand Up @@ -21,7 +21,3 @@ dependencies {
implementation "org.terracotta:statistics:$parent.statisticVersion"
testImplementation project(':spi-tester')
}

compileTestJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}
Expand Up @@ -71,17 +71,17 @@ public void testPutAllWithWriter() throws Exception {
verify(cacheLoaderWriter).writeAll(argThat(hasItems(entry(1, "one"), entry(2, "two"), entry(3, "three"))));
}

private Function<List<Map.Entry<Integer, String>>, Object> extractFunctionFromArgs(InvocationOnMock invocation) {
return (Function<List<Map.Entry<Integer, String>>, Object>)invocation.getArguments()[1];
private <T, R> Function<T, R> extractFunctionFromArgs(InvocationOnMock invocation) {
return (Function<T, R>) invocation.getArguments()[1];
}

@Test
public void testGetAllWithLoader() throws Exception {
Store<Number, CharSequence> store = mock(Store.class);

when(store.bulkComputeIfAbsent((Set<? extends Number>)argThat(hasItems(1, 2, 3)), any(Function.class))).thenAnswer(invocation -> {
Function<List<Map.Entry<Integer, String>>, Object> function = extractFunctionFromArgs(invocation);
List<Map.Entry<Integer, String>> o = (List<Map.Entry<Integer, String>>) invocation.getArguments()[0];
Function<Set<? extends Number>, Object> function = extractFunctionFromArgs(invocation);
Set<? extends Number> o = (Set<? extends Number>) invocation.getArguments()[0];
function.apply(o);

Map<Number, ValueHolder<CharSequence>>loaderValues = new LinkedHashMap<>();
Expand Down
4 changes: 0 additions & 4 deletions impl/build.gradle
Expand Up @@ -36,7 +36,3 @@ compileJava {
//no -Werror due to unsafe
options.compilerArgs = ['-Xlint:all']
}

compileTestJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}
Expand Up @@ -22,6 +22,8 @@
*/
public class VisitorListenerException extends RuntimeException {

private static final long serialVersionUID = 524283391526103012L;

public VisitorListenerException(String message) {
super(message);
}
Expand Down
Expand Up @@ -235,9 +235,9 @@ public static <T extends Enum<T>> boolean hasOperationStat(Object rootNode, Clas
.filter(context(identifier(subclassOf(OperationStatistic.class))))
.filter(context(attributes(Matchers.allOf(
hasAttribute("name", statName),
hasAttribute("this", new Matcher<OperationStatistic>() {
hasAttribute("this", new Matcher<OperationStatistic<T>>() {
@Override
protected boolean matchesSafely(OperationStatistic object) {
protected boolean matchesSafely(OperationStatistic<T> object) {
return object.type().equals(statisticType);
}
})
Expand Down
Expand Up @@ -80,6 +80,9 @@ private void notifyInvalidation(K key, Store.ValueHolder<V> p) {
}

static class ComputationException extends RuntimeException {

private static final long serialVersionUID = 6832417052348277644L;

public ComputationException(StoreAccessException cause) {
super(cause);
}
Expand Down
Expand Up @@ -123,6 +123,9 @@ public void close() throws IOException {
}

static class Tuple implements Serializable {

private static final long serialVersionUID = 664492058736170101L;

final int index;
final StateHolder<?, ?> holder;

Expand Down
Expand Up @@ -26,6 +26,8 @@

public class TransientStateHolder<K, V> implements StateHolder<K, V>, Serializable {

private static final long serialVersionUID = -6350493651462112289L;

private final ConcurrentMap<K, V> map = new ConcurrentHashMap<>();

@Override
Expand Down
4 changes: 0 additions & 4 deletions management/build.gradle
Expand Up @@ -40,7 +40,3 @@ test {
jvmArgs += ['--add-modules', 'java.xml.bind']
}
}

compileTestJava {
options.compilerArgs += ['-Xlint:-rawtypes']
}

0 comments on commit 0d53e2d

Please sign in to comment.