com.sun.tools.corba.se.idl.SymtabEntry Java Examples

The following examples show how to use com.sun.tools.corba.se.idl.SymtabEntry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MethodGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private String writeExtract (String source, SymtabEntry type)
{
  String extract;
  if (type instanceof PrimitiveEntry)
  {
    if (type.name ().equals ("long long"))
      extract = source + ".extract_longlong ()";
    else if (type.name ().equals ("unsigned short"))
      extract = source + ".extract_ushort ()";
    else if (type.name ().equals ("unsigned long"))
      extract = source + ".extract_ulong ()";
    else if (type.name ().equals ("unsigned long long"))
      extract = source + ".extract_ulonglong ()";
    else
      extract = source + ".extract_" + type.name () + " ()";
  }
  else if (type instanceof StringEntry)
    extract = source + ".extract_" + type.name () + " ()";
  else
    extract = Util.helperName (type, true) + ".extract (" + source + ')'; // <d61056>
  return extract;
}
 
Example #2
Source File: ValueGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void writeMembers ()
{
  // if the value type contains no data members, a null return is expected
  if (v.state () == null)
    return;

  for (int i = 0; i < v.state ().size (); i ++)
  {
    InterfaceState member = (InterfaceState) v.state ().elementAt (i);
    SymtabEntry entry = (SymtabEntry) member.entry;
    Util.fillInfo (entry);

    if (entry.comment () != null)
      entry.comment ().generate (" ", stream);

    String modifier = "  ";
    if (member.modifier == InterfaceState.Public)
      modifier = "  public ";
    Util.writeInitializer (modifier, entry.name (), "", entry, stream);
  }
}
 
Example #3
Source File: StringGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
  tcoffsets.set (entry);
  StringEntry stringEntry = (StringEntry)entry;
  String bound;
  if (stringEntry.maxSize () == null)
    bound = "0";
  else
    bound = Util.parseExpression (stringEntry.maxSize ());

  // entry.name() is necessary to determine whether it is a
  // string or wstring

  stream.println (indent
                  + name
                  + " = org.omg.CORBA.ORB.init ().create_"
                  + entry.name()
                  + "_tc ("
                  + bound + ");");
  return index;
}
 
Example #4
Source File: UnionGen.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public int read (int index, String indent, String name,
    SymtabEntry entry, PrintWriter stream)
{
    UnionEntry u = (UnionEntry)entry;
    String disName = "_dis" + index++;
    SymtabEntry utype = Util.typeOf (u.type ());
    Util.writeInitializer (indent, disName, "", utype, stream);

    if (utype instanceof PrimitiveEntry)
        index = ((JavaGenerator)utype.generator ()).read (index, indent, disName, utype, stream);
    else
        stream.println (indent + disName + " = " + Util.helperName (utype, true) + ".read (istream);");

    if (utype.name ().equals ("boolean"))
        index = readBoolean (disName, index, indent, name, u, stream);
    else
        index = readNonBoolean (disName, index, indent, name, u, stream);

    return index;
}
 
Example #5
Source File: ValueGen24.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * d62023 - private state maps to protected, not default
 **/
protected void writeMembers ()
{
  // if the value type contains no data members, a null return is expected
  if (v.state () == null)
    return;

  for (int i = 0; i < v.state ().size (); i ++)
  {
    InterfaceState member = (InterfaceState) v.state ().elementAt (i);
    SymtabEntry entry = (SymtabEntry) member.entry;
    Util.fillInfo (entry);

    if (entry.comment () != null)
      entry.comment ().generate (" ", stream);

    String modifier = "  ";
    if (member.modifier == InterfaceState.Public)
      modifier = "  public ";
    else
      modifier = "  protected ";
    Util.writeInitializer (modifier, entry.name (), "", entry, stream);
  }
  stream.println();
}
 
Example #6
Source File: ValueGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void writeMembers ()
{
  // if the value type contains no data members, a null return is expected
  if (v.state () == null)
    return;

  for (int i = 0; i < v.state ().size (); i ++)
  {
    InterfaceState member = (InterfaceState) v.state ().elementAt (i);
    SymtabEntry entry = (SymtabEntry) member.entry;
    Util.fillInfo (entry);

    if (entry.comment () != null)
      entry.comment ().generate (" ", stream);

    String modifier = "  ";
    if (member.modifier == InterfaceState.Public)
      modifier = "  public ";
    Util.writeInitializer (modifier, entry.name (), "", entry, stream);
  }
}
 
Example #7
Source File: ConstGen.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the constant's value according to its type.
 **/
private void writeConstValue (SymtabEntry type)
{
  if (type instanceof PrimitiveEntry)
    stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
  else if (type instanceof StringEntry)
    stream.println (Util.parseExpression (c.value ()) + ';');
  else if (type instanceof TypedefEntry)
  {
    while (type instanceof TypedefEntry)
      type = type.type ();
    writeConstValue (type);
  }
  else
    stream.println (Util.parseExpression (c.value ()) + ';');
}
 
Example #8
Source File: ModuleGen.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate Java code for all members of an IDL module.
 **/
public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
{
  // Generate the package directory
  String name = Util.containerFullName( entry ) ;
  Util.mkdir (name);

  // Generate all of the contained types
  Enumeration e = entry.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry element = (SymtabEntry)e.nextElement ();
    if (element.emit ())
      element.generate (symbolTable, stream);
  }
}
 
Example #9
Source File: ValueGen24.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <d62023> - private state maps to protected, not default
 **/
protected void writeMembers ()
{
  // if the value type contains no data members, a null return is expected
  if (v.state () == null)
    return;

  for (int i = 0; i < v.state ().size (); i ++)
  {
    InterfaceState member = (InterfaceState) v.state ().elementAt (i);
    SymtabEntry entry = (SymtabEntry) member.entry;
    Util.fillInfo (entry);

    if (entry.comment () != null)
      entry.comment ().generate (" ", stream);

    String modifier = "  ";
    if (member.modifier == InterfaceState.Public)
      modifier = "  public ";
    else
      modifier = "  protected ";
    Util.writeInitializer (modifier, entry.name (), "", entry, stream);
  }
  stream.println();
}
 
Example #10
Source File: ConstGen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Write the constant's value according to its type.
 **/
private void writeConstValue (SymtabEntry type)
{
  if (type instanceof PrimitiveEntry)
    stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
  else if (type instanceof StringEntry)
    stream.println (Util.parseExpression (c.value ()) + ';');
  else if (type instanceof TypedefEntry)
  {
    while (type instanceof TypedefEntry)
      type = type.type ();
    writeConstValue (type);
  }
  else
    stream.println (Util.parseExpression (c.value ()) + ';');
}
 
Example #11
Source File: StructGen.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
protected void generateContainedTypes ()
{
  // Generate all of the contained types
  Enumeration e = s.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry entry = (SymtabEntry)e.nextElement ();

    // Don't generate contained entries if they are sequences.
    // Sequences are unnamed and since they translate to arrays,
    // no classes are generated for them, not even holders in this
    // case since they cannot be accessed outside of this struct.

    if (!(entry instanceof SequenceEntry))
      entry.generate (symbolTable, stream);
  }
}
 
Example #12
Source File: ModuleGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate Java code for all members of an IDL module.
 **/
public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
{
  // Generate the package directory
  String name = Util.containerFullName( entry ) ;
  Util.mkdir (name);

  // Generate all of the contained types
  Enumeration e = entry.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry element = (SymtabEntry)e.nextElement ();
    if (element.emit ())
      element.generate (symbolTable, stream);
  }
}
 
Example #13
Source File: ValueGen24.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * <d62023> - private state maps to protected, not default
 **/
protected void writeMembers ()
{
  // if the value type contains no data members, a null return is expected
  if (v.state () == null)
    return;

  for (int i = 0; i < v.state ().size (); i ++)
  {
    InterfaceState member = (InterfaceState) v.state ().elementAt (i);
    SymtabEntry entry = (SymtabEntry) member.entry;
    Util.fillInfo (entry);

    if (entry.comment () != null)
      entry.comment ().generate (" ", stream);

    String modifier = "  ";
    if (member.modifier == InterfaceState.Public)
      modifier = "  public ";
    else
      modifier = "  protected ";
    Util.writeInitializer (modifier, entry.name (), "", entry, stream);
  }
  stream.println();
}
 
Example #14
Source File: UnionGen.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
{
    SymtabEntry type = entry.type ();
    Util.writeInitializer (indent, '_' + name, "", entry, stream);

    if (!entry.arrayInfo ().isEmpty () ||
        type instanceof SequenceEntry ||
        type instanceof PrimitiveEntry ||
        type instanceof StringEntry) {
        index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream);
    } else {
        stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
    }

    stream.print (indent + "value." + name + " (");
    if( disName == "" )
        stream.println("_" + name + ");");
    else
        stream.println(disName + ", " + "_" + name + ");");

    return index;
}
 
Example #15
Source File: ModuleGen.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Generate Java code for all members of an IDL module.
 **/
public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
{
  // Generate the package directory
  String name = Util.containerFullName( entry ) ;
  Util.mkdir (name);

  // Generate all of the contained types
  Enumeration e = entry.contained ().elements ();
  while (e.hasMoreElements ())
  {
    SymtabEntry element = (SymtabEntry)e.nextElement ();
    if (element.emit ())
      element.generate (symbolTable, stream);
  }
}
 
Example #16
Source File: ValueBoxGen.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
   *
   **/
  protected void writeBody ()
  {
    InterfaceState member = (InterfaceState) v.state ().elementAt (0);
    SymtabEntry entry = (SymtabEntry) member.entry;
    Util.fillInfo (entry);
    if (entry.comment () != null)
      entry.comment ().generate (" ", stream);
    stream.println ("  public " +  Util.javaName (entry) + " value;");
    stream.println ("  public " +  v.name () + " (" + Util.javaName (entry) + " initial)");
    stream.println ("  {");
    stream.println ("    value = initial;");
    stream.println ("  }");
    stream.println ();
    writeTruncatable (); // <d60929>
//  writeStreamableMethods ();
  }
 
Example #17
Source File: UnionGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public int read (int index, String indent, String name,
    SymtabEntry entry, PrintWriter stream)
{
    UnionEntry u = (UnionEntry)entry;
    String disName = "_dis" + index++;
    SymtabEntry utype = Util.typeOf (u.type ());
    Util.writeInitializer (indent, disName, "", utype, stream);

    if (utype instanceof PrimitiveEntry)
        index = ((JavaGenerator)utype.generator ()).read (index, indent, disName, utype, stream);
    else
        stream.println (indent + disName + " = " + Util.helperName (utype, true) + ".read (istream);");

    if (utype.name ().equals ("boolean"))
        index = readBoolean (disName, index, indent, name, u, stream);
    else
        index = readNonBoolean (disName, index, indent, name, u, stream);

    return index;
}
 
Example #18
Source File: UnionGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
{
    SymtabEntry type = entry.type ();
    Util.writeInitializer (indent, '_' + name, "", entry, stream);

    if (!entry.arrayInfo ().isEmpty () ||
        type instanceof SequenceEntry ||
        type instanceof PrimitiveEntry ||
        type instanceof StringEntry) {
        index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream);
    } else {
        stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
    }

    stream.print (indent + "value." + name + " (");
    if( disName == "" )
        stream.println("_" + name + ");");
    else
        stream.println(disName + ", " + "_" + name + ");");

    return index;
}
 
Example #19
Source File: Stub.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
public void generate (Hashtable symbolTable, SymtabEntry entry)
{
  this.symbolTable = symbolTable;
  this.i           = (InterfaceEntry)entry;
  this.localStub   = i.isLocalServant();
  this.isAbstract  = i.isAbstract( );
  init ();

  openStream ();
  if (stream == null)
    return;
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
}
 
Example #20
Source File: ValueBoxGen.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueBoxEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();
  if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
      mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
  {
    SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
    ((JavaGenerator)member.generator ()).read (0, "    ", entryName + ".value", member, stream);
  }
  else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
    stream.println ("    " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
  else
    stream.println ("    " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
}
 
Example #21
Source File: MethodGen.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
private void writeInsert (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
{
  String typeName = type.name ();
  if (type instanceof PrimitiveEntry)
  {
    // RJB does something have to be done with TC offsets?
    if (typeName.equals ("long long"))
      stream.println (indent + source + ".insert_longlong (" + target + ");");
    else if (typeName.equals ("unsigned short"))
      stream.println (indent + source + ".insert_ushort (" + target + ");");
    else if (typeName.equals ("unsigned long"))
      stream.println (indent + source + ".insert_ulong (" + target + ");");
    else if (typeName.equals ("unsigned long long"))
      stream.println (indent + source + ".insert_ulonglong (" + target + ");");
    else
      stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
  }
  else if (type instanceof StringEntry)
    stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
  else
    stream.println (indent + Util.helperName (type, true) + ".insert (" + source + ", " + target + ");"); // <d61056>
}
 
Example #22
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 **/
static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
{
  String arrays = "";
  try
  {
    String name = (String)t.dynamicVariable (Compile.typedefInfo);
    int index = name.indexOf ('[');
    if (index >= 0)
    {
      arrays = name.substring (index);
      name = name.substring (0, index);
    }

    // See if the base type should be added to the list.
    SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
    if (typeEntry != null && importTypes.contains (typeEntry))
      addTo (importList, typeEntry.name ());
  }
  catch (NoSuchFieldException e)
  {}
  return arrays;
}
 
Example #23
Source File: ValueBoxGen24.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023>
 **/
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  Vector vMembers = ( (ValueEntry) entry ).state ();
  TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
  SymtabEntry mType = member.type ();

  if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
  else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
    index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
  else
    stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
  return index;
}
 
Example #24
Source File: ValueGen.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
{
  // First do the state members from concrete parent hierarchy
  Vector vParents = ((ValueEntry)entry).derivedFrom ();
  if (vParents != null && vParents.size () != 0)
  {
    ValueEntry parent = (ValueEntry)vParents.elementAt (0);
    if (parent == null)
      return index;
    // Per Simon, 4/06/99 - call parent write. <d60929>
    // Per Simon, 4/27/99 - call parent _write. <d62062>
    if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // <d60929>
        stream.println(indent + Util.helperName (parent, true) + "._write (ostream, value);"); // <d60929> <d61056> <d62062>
  }

  Vector vMembers = ((ValueEntry) entry ).state ();
  int noOfMembers = vMembers == null ? 0 : vMembers.size ();
  for (int k = 0; k < noOfMembers; k++)
  {
    TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
    String memberName = member.name ();
    SymtabEntry mType = member.type ();

    if (mType instanceof PrimitiveEntry ||
        mType instanceof TypedefEntry   ||
        mType instanceof SequenceEntry  ||
        mType instanceof StringEntry    ||
        !member.arrayInfo ().isEmpty ())
      index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
    else
      stream.println (indent + Util.helperName (mType, true) + // <d61056>
                            ".write (ostream, " + name + '.' + memberName + ");");
  }

  return index;
}
 
Example #25
Source File: MethodGen24.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> Write the methodEntry for a valuetype factory method into
 *          the Value Helper class. Contents from email from Simon,
 *          4/25/99.
 **/
protected void helperFactoryMethod (Hashtable symbolTable, MethodEntry m, SymtabEntry t, PrintWriter stream)
{
  this.symbolTable = symbolTable;
  this.m = m;
  this.stream = stream;
  String initializerName = m.name ();
  String typeName = Util.javaName (t);
  String factoryName = typeName + "ValueFactory";

  // Step 1. Print factory method decl up to parms.
  stream.print  ("  public static " + typeName + " " + initializerName +
          " (org.omg.CORBA.ORB $orb");
  if (!m.parameters ().isEmpty ())
    stream.print (", "); // <d62794>

  // Step 2. Print the declaration parameter list.
  writeParmList (m, true, stream);

  // Step 3. Print the body of the factory method
  stream.println (")");
  stream.println ("  {");
  stream.println ("    try {");
  stream.println ("      " + factoryName + " $factory = (" + factoryName + ")");
  stream.println ("          ((org.omg.CORBA_2_3.ORB) $orb).lookup_value_factory(id());");
  stream.print   ("      return $factory." + initializerName + " (");
  writeParmList (m, false, stream);
  stream.println (");");
  stream.println ("    } catch (ClassCastException $ex) {");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    }");
  stream.println ("  }");
  stream.println ();
}
 
Example #26
Source File: TypedefGen.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
{
  // The type() method is invoked from other emitters instead of when an IDL
  // typedef statement is being processed.  Code generated is identical minus the
  // generation of a create_alias_tc() which is required for IDL typedef's but not
  // needed when typedef is being processed as a member of struct/union/valuetype.

  return helperType( index, indent, tcoffsets, name, entry, stream);
}
 
Example #27
Source File: Holder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the holder class. Provides general algorithm for
 * auxiliary binding generation:
 * 1.) Initialize symbol table and symbol table entry members,
 *     common to all generators.
 * 2.) Initialize members unique to this generator.
 * 3.) Open print stream
 * 4.) Write class heading (package, prologue, source comment, class
 *     statement, open curly
 * 5.) Write class body (member data and methods)
 * 6.) Write class closing (close curly)
 * 7.) Close the print stream
 **/
public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
{
  this.symbolTable = symbolTable;
  this.entry       = entry;
  init ();

  openStream ();
  if (stream == null)
    return;
  writeHeading ();
  writeBody ();
  writeClosing ();
  closeStream ();
}
 
Example #28
Source File: Holder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Generate the _write method.
 **/
protected void writeWrite ()
{
  stream.println ("  public void _write (org.omg.CORBA.portable.OutputStream o)");
  stream.println ("  {");
  if (entry instanceof ValueBoxEntry)
  {
    TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
    SymtabEntry mType = member.type ();
    if (mType instanceof StringEntry)
      stream.println ("    o.write_string (value);");

    else if (mType instanceof PrimitiveEntry)
    {
      String name = entry.name ();
      stream.println ("    " + name + " vb = new " + name + " (value);");
      stream.println ("    " + helperClass + ".write (o, vb);");
    }

    else
      stream.println ("    " + helperClass + ".write (o, value);");
  }
  else
    stream.println ("    " + helperClass + ".write (o, value);");
  stream.println ("  }");
  stream.println ();
}
 
Example #29
Source File: MethodGen24.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <d62023> Write the methodEntry for a valuetype factory method into
 *          the Value Helper class. Contents from email from Simon,
 *          4/25/99.
 **/
protected void helperFactoryMethod (Hashtable symbolTable, MethodEntry m, SymtabEntry t, PrintWriter stream)
{
  this.symbolTable = symbolTable;
  this.m = m;
  this.stream = stream;
  String initializerName = m.name ();
  String typeName = Util.javaName (t);
  String factoryName = typeName + "ValueFactory";

  // Step 1. Print factory method decl up to parms.
  stream.print  ("  public static " + typeName + " " + initializerName +
          " (org.omg.CORBA.ORB $orb");
  if (!m.parameters ().isEmpty ())
    stream.print (", "); // <d62794>

  // Step 2. Print the declaration parameter list.
  writeParmList (m, true, stream);

  // Step 3. Print the body of the factory method
  stream.println (")");
  stream.println ("  {");
  stream.println ("    try {");
  stream.println ("      " + factoryName + " $factory = (" + factoryName + ")");
  stream.println ("          ((org.omg.CORBA_2_3.ORB) $orb).lookup_value_factory(id());");
  stream.print   ("      return $factory." + initializerName + " (");
  writeParmList (m, false, stream);
  stream.println (");");
  stream.println ("    } catch (ClassCastException $ex) {");
  stream.println ("      throw new org.omg.CORBA.BAD_PARAM ();");
  stream.println ("    }");
  stream.println ("  }");
  stream.println ();
}
 
Example #30
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the import lines for template types.
 **/
static private void checkForBounds (SymtabEntry entry, Vector importTypes, Vector importList)
{
  // Obtain actual type, just to be complete.
  SymtabEntry entryType = entry;
  while (entryType instanceof TypedefEntry)
    entryType = entryType.type ();

  if (entryType instanceof StringEntry && ((StringEntry)entryType).maxSize () != null)
    checkForGlobalConstants (((StringEntry)entryType).maxSize ().rep (), importTypes, importList);
  else
    if (entryType instanceof SequenceEntry && ((SequenceEntry)entryType).maxSize () != null)
      checkForGlobalConstants (((SequenceEntry)entryType).maxSize ().rep (), importTypes, importList);
}