JAV2I 1.3 NO IDEA Avatar
  1. OMG Issue

JAV2I13 — scheme for mapping names is pretty byzantine

  • Key: JAV2I13-8
  • Legacy Issue Number: 5742
  • Status: closed  
  • Source: Boeing ( Mr. Paul Murray)
  • Summary:

    You know, this scheme for mapping names is pretty byzantine. As far as I can tell, if you happen to name a java variable J_Fred, you've got problems. I'm sure you get plenty of suggestions. Here's mine:

    1) Underscore is used consistently as an escape character. Thus: _ -> __ $ -> _S \u1234 -> _U1234 ( -> _P (parenthesis) [ -> _B (bracket) ; -> _C (semiColon) / -> _F (forward slash)

    _U uppercases a single character doRecord -> DO_URECORD

    A indicates that the entire name is in uppercase MAX_VALUE -> _AMAX_VALUE

    2) inner classes - we replace the dot with a $, and use that as the name. This is how most java compilers produce inner classes.

    3) Overloaded names - In the case of overloaded names, then rather than using the simple name of a method or variable, we use the converted name as it is defined in the java virtual machine specification, section 4.3. This is an already existing standard for uniquely identifying members in java classes. As methods are identified by parameters (ie: we don't need the return types to distinguish them), we can ignore the closing parenthesis and return type of a Method Descriptor.

    However, we use lowercase for the characters in table 4.2 so that our underscore escaping doesn't expand out foo(I to foo_P_UI

    thus: int FOO int foo void foo() Object foo(int) long foo(int[]) a.b.Boz foo(a.b.Bar.Baz)

    become

    FOO foo foo( foo(i foo([i foo(la/b/Bar$Baz;

    which are encoded by the rules above to

    _AFOO FOO FOO_P FOO_PI FOO_P_BI FOO_PLA_FA_F_UBAR_S_UBAZ_C

    These are not very natural ... but there you go. Serves you right for attempting to use IDL for overloaded names.

    If IDL had an name ailiasing facility (maybe it does), then all classes and methods could be generated as above and used as such in generated code, and an alias produced for those names which map unambiguously to a particular field or value.

    Thus for doAThing(int), all generated code would use DO_UA__UTHING_PI, but an alias DOATHING would be generated and presumably used by coders.

  • Reported: JAV2I 1.2 — Thu, 31 Oct 2002 05:00 GMT
  • Disposition: Resolved — JAV2I 1.3
  • Disposition Summary:

    see above

  • Updated: Fri, 6 Mar 2015 20:58 GMT