grails - 编译类中的 neverHappen 变量

标签 grails groovy

我更改了 Grails 项目中的几个类并构建了一个 war 文件。然后,我将新 war 中的 .class 文件与我更改之前构建的 war 中的文件(在不同的机器上,如果这很重要)进行比较,结果发现许多(如果不是全部).class 文件是不同的。查看反编译的类,差异似乎是由于变量中的时间戳造成的,如下所示:

public static long __timeStamp__239_neverHappen1360886953029;

有人知道这个变量是什么吗?

最佳答案

它来自 groovy 类生成。

请参阅此处的一些讨论 http://groovy.329449.n5.nabble.com/Timestamp-in-class-files-leads-to-huge-patches-td365696.html

为了完整起见,此处引用:-

For Groovy's own recompilation mechanism. Sources are not always in file form, so we can't "just" check the file timestamp, so we had to store that timestamp somewhere... and where better than in the class itself since that's all we have?

On Tue, Mar 3, 2009 at 10:39, Jason Dillon <[hidden email]> wrote:

Why does groovyc capture the compile timestamp? What good is that for?

关于grails - 编译类中的 neverHappen 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15310136/

相关文章:

debugging - 如何调试已部署的 Grails 应用程序

unit-testing - Grails单元测试和模拟addTo

file - Groovy HTTPBuilder 在没有 multipart/form-data 的情况下上传文件?

java - 确定变量类型

grails - Grails 域类必须与数据库绑定(bind)吗?

hibernate - Grails GORM Rest 插件和 Hibernate

grails - 在GSP中显示图片

maven - 与geb的链接错误

使用队列和链表的 Groovy 示例应用程序

ajax - 通过 View 下拉菜单过滤 Controller 中的数据