Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Dec 12, 2018
2 parents 244a3f9 + f90d124 commit 8025a99
Show file tree
Hide file tree
Showing 42 changed files with 68 additions and 74 deletions.
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,6 @@ SOFTWARE.
to pass. In 0.17.6, some changes impact a lot of file, while in
0.18 there should be less new issues. Don't forget about the IT
test ran by maven-invoker-plugin.
@todo #837:30min Finish the upgrade to qulice 0.17.5 by reviewing
all diamond usage: it was required until now to explicit the
type in generics but it is not needed anymore. For example in
BkTimetable line 65, new ConcurrentHashMap<Thread, Long>(1)
should be new ConcurrentHashMap<>(1). There are around 70
cases like that.
-->
<version>${qulice.version}</version>
<configuration>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/PsAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final Opt<Identity> enter(final Request request) throws IOException {
if (this.allMatch(request)) {
result = this.all.get(this.index).enter(request);
} else {
result = new Opt.Empty<Identity>();
result = new Opt.Empty<>();
}
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/PsBasic.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public Fake(final boolean cond) {
public Opt<Identity> enter(final String usr, final String pwd) {
final Opt<Identity> user;
if (this.condition) {
user = new Opt.Single<Identity>(
user = new Opt.Single<>(
new Identity.Simple(
String.format("urn:basic:%s", usr)
)
Expand Down Expand Up @@ -229,7 +229,7 @@ public Opt<Identity> enter(final String user, final String pwd) {
final Opt<Identity> identity;
if (urn.has()) {
try {
identity = new Opt.Single<Identity>(
identity = new Opt.Single<>(
new Identity.Simple(
URLDecoder.decode(
urn.get(), PsBasic.Default.ENCODING
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/PsCookie.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public Opt<Identity> enter(final Request req) throws IOException {
.cookie(this.cookie).iterator();
Opt<Identity> user = new Opt.Empty<>();
if (cookies.hasNext()) {
user = new Opt.Single<Identity>(
user = new Opt.Single<>(
this.codec.decode(
new Utf8String(cookies.next()).bytes()
)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/PsEmpty.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class PsEmpty implements Pass {

@Override
public Opt<Identity> enter(final Request request) {
return new Opt.Empty<Identity>();
return new Opt.Empty<>();
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/auth/PsFake.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public PsFake(final boolean cond) {
public Opt<Identity> enter(final Request request) {
final Opt<Identity> user;
if (this.condition) {
user = new Opt.Single<Identity>(
user = new Opt.Single<>(
new Identity.Simple("urn:test:1")
);
} else {
user = new Opt.Empty<Identity>();
user = new Opt.Empty<>();
}
return user;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/PsFixed.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public PsFixed(final Identity identity) {

@Override
public Opt<Identity> enter(final Request request) {
return new Opt.Single<Identity>(this.user);
return new Opt.Single<>(this.user);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/PsLogout.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class PsLogout implements Pass {

@Override
public Opt<Identity> enter(final Request request) {
return new Opt.Single<Identity>(Identity.ANONYMOUS);
return new Opt.Single<>(Identity.ANONYMOUS);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/PsToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public Opt<Identity> enter(final Request req) throws IOException {
new String(Base64.getDecoder().decode(jwtpayload))
)
)) {
user = new Opt.Single<Identity>(
user = new Opt.Single<>(
new Identity.Simple(
rdr.readObject().getString(Token.Jwt.SUBJECT)
)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/social/PsFacebook.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public Opt<Identity> enter(final Request trequest)
.path(PsFacebook.PICTURE)
.toString()
);
return new Opt.Single<Identity>(
return new Opt.Single<>(
new Identity.Simple(
String.format("urn:facebook:%s", user.getId()),
props
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/social/PsGithub.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public Opt<Identity> enter(final Request request)
"code is not provided by Github"
);
}
return new Opt.Single<Identity>(
return new Opt.Single<>(
this.fetch(this.token(href.toString(), code.next()))
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/social/PsGoogle.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public Opt<Identity> enter(final Request request)
"code is not provided by Google, probably some mistake"
);
}
return new Opt.Single<Identity>(this.fetch(this.token(code.next())));
return new Opt.Single<>(this.fetch(this.token(code.next())));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/social/PsLinkedin.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public Opt<Identity> enter(final Request request)
"code is not provided by LinkedIn"
);
}
return new Opt.Single<Identity>(
return new Opt.Single<>(
this.fetch(this.token(href.toString(), code.next()))
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/auth/social/PsTwitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public PsTwitter(final String name, final String keys) {
@Override
public Opt<Identity> enter(final Request request)
throws IOException {
return new Opt.Single<Identity>(this.identity(this.fetch()));
return new Opt.Single<>(this.identity(this.fetch()));
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/cookies/RqCookies.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Iterable<String> cookie(final CharSequence key)
);
final Iterable<String> iter;
if (value == null) {
iter = new VerboseIterable<String>(
iter = new VerboseIterable<>(
Collections.<String>emptyList(),
new Sprintf(
// @checkstyle LineLengthCheck (1 line)
Expand All @@ -91,7 +91,7 @@ public Iterable<String> cookie(final CharSequence key)
)
);
} else {
iter = new VerboseIterable<String>(
iter = new VerboseIterable<>(
Collections.singleton(value),
new Sprintf(
"There is always only one Cookie by name \"%s\"",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/fallback/FbEmpty.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public FbEmpty() {
new Fallback() {
@Override
public Opt<Response> route(final RqFallback req) {
return new Opt.Empty<Response>();
return new Opt.Empty<>();
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/fallback/FbFixed.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public FbFixed(final Take take) {
@Override
public Opt<Response> route(final RqFallback req)
throws IOException {
return new Opt.Single<Response>(take.act(req));
return new Opt.Single<>(take.act(req));
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/fallback/FbLog4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public FbLog4j() {
public Opt<Response> route(final RqFallback req)
throws IOException {
FbLog4j.log(req);
return new Opt.Empty<Response>();
return new Opt.Empty<>();
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/facets/fallback/FbSlf4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public FbSlf4j() {
public Opt<Response> route(final RqFallback req)
throws IOException {
FbSlf4j.log(req);
return new Opt.Empty<Response>();
return new Opt.Empty<>();
}
}
);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/takes/facets/fallback/FbStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public FbStatus(final Iterable<Integer> check) {
public Opt<Response> route(final RqFallback req)
throws IOException {
final Response res = new RsWithStatus(req.code());
return new Opt.Single<Response>(
return new Opt.Single<>(
new RsWithType(
new RsWithBody(
res,
Expand Down Expand Up @@ -127,7 +127,7 @@ public Opt<Response> route(final RqFallback req)
*/
public FbStatus(final int code, final Fallback fallback) {
this(
new Filtered<Integer>(
new Filtered<>(
(status) -> code == status.intValue(), code
),
fallback
Expand All @@ -141,7 +141,7 @@ public FbStatus(final int code, final Fallback fallback) {
*/
public FbStatus(final int code, final Scalar<Fallback> fallback) {
this(
new Filtered<Integer>(
new Filtered<>(
(status) -> code == status.intValue(), code
),
fallback
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public FkContentType(final String atype, final Take take) {
public Opt<Response> route(final Request req) throws IOException {
final Opt<Response> resp;
if (FkContentType.getType(req).contains(this.type)) {
resp = new Opt.Single<Response>(this.take.act(req));
resp = new Opt.Single<>(this.take.act(req));
} else {
resp = new Opt.Empty<Response>();
resp = new Opt.Empty<>();
}
return resp;
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/takes/facets/fork/FkEncoding.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public Opt<Response> route(final Request req) throws IOException {
new RqHeaders.Base(req).header("Accept-Encoding").iterator();
final Opt<Response> resp;
if (this.encoding.isEmpty()) {
resp = new Opt.Single<Response>(this.origin);
resp = new Opt.Single<>(this.origin);
} else if (headers.hasNext()) {
final Collection<String> items = Arrays.asList(
FkEncoding.ENCODING_SEP.split(
Expand All @@ -98,12 +98,12 @@ public Opt<Response> route(final Request req) throws IOException {
)
);
if (items.contains(this.encoding)) {
resp = new Opt.Single<Response>(this.origin);
resp = new Opt.Single<>(this.origin);
} else {
resp = new Opt.Empty<Response>();
resp = new Opt.Empty<>();
}
} else {
resp = new Opt.Empty<Response>();
resp = new Opt.Empty<>();
}
return resp;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkHitRefresh.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ public Opt<Response> route(final Request req) throws IOException {
this.exec.run();
this.handle.touch();
}
resp = new Opt.Single<Response>(this.take.act(req));
resp = new Opt.Single<>(this.take.act(req));
} else {
resp = new Opt.Empty<Response>();
resp = new Opt.Empty<>();
}
return resp;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ public Opt<Response> route(final Request req) throws IOException {
final String mtd = new RqMethod.Base(req).method();
final Opt<Response> resp;
if (this.methods.contains(mtd)) {
resp = new Opt.Single<Response>(this.take.act(req));
resp = new Opt.Single<>(this.take.act(req));
} else {
resp = new Opt.Empty<Response>();
resp = new Opt.Empty<>();
}
return resp;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public Opt<Response> route(final Request req) throws IOException {
final Opt<Response> resp;
if (params.hasNext()
&& this.pattern.matcher(params.next()).matches()) {
resp = new Opt.Single<Response>(this.take.act(req));
resp = new Opt.Single<>(this.take.act(req));
} else {
resp = new Opt.Empty<Response>();
resp = new Opt.Empty<>();
}
return resp;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/takes/facets/fork/FkTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public final class FkTypes implements Fork {
* @param resp Response to return
*/
public FkTypes(final String list, final Response resp) {
this(list, new Opt.Single<>(resp), new Opt.Empty<Take>());
this(list, new Opt.Single<>(resp), new Opt.Empty<>());
}

/**
Expand All @@ -72,7 +72,7 @@ public FkTypes(final String list, final Response resp) {
* @param tke The take to use to build the response to return
*/
public FkTypes(final String list, final Take tke) {
this(list, new Opt.Empty<Response>(), new Opt.Single<>(tke));
this(list, new Opt.Empty<>(), new Opt.Single<>(tke));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/http/BkTimeable.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public final class BkTimeable extends Thread implements Back {
*/
public BkTimeable(final Back back, final long msec) {
super();
this.threads = new ConcurrentHashMap<Thread, Long>(1);
this.threads = new ConcurrentHashMap<>(1);
this.back = back;
this.latency = msec;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/misc/Concat.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public String toString() {

@Override
public Iterator<T> iterator() {
return new Concat.ConcatIterator<T>(
return new Concat.ConcatIterator<>(
this.left.iterator(),
this.right.iterator()
);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/takes/misc/Href.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ public Iterable<String> param(final Object key) {
final List<String> values = this.params.get(key.toString());
final Iterable<String> iter;
if (values == null) {
iter = new VerboseIterable<String>(
iter = new VerboseIterable<>(
Collections.<String>emptyList(),
String.format(
"there are no URI params by name \"%s\" among %d others",
key, this.params.size()
)
);
} else {
iter = new VerboseIterable<String>(
iter = new VerboseIterable<>(
values,
String.format(
"there are only %d URI params by name \"%s\"",
Expand Down Expand Up @@ -233,7 +233,7 @@ public Href path(final Object suffix) {
public Href with(final Object key, final Object value) {
final SortedMap<String, List<String>> map = new TreeMap<>(this.params);
if (!map.containsKey(key.toString())) {
map.put(key.toString(), new LinkedList<String>());
map.put(key.toString(), new LinkedList<>());
}
map.get(key.toString()).add(value.toString());
return new Href(this.uri, map, this.fragment);
Expand Down Expand Up @@ -331,7 +331,7 @@ private static SortedMap<String, List<String>> asMap(final String query) {
value = "";
}
if (!params.containsKey(key)) {
params.put(key, new LinkedList<String>());
params.put(key, new LinkedList<>());
}
params.get(key).add(value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/misc/Transform.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public final String toString() {

@Override
public final Iterator<K> iterator() {
return new TransformIterator<T, K>(this.list.iterator(), this.action);
return new TransformIterator<>(this.list.iterator(), this.action);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/takes/misc/VerboseIterable.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ public VerboseIterable(final Iterable<T> iter, final CharSequence msg) {

@Override
public Iterator<T> iterator() {
return new VerboseIterator<T>(this.origin.iterator(), this.error);
return new VerboseIterator<>(this.origin.iterator(), this.error);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/takes/misc/VerboseList.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public boolean contains(final Object obj) {

@Override
public Iterator<T> iterator() {
return new VerboseIterator<T>(this.origin.iterator(), this.message);
return new VerboseIterator<>(this.origin.iterator(), this.message);
}

@Override
Expand Down
Loading

1 comment on commit 8025a99

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on 8025a99 Dec 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 837-e35739d6 disappeared from pom.xml, that's why I closed #881. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.