Skip to content

Commit

Permalink
warn-fix: resolve warn fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Lavrukov authored and nvamelichev committed May 16, 2024
1 parent fcf6834 commit 7c9c531
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions repository/src/main/java/tech/ydb/yoj/repository/db/Entity.java
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import com.google.common.reflect.TypeToken;
import lombok.NonNull;
import org.slf4j.LoggerFactory;
import tech.ydb.yoj.DeprecationWarnings;

import javax.annotation.CheckForNull;
import java.util.List;
@@ -33,8 +33,10 @@ interface Id<E extends Entity<E>> {
@CheckForNull
@Deprecated(forRemoval = true)
default E resolve() {
LoggerFactory.getLogger(Entity.Id.class).warn("You are using Entity.Id.resolve() which will be removed in YOJ 3.0.0. Please use Table.find(ID)",
new Throwable("Entity.Id.resolve() call stack trace"));
DeprecationWarnings.warnOnce(
"Entity.Id.resolve()",
"You are using Entity.Id.resolve() which will be removed in YOJ 3.0.0. Please use Table.find(ID)"
);
return Tx.Current.get().getRepositoryTransaction().table(getType()).find(this);
}

@@ -46,9 +48,10 @@ default E resolve() {
default <EXCEPTION extends Exception> E resolve(
Supplier<? extends EXCEPTION> throwIfAbsent
) throws EXCEPTION {
LoggerFactory.getLogger(Entity.Id.class).warn("You are using Entity.Id.resolve(Supplier) which will be removed in YOJ 3.0.0. "
+ "Please use Table.find(ID, Supplier)",
new Throwable("Entity.Id.resolve(Supplier) call stack trace"));
DeprecationWarnings.warnOnce(
"Entity.Id.resolve()",
"You are using Entity.Id.resolve(Supplier) which will be removed in YOJ 3.0.0. Please use Table.find(ID, Supplier)"
);
return Tx.Current.get().getRepositoryTransaction().table(getType()).find(this, throwIfAbsent);
}

0 comments on commit 7c9c531

Please sign in to comment.