Package sun.tools.java

Examples of sun.tools.java.ClassDeclaration


  public boolean classExists(Identifier id) {
      if (id.isInner())
    id = id.getTopName();
      Type t = Type.tClass(id);
      try {
    ClassDeclaration c = (ClassDeclaration)classes.get(t);
    if (c == null) {
        Package pkg = getPackage(id.getQualifier());
        return pkg.getBinaryFile(id.getName()) != null;
    }
    return c.getName().equals(id);
      } catch (IOException e) {
    return false;
      }
  }
View Full Code Here


  public ClassDeclaration getClassDeclaration(Identifier id) {
      return getClassDeclaration(Type.tClass(id));
  }

  public ClassDeclaration getClassDeclaration(Type t) {
      ClassDeclaration c = (ClassDeclaration)classes.get(t);
      if (c == null) {
    c = new ClassDeclaration(t.getClassName());
    classes.put(t, c);
      }
      return c;
  }
View Full Code Here

        uniqueList.addElement(defRemoteException);

        /* For each exception declared by the stub method's throws clause: */
    nextException:
        for (int i = 0; i < exceptions.length; i++) {
            ClassDeclaration decl = exceptions[i];
            try {
                if (defException.subClassOf(env, decl)) {
                    /*
                     * (If java.lang.Exception (or a superclass) was declared
                     * in the throws clause of this stub method, then we don't
                     * have to bother catching anything; clear the list and
                     * return.)
                     */
                    uniqueList.clear();
                    break;
                } else if (!defException.superClassOf(env, decl)) {
                    /*
                     * Ignore other Throwables that do not extend Exception,
                     * since they do not need to be caught anyway.
                     */
                    continue;
                }
                /*
                 * Compare this exception against the current list of
                 * exceptions that need to be caught:
                 */
                for (int j = 0; j < uniqueList.size();) {
                    ClassDefinition def =
                        (ClassDefinition) uniqueList.elementAt(j);
                    if (def.superClassOf(env, decl)) {
                        /*
                         * If a superclass of this exception is already on
                         * the list to catch, then ignore and continue;
                         */
                        continue nextException;
                    } else if (def.subClassOf(env, decl)) {
                        /*
                         * If a subclass of this exception is on the list
                         * to catch, then remove it.
                         */
                        uniqueList.removeElementAt(j);
                    } else {
                        j++;    // else continue comparing
                    }
                }
                /* This exception is unique: add it to the list to catch. */
                uniqueList.addElement(decl.getClassDefinition(env));
            } catch (ClassNotFound e) {
                env.error(0, "class.not.found", e.name, decl.getName());
                /*
                 * REMIND: We do not exit from this exceptional condition,
                 * generating questionable code and likely letting the
                 * compiler report a resulting error later.
                 */
 
View Full Code Here

                 * class name identifiers to their binary "outer" class name:
                 * "pkg.Outer. Inner" becomes "pkg.Outer$Inner".
                 */
                implClassName = Names.mangleClass(implClassName);

                ClassDeclaration decl = env.getClassDeclaration(implClassName);
                try {
                    ClassDefinition def = decl.getClassDefinition(env);
                    for (int j = 0; j < generators.size(); j++) {
                        Generator gen = (Generator)generators.elementAt(j);
                        gen.generate(env, def, destDir);
                    }
                } catch (ClassNotFound ex) {
View Full Code Here

        boolean done;

        do {
            done = true;
            for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
                ClassDeclaration c = (ClassDeclaration)e.nextElement();
                done = compileClass(c,buf,env);
            }
        } while (!done);
    }
View Full Code Here

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

                ClassDeclaration exceptions[] = m.getExceptions(env);
                sortClassDeclarations(exceptions);
                for (int j = 0; j < exceptions.length; j++) {
                    out.writeUTF(Names.mangleClass(
                                                   exceptions[j].getName()).toString());
                }
View Full Code Here

     * in a canonical order into the digest stream for the interface hash
     * computation.
     */
    private void sortClassDeclarations(ClassDeclaration[] decl) {
        for (int i = 1; i < decl.length; i++) {
            ClassDeclaration curr = decl[i];
            String name = Names.mangleClass(curr.getName()).toString();
            int j;
            for (j = i; j > 0; j--) {
                if (name.compareTo(
                                   Names.mangleClass(decl[j - 1].getName()).toString()) >= 0)
                    {
View Full Code Here

        try {
            env.getMain().compileAllClasses(env);
        } catch (Exception e1) {
            for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
                ClassDeclaration c = (ClassDeclaration)e.nextElement();
            }
            failedConstraint(26,false,stack,"required classes");
            env.flushErrors();
        }
View Full Code Here

                        result = SpecialClassType.forSpecial(theClass,stack);

                        if (result == null) {

                            ClassDeclaration classDecl = theClass.getClassDeclaration();

                            // Nope, does it implement java.rmi.Remote?

                            if (env.defRemote.implementedBy(env,classDecl)) {
View Full Code Here

                                              Vector currentMethods,
                                              boolean quiet,
                                              ContextStack stack)
        throws ClassNotFound {

        ClassDeclaration parentDecl = current.getSuperClass(env);

        while (parentDecl != null) {

            ClassDefinition parentDef = parentDecl.getClassDefinition(env);
            Identifier currentID = parentDecl.getName();

            if ( currentID == idJavaLangObject ) break;

            // Walk all members of this class and update any that
            // already exist in currentMethods...
View Full Code Here

TOP

Related Classes of sun.tools.java.ClassDeclaration

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.