3

有谁知道为什么会发生这种情况?

这是来自 Java DBus 绑定 (2.6) 的一些修改行

  // don't let people import things which don't have a
  // valid D-Bus interface name
  System.out.println("type.getName: " + type.getName() + "   type.getSimpleName: " + type.getSimpleName() );
  if (type.getName().equals(type.getSimpleName()))  {
      throw new DBusException(_("DBusInterfaces cannot be declared outside a package: " + "type.getName: " + type.getName()
              + "   type.getSimpleName: " + type.getSimpleName() ));
  }      

现在查看 Cacao (0.99.4) 与 Sun 1.5 的输出差异

@ubuntu:~/tmp/cacao$ java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)

@ubuntu:~/tmp/cacao$ cacao -version
java version "1.5.0"
CACAO version 0.99.3+hg

java -Djava.library.path=/usr/lib/classpath:/ho... DBusChat 

type.getName: org.freedesktop.DBus   type.getSimpleName: DBus
...Exception in thread "main" org.freedesktop.dbus.exceptions.DBusExecutionException: Could not get owner of name 'framez.tests.dbus.DbusChatInterface': no such name

相对...

 cacao -Djava.library.path=/usr/lib/classpath:/ho... DBusChat
 type.getName: org.freedesktop.DBus   type.getSimpleName: org.freedesktop.DBus

异常并不重要 - 它是由这种行为引起的......有什么想法吗?或者这是可可的一些奇怪的错误。

有谁知道 .getName() 是否依赖于虚拟机?

信息:

两个 JVM 上的 GNU Classpath 0.98 DBus 绑定 2.6

4

1 回答 1

15

这很可能是 GNU Classpath 移植到 Cacao 平台的一个错误。如果我没记错的话,Classpath 版本中的大多数方法都java.lang.Class委托给需要为库的每个端口实现的“vm”类。

当然Class.getSimpleName()应该返回没有包限定的类名。

于 2009-08-28T06:35:18.820 回答