Skip to content

Commit

Permalink
GH-2189 fix java 7 diamond use (#2244)
Browse files Browse the repository at this point in the history
Signed-off-by: Håvard Ottestad <hmottestad@gmail.com>
  • Loading branch information
hmottestad committed May 19, 2020
1 parent b5331be commit 2e06aa3
Show file tree
Hide file tree
Showing 45 changed files with 78 additions and 78 deletions.
Expand Up @@ -100,7 +100,7 @@ public SPARQLServiceEvaluationTest() {
@Before
public void setUp() throws Exception {
// set up the server: the maximal number of endpoints must be known
List<String> repositoryIds = new ArrayList<String>(MAX_ENDPOINTS);
List<String> repositoryIds = new ArrayList<>(MAX_ENDPOINTS);
for (int i = 1; i <= MAX_ENDPOINTS; i++) {
repositoryIds.add("endpoint" + i);
}
Expand All @@ -113,7 +113,7 @@ public void setUp() throws Exception {
throw e;
}

remoteRepositories = new ArrayList<HTTPRepository>(MAX_ENDPOINTS);
remoteRepositories = new ArrayList<>(MAX_ENDPOINTS);
for (int i = 1; i <= MAX_ENDPOINTS; i++) {
HTTPRepository r = new HTTPRepository(getRepositoryUrl(i));
r.initialize();
Expand Down Expand Up @@ -558,7 +558,7 @@ private Set<Statement> readExpectedGraphQueryResult(String resultFile) throws Ex
parser.setPreserveBNodeIDs(true);
parser.setValueFactory(SimpleValueFactory.getInstance());

Set<Statement> result = new LinkedHashSet<Statement>();
Set<Statement> result = new LinkedHashSet<>();
parser.setRDFHandler(new StatementCollector(result));

InputStream in = SPARQLServiceEvaluationTest.class.getResourceAsStream(resultFile);
Expand Down Expand Up @@ -625,10 +625,10 @@ private void compareTupleQueryResults(TupleQueryResult queryResult, TupleQueryRe

List<BindingSet> expectedBindings = Iterations.asList(expectedResultTable);

List<BindingSet> missingBindings = new ArrayList<BindingSet>(expectedBindings);
List<BindingSet> missingBindings = new ArrayList<>(expectedBindings);
missingBindings.removeAll(queryBindings);

List<BindingSet> unexpectedBindings = new ArrayList<BindingSet>(queryBindings);
List<BindingSet> unexpectedBindings = new ArrayList<>(queryBindings);
unexpectedBindings.removeAll(expectedBindings);

StringBuilder message = new StringBuilder(128);
Expand Down
Expand Up @@ -22,7 +22,7 @@
@Deprecated
public class BackgroundGraphResult extends org.eclipse.rdf4j.query.impl.BackgroundGraphResult {
public BackgroundGraphResult(RDFParser parser, InputStream in, Charset charset, String baseURI) {
this(new QueueCursor<Statement>(10), parser, in, charset, baseURI);
this(new QueueCursor<>(10), parser, in, charset, baseURI);
}

public BackgroundGraphResult(QueueCursor<Statement> queue, RDFParser parser, InputStream in, Charset charset,
Expand Down
Expand Up @@ -21,7 +21,7 @@
@Deprecated
public class BackgroundTupleResult extends org.eclipse.rdf4j.query.resultio.helpers.BackgroundTupleResult {
public BackgroundTupleResult(TupleQueryResultParser parser, InputStream in) {
this(new QueueCursor<BindingSet>(10), parser, in);
this(new QueueCursor<>(10), parser, in);
}

public BackgroundTupleResult(QueueCursor<BindingSet> queue, TupleQueryResultParser parser, InputStream in) {
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
public class ErrorType {

private static final Map<String, ErrorType> registry = new HashMap<String, ErrorType>();
private static final Map<String, ErrorType> registry = new HashMap<>();

public static final ErrorType MALFORMED_QUERY = register("MALFORMED QUERY");

Expand Down
Expand Up @@ -27,14 +27,14 @@ public class URIUtil {
* URI component would conflict with the reserved purpose, then the conflicting data must be escaped before forming
* the URI. http://www.isi.edu/in-notes/rfc2396.txt section 2.2.
*/
private static final Set<Character> reserved = new HashSet<Character>(
private static final Set<Character> reserved = new HashSet<>(
Arrays.asList(new Character[] { ';', '/', '?', ':', '@', '&', '=', '+', '$', ',' }));

/**
* Punctuation mark characters, which are part of the set of unreserved chars and therefore allowed to occur in
* unescaped form. See http://www.isi.edu/in-notes/rfc2396.txt
*/
private static final Set<Character> mark = new HashSet<Character>(
private static final Set<Character> mark = new HashSet<>(
Arrays.asList(new Character[] { '-', '_', '.', '!', '~', '*', '\'', '(', ')' }));

/**
Expand Down
Expand Up @@ -53,7 +53,7 @@ public class QueryLanguage {
/**
* List of known query languages.
*/
private static List<QueryLanguage> QUERY_LANGUAGES = new ArrayList<QueryLanguage>(4);
private static List<QueryLanguage> QUERY_LANGUAGES = new ArrayList<>(4);

/*--------------------*
* Static initializer *
Expand Down
Expand Up @@ -22,7 +22,7 @@ public interface QueryResult<T> extends CloseableIteration<T, QueryEvaluationExc

@Override
default Iterator<T> iterator() {
return new CloseableIterationIterator<T>(this);
return new CloseableIterationIterator<>(this);
}

}
Expand Up @@ -48,7 +48,7 @@ public class BackgroundGraphResult extends IterationWrapper<Statement, QueryEval
private final QueueCursor<Statement> queue;

public BackgroundGraphResult(RDFParser parser, InputStream in, Charset charset, String baseURI) {
this(new QueueCursor<Statement>(10), parser, in, charset, baseURI);
this(new QueueCursor<>(10), parser, in, charset, baseURI);
}

public BackgroundGraphResult(QueueCursor<Statement> queue, RDFParser parser, InputStream in, Charset charset,
Expand Down
Expand Up @@ -23,7 +23,7 @@ public class QueryContext {

private static final String QUERY_PREPARER_ATTRIBUTE = QueryPreparer.class.getName();

private static final ThreadLocal<QueryContext> queryContext = new ThreadLocal<QueryContext>();
private static final ThreadLocal<QueryContext> queryContext = new ThreadLocal<>();

public static QueryContext getQueryContext() {
return queryContext.get();
Expand Down
Expand Up @@ -59,7 +59,7 @@ public static Object[] params() {
public boolean bRDFStarData;

// the triples over which the evaluations is carried
private ArrayList<Triple> triples = new ArrayList<Triple>();
private ArrayList<Triple> triples = new ArrayList<>();

ValueFactory vf = SimpleValueFactory.getInstance();

Expand Down Expand Up @@ -225,11 +225,11 @@ public void testMatchAllUnbound() {
// case check all unbound
try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode,
new EmptyBindingSet())) {
ArrayList<BindingSet> expected = new ArrayList<BindingSet>();
ArrayList<BindingSet> expected = new ArrayList<>();
triples.forEach(t -> {
expected.add(fromTriple(t));
});
ArrayList<BindingSet> received = new ArrayList<BindingSet>();
ArrayList<BindingSet> received = new ArrayList<>();
while (iter.hasNext()) {
received.add(iter.next());
}
Expand All @@ -242,13 +242,13 @@ public void testMatchAllUnbound() {
public void testSubjVarBound() {
try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode,
createWithVarValue(tripleRefNode.getSubjectVar(), vf.createIRI("urn:a")))) {
ArrayList<BindingSet> expected = new ArrayList<BindingSet>();
ArrayList<BindingSet> expected = new ArrayList<>();
triples.forEach(t -> {
if (t.getSubject().equals(vf.createIRI("urn:a"))) {
expected.add(fromTriple(t));
}
});
ArrayList<BindingSet> received = new ArrayList<BindingSet>();
ArrayList<BindingSet> received = new ArrayList<>();
while (iter.hasNext()) {
received.add(iter.next());
}
Expand All @@ -262,13 +262,13 @@ public void testPredVarBound() {
try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode,
createWithVarValue(tripleRefNode.getPredicateVar(), vf.createIRI("urn:p")))) {

ArrayList<BindingSet> expected = new ArrayList<BindingSet>();
ArrayList<BindingSet> expected = new ArrayList<>();
triples.forEach(t -> {
if (t.getPredicate().equals(vf.createIRI("urn:p"))) {
expected.add(fromTriple(t));
}
});
ArrayList<BindingSet> received = new ArrayList<BindingSet>();
ArrayList<BindingSet> received = new ArrayList<>();
while (iter.hasNext()) {
received.add(iter.next());
}
Expand All @@ -282,13 +282,13 @@ public void testObjVarBound() {
try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode,
createWithVarValue(tripleRefNode.getObjectVar(), vf.createIRI("urn:b")))) {

ArrayList<BindingSet> expected = new ArrayList<BindingSet>();
ArrayList<BindingSet> expected = new ArrayList<>();
triples.forEach(t -> {
if (t.getObject().equals(vf.createIRI("urn:b"))) {
expected.add(fromTriple(t));
}
});
ArrayList<BindingSet> received = new ArrayList<BindingSet>();
ArrayList<BindingSet> received = new ArrayList<>();
while (iter.hasNext()) {
received.add(iter.next());
}
Expand All @@ -304,13 +304,13 @@ public void testSubjAndObjVarBound() {

try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode, set)) {

ArrayList<BindingSet> expected = new ArrayList<BindingSet>();
ArrayList<BindingSet> expected = new ArrayList<>();
triples.forEach(t -> {
if (t.getObject().equals(vf.createIRI("urn:c")) && t.getSubject().equals(vf.createIRI("urn:a:2"))) {
expected.add(fromTriple(t));
}
});
ArrayList<BindingSet> received = new ArrayList<BindingSet>();
ArrayList<BindingSet> received = new ArrayList<>();
while (iter.hasNext()) {
received.add(iter.next());
}
Expand All @@ -326,9 +326,9 @@ public void testExtVarBound() {

try (CloseableIteration<BindingSet, QueryEvaluationException> iter = strategy.evaluate(tripleRefNode, set)) {

ArrayList<BindingSet> expected = new ArrayList<BindingSet>();
ArrayList<BindingSet> expected = new ArrayList<>();
expected.add(fromTriple(triple));
ArrayList<BindingSet> received = new ArrayList<BindingSet>();
ArrayList<BindingSet> received = new ArrayList<>();
while (iter.hasNext()) {
received.add(iter.next());
}
Expand Down
Expand Up @@ -25,7 +25,7 @@ public static Map<String, Object> process(QueryModelNode node) {
return collector.getTripleRefs();
}

private Map<String, Object> tripleRefs = new HashMap<String, Object>();
private Map<String, Object> tripleRefs = new HashMap<>();

public Map<String, Object> getTripleRefs() {
return tripleRefs;
Expand Down
Expand Up @@ -17,8 +17,8 @@ public class JJTSyntaxTreeBuilderState {
private boolean node_created;

public JJTSyntaxTreeBuilderState() {
nodes = new java.util.ArrayList<Node>();
marks = new java.util.ArrayList<Integer>();
nodes = new java.util.ArrayList<>();
marks = new java.util.ArrayList<>();
sp = 0;
mk = 0;
}
Expand Down
Expand Up @@ -11084,7 +11084,7 @@ private int jj_ntk() {
}
}

private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
private java.util.List<int[]> jj_expentries = new java.util.ArrayList<>();
private int[] jj_expentry;
private int jj_kind = -1;
private int[] jj_lasttokens = new int[100];
Expand Down
Expand Up @@ -255,7 +255,7 @@ public void testUseInBindWithVars() throws Exception {
assertTrue("expect projection", q.getTupleExpr() instanceof Projection);
Projection proj = (Projection) q.getTupleExpr();
List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listNames = new ArrayList<String>();
final ArrayList<String> listNames = new ArrayList<>();
list.forEach(el -> {
listNames.add(el.getTargetName());
});
Expand Down Expand Up @@ -323,7 +323,7 @@ public void testUseInStatementPatternWithVars() throws Exception {
assertTrue("expect projection", q.getTupleExpr() instanceof Projection);
Projection proj = (Projection) q.getTupleExpr();
List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listNames = new ArrayList<String>();
final ArrayList<String> listNames = new ArrayList<>();
list.forEach(el -> {
listNames.add(el.getTargetName());
});
Expand Down Expand Up @@ -390,7 +390,7 @@ public void testUseNestedInStatementPatternWithVars() throws Exception {
assertTrue("expect projection", q.getTupleExpr() instanceof Projection);
Projection proj = (Projection) q.getTupleExpr();
List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listNames = new ArrayList<String>();
final ArrayList<String> listNames = new ArrayList<>();
list.forEach(el -> {
listNames.add(el.getTargetName());
});
Expand Down Expand Up @@ -467,7 +467,7 @@ public void testUseInConstructFromStatementPattern() throws Exception {
Projection proj = (Projection) ((Reduced) q.getTupleExpr()).getArg();

List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listTargetNames = new ArrayList<String>();
final ArrayList<String> listTargetNames = new ArrayList<>();
list.forEach(el -> {
listTargetNames.add(el.getTargetName());
});
Expand All @@ -476,7 +476,7 @@ public void testUseInConstructFromStatementPattern() throws Exception {
assertTrue("expect target predicate", listTargetNames.contains("predicate"));
assertTrue("expect target oobject", listTargetNames.contains("object"));

final ArrayList<String> listSourceNames = new ArrayList<String>();
final ArrayList<String> listSourceNames = new ArrayList<>();
list.forEach(el -> {
listSourceNames.add(el.getSourceName());
});
Expand Down Expand Up @@ -689,7 +689,7 @@ public void testUseInGroupByFromBindWithVars() throws Exception {
assertTrue("expect projection", q.getTupleExpr() instanceof Projection);
Projection proj = (Projection) q.getTupleExpr();
List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listNames = new ArrayList<String>();
final ArrayList<String> listNames = new ArrayList<>();
list.forEach(el -> {
listNames.add(el.getTargetName());
});
Expand Down Expand Up @@ -774,7 +774,7 @@ public void testUseInExists() throws Exception {
assertTrue("expect projection", q.getTupleExpr() instanceof Projection);
Projection proj = (Projection) q.getTupleExpr();
List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listNames = new ArrayList<String>();
final ArrayList<String> listNames = new ArrayList<>();
list.forEach(el -> {
listNames.add(el.getTargetName());
});
Expand Down Expand Up @@ -837,7 +837,7 @@ public void testUseInSTR() throws Exception {
assertTrue("expect projection", q.getTupleExpr() instanceof Projection);
Projection proj = (Projection) q.getTupleExpr();
List<ProjectionElem> list = proj.getProjectionElemList().getElements();
final ArrayList<String> listNames = new ArrayList<String>();
final ArrayList<String> listNames = new ArrayList<>();
list.forEach(el -> {
listNames.add(el.getTargetName());
});
Expand Down
Expand Up @@ -23,7 +23,7 @@ public class BasicQueryWriterSettings {
* <p>
* Defaults to false.
*/
public final static RioSetting<Boolean> ADD_SESAME_QNAME = new RioSettingImpl<Boolean>(
public final static RioSetting<Boolean> ADD_SESAME_QNAME = new RioSettingImpl<>(
"org.eclipse.rdf4j.query.resultio.addsesameqname", "Add Sesame QName", false);

/**
Expand All @@ -32,7 +32,7 @@ public class BasicQueryWriterSettings {
* <p>
* Defaults to "sesamecallback".
*/
public static final RioSetting<String> JSONP_CALLBACK = new RioSettingImpl<String>(
public static final RioSetting<String> JSONP_CALLBACK = new RioSettingImpl<>(
"org.eclipse.rdf4j.query.resultio.jsonpcallback", "JSONP callback function", "sesamecallback");

/**
Expand Down
Expand Up @@ -42,7 +42,7 @@ public class BackgroundTupleResult extends IteratingTupleQueryResult implements
private final CountDownLatch finishedParsing = new CountDownLatch(1);

public BackgroundTupleResult(TupleQueryResultParser parser, InputStream in) {
this(new QueueCursor<BindingSet>(10), parser, in);
this(new QueueCursor<>(10), parser, in);
}

public BackgroundTupleResult(QueueCursor<BindingSet> queue, TupleQueryResultParser parser, InputStream in) {
Expand Down
Expand Up @@ -129,7 +129,7 @@ public <C extends Collection<T>> C addTo(C collection) throws RepositoryExceptio

@Override
public Iterator<T> iterator() {
return new CloseableIterationIterator<T>(this);
return new CloseableIterationIterator<>(this);
}

}
Expand Up @@ -28,7 +28,7 @@ public class HTTPRepositorySettings {
* By default inner buffers within {@link org.eclipse.rdf4j.repository.http.HTTPRepositoryConnection} keep in memory
* up to 200000 statement before they are flushed to the remote repository.
*/
public static final RioSetting<Integer> MAX_STATEMENT_BUFFER_SIZE = new RioSettingImpl<Integer>(
public static final RioSetting<Integer> MAX_STATEMENT_BUFFER_SIZE = new RioSettingImpl<>(
"org.eclipse.rdf4j.http.maxstatementbuffersize", "Maximum number of statement buffered in memory", 200000);

}
Expand Up @@ -78,7 +78,7 @@ public abstract class RepositoryManager implements RepositoryResolver, HttpClien
* Creates a new RepositoryManager.
*/
protected RepositoryManager() {
this(new HashMap<String, Repository>());
this(new HashMap<>());
}

/**
Expand Down
Expand Up @@ -59,7 +59,7 @@ public synchronized void shutDown() {
}
}

static final Map<String, SynchronizedManager> managers = new HashMap<String, SynchronizedManager>();
static final Map<String, SynchronizedManager> managers = new HashMap<>();

static {
Runtime.getRuntime().addShutdownHook(new Thread("RepositoryProvider-shutdownHook") {
Expand Down

0 comments on commit 2e06aa3

Please sign in to comment.