GWT 中的 PropertyChangeSupport

发布于 2024-10-16 17:41:47 字数 1547 浏览 2 评论 0原文

在我的 gwt 应用程序中,有人开发了一个使用 java.beans.PropertyChangeSupport 的模块。最近,我开始使用该模块,并在运行时出现 The import java.beans can be returned 错误。但应用程序运行良好。为什么我在 gwt 开发模式窗口中收到编译器错误?有什么想法吗?

00:17:33.079  [ERROR] Errors in 'file:/D:/workspace/App/src/main/java/com/abc/def/client/extract/pojos/ClientData.java'
00:17:33.079  [ERROR] Line 3: The import java.beans cannot be resolved
00:17:33.079  [ERROR] Line 4: The import java.beans cannot be resolved
00:17:33.079  [ERROR] Line 11: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 14: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 14: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 17: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 18: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 21: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 22: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 25: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 26: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 30: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 31: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 36: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 36: PropertyChangeSupport cannot be resolved to a type

In my gwt application somebody developed a module which uses java.beans.PropertyChangeSupport. Recently I have started using that module and getting The import java.beans cannot be resolved error when I run. But application runs well. Why am I getting compiler error in gwt dev mode window? Any ideas?

00:17:33.079  [ERROR] Errors in 'file:/D:/workspace/App/src/main/java/com/abc/def/client/extract/pojos/ClientData.java'
00:17:33.079  [ERROR] Line 3: The import java.beans cannot be resolved
00:17:33.079  [ERROR] Line 4: The import java.beans cannot be resolved
00:17:33.079  [ERROR] Line 11: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 14: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 14: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 17: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 18: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 21: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 22: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 25: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 26: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 30: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 31: PropertyChangeSupport cannot be resolved to a type
00:17:33.079  [ERROR] Line 36: PropertyChangeListener cannot be resolved to a type
00:17:33.079  [ERROR] Line 36: PropertyChangeSupport cannot be resolved to a type

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

信愁 2024-10-23 17:41:47

BobV 提到的 AutoBeans 是 GWT 很棒的新功能,但是重构需要您现有的代码才能使用它们。如果您的应用已使用 PropertyChangeSupport,则 gwtx 项目提供 GWT 模拟java.beans.PropertyChange* 类。

AutoBeans mentioned by BobV are great new feature of GWT, however refactoring of your existing code would be required in order to use them. If your application already uses PropertyChangeSupport, the gwtx project provides GWT emulation of java.beans.PropertyChange* classes.

永言不败 2024-10-23 17:41:47

GWT 仅实现JRE 类型的子集。 DevMode 起作用的原因是它根据系统的 JRE 类型编译 Java 源代码,以获得更好的运行时性能。运行生产模式编译时,它使用 com/google/gwt/emul/java/... 处的 gwt-user.jar 中的文件。

通用反射与死代码剥离和许多形式的整体优化不兼容,因此 GWT 编译器不实现运行时反射。 GWT 生成器系统< /a> 可以在编译时访问模块的整个类型系统,因此您可以实现足够的“静态”反射来满足您的需求。

如果您正在构建基于“状态包”的系统,您可能需要查看 AutoBeans 框架,通过访问者模式提供轻量级属性反射。

GWT only implements a subset of the JRE types. The reason that DevMode works is that it compiles your Java source against the system's JRE types for better runtime performance. When running the production-mode compile, it uses the files in gwt-user.jar at com/google/gwt/emul/java/....

General-purpose reflection is incompatible with dead-code stripping and many forms of monolithic optimization, so the GWT compiler doesn't implement runtime reflection. The GWT Generator system has access to the module's entire typesystem at compile-time, so you can implement enough "static" reflection to suit your needs.

If you're building a system based on "bags of state" you might want to look at the AutoBeans framework, which provides lightweight property reflection through a visitor pattern.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文