Package sun.tools.java

Examples of sun.tools.java.Identifier


    * If the user asked to keep the outer parent for an
   * inner class then we'll get the list of dependencies
   * the inner class may have and iterate over then by
   * "processing" them as well.
   */
  Identifier outer = null;
  if (ignoreOuter && cdef.isInnerClass() && cdef.isStatic())
      outer = cdef.getOuterClass().getName();
  for (Enumeration deps = cdef.getDependencies();
       deps.hasMoreElements(); )
  {
      Identifier dep = ((ClassDeclaration)deps.nextElement()).getName();
      /*
       * If we dont' want the outer parent class of an inner class
       * make this comparison.
       */
      if (outer != dep)
View Full Code Here


  /**
    * Overridden method from Environment
   */
  public void loadDefinition(ClassDeclaration c) {
      Identifier id = c.getName();
      if (c.getStatus() != CS_UNDEFINED)
    throw new IllegalArgumentException("No file for: " + id);
      Package pkg;
      try {
    pkg = getPackage(id.getQualifier());
      } catch (IOException e) {
    throw new IllegalArgumentException("IOException: " +
               e.getMessage());
      }
      ClassFile file = pkg.getBinaryFile(id.getName());
      if (file == null)
    throw new IllegalArgumentException("No file for: " +
               id.getName());
      BinaryClass bc;
      try {
    bc = loadFile(file);
      } catch (IOException e) {
    throw new IllegalArgumentException("IOException: " +
View Full Code Here

                                                        new DigestOutputStream(sink, md));

            out.writeInt(INTERFACE_HASH_STUB_VERSION);
            for (int i = 0; i < remoteMethods.length; i++) {
                MemberDefinition m = remoteMethods[i].getMemberDefinition();
                Identifier name = m.getName();
                Type type = m.getType();

                out.writeUTF(name.toString());
                // type signatures already use mangled class names
                out.writeUTF(type.getTypeSignature());

                ClassDeclaration exceptions[] = m.getExceptions(env);
                sortClassDeclarations(exceptions);
View Full Code Here

     */
    private void writeStubMethod(IndentingWriter p, int opnum)
        throws IOException
    {
        RemoteClass.Method method = remoteMethods[opnum];
        Identifier methodName = method.getName();
        Type methodType = method.getType();
        Type paramTypes[] = methodType.getArgumentTypes();
        String paramNames[] = nameParameters(paramTypes);
        Type returnType = methodType.getReturnType();
        ClassDeclaration[] exceptions = method.getExceptions();

        /*
         * Declare stub method; throw exceptions declared in remote
         * interface(s).
         */
        p.pln("// implementation of " +
            methodType.typeString(methodName.toString(), true, false));
        p.p("public " + returnType + " " + methodName + "(");
        for (int i = 0; i < paramTypes.length; i++) {
            if (i > 0)
                p.p(", ");
            p.p(paramTypes[i] + " " + paramNames[i]);
View Full Code Here

     */
    private void writeSkeletonDispatchCase(IndentingWriter p, int opnum)
        throws IOException
    {
        RemoteClass.Method method = remoteMethods[opnum];
        Identifier methodName = method.getName();
        Type methodType = method.getType();
        Type paramTypes[] = methodType.getArgumentTypes();
        String paramNames[] = nameParameters(paramTypes);
        Type returnType = methodType.getReturnType();

        p.pOlnI("case " + opnum + ": // " +
            methodType.typeString(methodName.toString(), true, false));
        /*
         * Use nested block statement inside case to provide an independent
         * namespace for local variables used to unmarshal parameters for
         * this remote method.
         */
 
View Full Code Here

             * REMIND: Should this access be part of RemoteClass.Method's
             * abstraction?
             */
            RemoteClass.Method method = remoteMethods[i];
            MemberDefinition def = method.getMemberDefinition();
            Identifier methodName = method.getName();
            Type methodType = method.getType();
            Type paramTypes[] = methodType.getArgumentTypes();

            p.p(def.getClassDefinition().getName() + ".class.getMethod(\"" +
                methodName + "\", new java.lang.Class[] {");
View Full Code Here

        try {
            /** Load the classes on the command line
             * Replace the entries in classes with the ClassDefinition for the class
             */
            for (int i = classes.size()-1; i >= 0; i-- ) {
                Identifier implClassName =
                    Identifier.lookup((String)classes.elementAt(i));

                /*
                 * Fix bugid 4049354: support using '.' as an inner class
                 * qualifier on the command line (previously, only mangled
View Full Code Here

        /*
         * Get '.' qualified inner class name (with outer class
         * qualification and no package qualification) and replace
         * each '.' with '$'.
         */
        Identifier mangled = Identifier.lookup(
                                               className.getFlatName().toString()
                                               .replace('.', sun.tools.java.Constants.SIGC_INNERCLASS));
        if (mangled.isInner())
            throw new Error("failed to mangle inner class name");

        // prepend package qualifier back for returned identifier
        return Identifier.lookup(className.getQualifier(), mangled);
    }
View Full Code Here

        if (theID.isQualified()) {

            // Extract the qualifier...

            Identifier id = theID.getQualifier();

            // 28.3.2.7 Case sensitive module names.

            env.modulesContext.assertPut(id.toString());

            // Count them...

            int count = 1;
            Identifier current = id;
            while (current.isQualified()) {
                current = current.getQualifier();
                count++;
            }

            result = new String[count];
            int index = count-1;
            current = id;

            // Now walk them and fill our array (backwards)...

            for (int i = 0; i < count; i++) {

                String item = current.getName().toString();

                // Check namesCache...

                String cachedItem = (String) env.namesCache.get(item);

                if (cachedItem == null) {

                    // 28.3.2.4 Illegal identifier characters...

                    cachedItem = convertToISOLatin1(item);

                    // Run it through the name checks...

                    cachedItem = getTypeOrModuleName(cachedItem);

                    // Add it to the namesCache...

                    env.namesCache.put(item,cachedItem);
                }

                result[index--] = cachedItem;
                current = current.getQualifier();
            }
        }


        // If it is supposed to be "boxed", prepend
View Full Code Here

        setFlags();

        // Set names...

        Identifier id = classDef.getName();
        String idlName;
        String[] idlModuleNames;

        try {

            // These can fail if we get case-sensitive name matches...

            idlName = IDLNames.getClassOrInterfaceName(id,env);
            idlModuleNames = IDLNames.getModuleNames(id,isBoxed(),env);

            setNames(id,idlModuleNames,idlName);

            // Is this an exception?

            if (isException()) {

                // Yes, so set our mangled exception names...

                isException = true;
                idlExceptionName = IDLNames.getExceptionName(getIDLName());
                qualifiedIDLExceptionName =
                    IDLNames.getQualifiedName(getIDLModuleNames(),idlExceptionName);
            }

            // Set interfaces, methods and members...

            interfaces = null;          // set in initialize()
            methods = null;                     // set in initialize()
            members = null;                 // set in initialize()

        } catch (Exception e) {
            failedConstraint(7,false,stack,id.toString(),e.getMessage());
            throw new CompilerError("");
        }
    }
View Full Code Here

TOP

Related Classes of sun.tools.java.Identifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.