diff --git a/src/de/inetsoftware/jwebassembly/module/nativecode/ReplacementForClass.java b/src/de/inetsoftware/jwebassembly/module/nativecode/ReplacementForClass.java index 5a6a289..31e4eb6 100644 --- a/src/de/inetsoftware/jwebassembly/module/nativecode/ReplacementForClass.java +++ b/src/de/inetsoftware/jwebassembly/module/nativecode/ReplacementForClass.java @@ -318,6 +318,35 @@ class ReplacementForClass { return simpleName.substring( index ); } + /** + * Replacement of the Java method getCanonicalName() + * + * @return the canonical name of the underlying class + */ + public String getCanonicalName() { + String canonicalName; + if( isArray() ) { + canonicalName = getComponentType().getCanonicalName(); + if( canonicalName != null ) + return canonicalName + "[]"; + else + return null; + } + canonicalName = getName(); + int idx = canonicalName.indexOf( '$' ); + if( idx >= 0 ) { + idx++; + if( idx < canonicalName.length() ) { + char ch = canonicalName.charAt( idx ); + if( '0' <= ch && ch <= '9' ) { + return null; + } + } + return canonicalName.replace( '$', '.' ); + } + return canonicalName; + } + /** * Replacement of the Java method getMethod() */