Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish diamond operator usage #3620

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
* @author Donghun Shin
* @author Greg Turnquist
* @author Aref Behboodi
* @author Ngoc Nhan
*/
@Transactional(readOnly = true)
public class EnversRevisionRepositoryImpl<T, ID, N extends Number & Comparable<N>>
Expand Down Expand Up @@ -116,7 +117,7 @@ public Optional<Revision<N, T>> findRevision(ID id, N revisionNumber) {
Assert.notNull(id, "Identifier must not be null!");
Assert.notNull(revisionNumber, "Revision number must not be null!");

List<Object[]> singleResult = (List<Object[]>) createBaseQuery(id) //
List<Object[]> singleResult = createBaseQuery(id) //
.add(AuditEntity.revisionNumber().eq(revisionNumber)) //
.getResultList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* @author Thomas Darimont
* @author Mark Paluch
* @author Greg Turnquist
* @author Ngoc Nhan
* @param <PK> the type of the identifier.
*/
@MappedSuperclass
Expand Down Expand Up @@ -89,7 +90,7 @@ public boolean equals(Object obj) {

AbstractPersistable<?> that = (AbstractPersistable<?>) obj;

return null == this.getId() ? false : this.getId().equals(that.getId());
return this.getId() != null && this.getId().equals(that.getId());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* @author Christoph Strobl
* @author David Madden
* @author Jens Schauder
* @author Ngoc Nhan
*/
public class JpaSort extends Sort {

Expand Down Expand Up @@ -281,14 +282,14 @@ public <A extends Attribute<S, U>, U> Path<S, U> dot(A attribute) {
* @return
*/
public <P extends PluralAttribute<S, ?, U>, U> Path<S, U> dot(P attribute) {
return new Path<S, U>(add(attribute));
return new Path<>(add(attribute));
}

private List<Attribute<?, ?>> add(Attribute<?, ?> attribute) {

Assert.notNull(attribute, "Attribute must not be null");

List<Attribute<?, ?>> newAttributes = new ArrayList<Attribute<?, ?>>(attributes.size() + 1);
List<Attribute<?, ?>> newAttributes = new ArrayList<>(attributes.size() + 1);
newAttributes.addAll(attributes);
newAttributes.add(attribute);
return newAttributes;
Expand Down