Skip to content

Commit

Permalink
➖ removing the checker framework as it was not activated anyway, and …
Browse files Browse the repository at this point in the history
…if activated it failed compilation without any debug information

Signed-off-by: dseurotech <[email protected]>
  • Loading branch information
dseurotech committed May 10, 2024
1 parent ed2c136 commit 1041d8a
Show file tree
Hide file tree
Showing 5 changed files with 332 additions and 287 deletions.
4 changes: 0 additions & 4 deletions commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import javax.persistence.metamodel.EntityType;

import org.apache.commons.lang.ArrayUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.eclipse.kapua.KapuaEntityExistsException;
import org.eclipse.kapua.KapuaEntityNotFoundException;
import org.eclipse.kapua.KapuaErrorCodes;
Expand Down Expand Up @@ -355,11 +354,11 @@ protected E doDelete(EntityManager em, E entityToDelete) {
* @throws KapuaException
* If any problem occurs.
*/
private <E> Predicate handleKapuaQueryPredicates(@NonNull QueryPredicate queryPredicate,
@NonNull Map<ParameterExpression, Object> binds,
@NonNull CriteriaBuilder cb,
@NonNull Root<E> userPermissionRoot,
@NonNull EntityType<E> entityType)
private <E> Predicate handleKapuaQueryPredicates(QueryPredicate queryPredicate,
Map<ParameterExpression, Object> binds,
CriteriaBuilder cb,
Root<E> userPermissionRoot,
EntityType<E> entityType)
throws KapuaException {
Predicate predicate = null;
if (queryPredicate instanceof AttributePredicate) {
Expand All @@ -382,11 +381,11 @@ private <E> Predicate handleKapuaQueryPredicates(@NonNull QueryPredicate queryPr
return predicate;
}

private <E> Predicate handleAndPredicate(@NonNull AndPredicate andPredicate,
@NonNull Map<ParameterExpression, Object> binds,
@NonNull CriteriaBuilder cb,
@NonNull Root<E> entityRoot,
@NonNull EntityType<E> entityType)
private <E> Predicate handleAndPredicate(AndPredicate andPredicate,
Map<ParameterExpression, Object> binds,
CriteriaBuilder cb,
Root<E> entityRoot,
EntityType<E> entityType)
throws KapuaException {

Predicate[] jpaAndPredicates =
Expand All @@ -401,11 +400,11 @@ private <E> Predicate handleAndPredicate(@NonNull AndPredicate andPredicate,

}

private <E> Predicate handleOrPredicate(@NonNull OrPredicate orPredicate,
@NonNull Map<ParameterExpression, Object> binds,
@NonNull CriteriaBuilder cb,
@NonNull Root<E> entityRoot,
@NonNull EntityType<E> entityType)
private <E> Predicate handleOrPredicate(OrPredicate orPredicate,
Map<ParameterExpression, Object> binds,
CriteriaBuilder cb,
Root<E> entityRoot,
EntityType<E> entityType)
throws KapuaException {

Predicate[] jpaOrPredicates =
Expand All @@ -419,11 +418,11 @@ private <E> Predicate handleOrPredicate(@NonNull OrPredicate orPredicate,
return cb.or(jpaOrPredicates);
}

private <E> Predicate[] handlePredicate(@NonNull List<QueryPredicate> orPredicates,
@NonNull Map<ParameterExpression, Object> binds,
@NonNull CriteriaBuilder cb,
@NonNull Root<E> entityRoot,
@NonNull EntityType<E> entityType) throws KapuaException {
private <E> Predicate[] handlePredicate(List<QueryPredicate> orPredicates,
Map<ParameterExpression, Object> binds,
CriteriaBuilder cb,
Root<E> entityRoot,
EntityType<E> entityType) throws KapuaException {
Predicate[] jpaOrPredicates = new Predicate[orPredicates.size()];

for (int i = 0; i < orPredicates.size(); i++) {
Expand All @@ -433,11 +432,11 @@ private <E> Predicate[] handlePredicate(@NonNull List<QueryPredicate> orPredicat
return jpaOrPredicates;
}

private <E> Predicate handleAttributePredicate(@NonNull AttributePredicate<?> attrPred,
@NonNull Map<ParameterExpression, Object> binds,
@NonNull CriteriaBuilder cb,
@NonNull Root<E> entityRoot,
@NonNull EntityType<E> entityType)
private <E> Predicate handleAttributePredicate(AttributePredicate<?> attrPred,
Map<ParameterExpression, Object> binds,
CriteriaBuilder cb,
Root<E> entityRoot,
EntityType<E> entityType)
throws KapuaException {
Predicate expr;
String attrName = attrPred.getAttributeName();
Expand Down Expand Up @@ -584,7 +583,7 @@ private <E> Predicate handleAttributePredicate(@NonNull AttributePredicate<?> at
* @return The {@link Path} expression that matches the given {@code attributeName} parameter.
* @since 1.0.0
*/
private <E, P> Path<P> extractAttribute(@NonNull Root<E> entityRoot, @NonNull String attributeName) {
private <E, P> Path<P> extractAttribute(Root<E> entityRoot, String attributeName) {
Path<P> expressionPath;
if (attributeName.contains(ATTRIBUTE_SEPARATOR)) {
String[] pathComponents = attributeName.split(ATTRIBUTE_SEPARATOR_ESCAPED);
Expand All @@ -608,7 +607,7 @@ private <E, P> Path<P> extractAttribute(@NonNull Root<E> entityRoot, @NonNull St
* @return {@code true} if it is a constraint validation error, {@code false} otherwise.
* @since 1.0.0
*/
public static boolean isInsertConstraintViolation(@NonNull PersistenceException persistenceException) {
public static boolean isInsertConstraintViolation(PersistenceException persistenceException) {
Throwable cause = persistenceException.getCause();
while (cause != null && !(cause instanceof SQLException)) {
cause = cause.getCause();
Expand All @@ -622,10 +621,10 @@ public static boolean isInsertConstraintViolation(@NonNull PersistenceException
return SQL_ERROR_CODE_CONSTRAINT_VIOLATION.equals(innerExc.getSQLState());
}

protected Optional<E> doFindByField(@NonNull TxContext txContext,
@NonNull KapuaId scopeId,
@NonNull String fieldName,
@NonNull Object fieldValue) {
protected Optional<E> doFindByField(TxContext txContext,
KapuaId scopeId,
String fieldName,
Object fieldValue) {
final List<C> result = doFindAllByField(txContext, scopeId, fieldName, fieldValue);
switch (result.size()) {
case 0:
Expand Down
Loading

0 comments on commit 1041d8a

Please sign in to comment.