Java Class.getSimpleName () and .getName () behave differently in Cacao and Sun Java

Does anyone have any idea why this is happening?

These are some modified rows from Java DBus bindings (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() ));
  }      

Now check the difference in output from Cacao (0.99.4) vs 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

compared with...

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

The exception is not important - it is caused by this behavior ... Any ideas? Or is this some kind of weird bug with Cacao.

Does anyone know if .getName () is VM dependent?

information:

GNU Classpath 0.98 on both JVM Binding DBus 2.6

+3
source share
1 answer

, GNU Classpath Cacao. , Classpath java.lang.Class "vm", .

Class.getSimpleName() .

+15

Source: https://habr.com/ru/post/1716275/


All Articles