Skip to content

Commit 7c9c531

Browse files
Alexander Lavrukovnvamelichev
authored andcommitted
warn-fix: resolve warn fix
1 parent fcf6834 commit 7c9c531

File tree

1 file changed

+9
-6
lines changed
  • repository/src/main/java/tech/ydb/yoj/repository/db

1 file changed

+9
-6
lines changed

repository/src/main/java/tech/ydb/yoj/repository/db/Entity.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.google.common.reflect.TypeToken;
44
import lombok.NonNull;
5-
import org.slf4j.LoggerFactory;
5+
import tech.ydb.yoj.DeprecationWarnings;
66

77
import javax.annotation.CheckForNull;
88
import java.util.List;
@@ -33,8 +33,10 @@ interface Id<E extends Entity<E>> {
3333
@CheckForNull
3434
@Deprecated(forRemoval = true)
3535
default E resolve() {
36-
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)",
37-
new Throwable("Entity.Id.resolve() call stack trace"));
36+
DeprecationWarnings.warnOnce(
37+
"Entity.Id.resolve()",
38+
"You are using Entity.Id.resolve() which will be removed in YOJ 3.0.0. Please use Table.find(ID)"
39+
);
3840
return Tx.Current.get().getRepositoryTransaction().table(getType()).find(this);
3941
}
4042

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

0 commit comments

Comments
 (0)