英文:
Setter only does assignment, yet declares that it throws a ParseException; in Hibernate
问题
发现一个只执行典型赋值操作的Date
设置器,但却有一个似乎没有充分理由的throws ParseException
。在设置器的主体中没有进行Date
构造。只有赋值操作。
这是在一个Hibernate实体上。设置器字段被注解为@Column,可为空,可插入和可更新。不确定这是否重要。
这明显有问题,应该通过移除throws
来修复,还是在决定移除之前需要进行更多的研究?
英文:
Discovered a Date
setter that only does the typical assignment, yet has a throws ParseException
for what seems like no good reason. No Date
construction is happening in the body of the setter. Just assignment.
This is on a Hibernate entity. The setters field is annotated with @Column as nullable, insertable, and updateable. Not sure if that matters.
Is this obviously wrong and should be fixed by removing the throws
or is there more research to do before deciding to remove this?
答案1
得分: 1
根据你的描述,移除throws声明似乎是完全安全的。猜测可能是setter最初接受一个String
并对其进行解析。如果你有源代码控制,可以查看历史记录以确认这一点。
英文:
From your description it sounds perfectly safe to remove the throws declaration. A guess would be that the setter originally took a String
and parsed it. If you have source control, a check in the history might confirm this.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论