Package org.eclipse.jdt.internal.compiler

Examples of org.eclipse.jdt.internal.compiler.ClassFile


                            }
                        }
                        if (problemList.isEmpty()) {
                            ClassFile[] classFiles = result.getClassFiles();
                            for (int i = 0; i < classFiles.length; i++) {
                                ClassFile classFile = classFiles[i];
                                char[][] compoundName =
                                    classFile.getCompoundName();
                                String className = "";
                                String sep = "";
                                for (int j = 0;
                                     j < compoundName.length; j++) {
                                    className += sep;
                                    className += new String(compoundName[j]);
                                    sep = ".";
                                }
                                byte[] bytes = classFile.getBytes();
                                String outFile = outputDir + "/" +
                                    className.replace('.', '/') + ".class";
                                FileOutputStream fout =
                                    new FileOutputStream(outFile);
                                BufferedOutputStream bos =
View Full Code Here


    @Override
    public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
      final char[] typeChars = CharOperation.concatWith(compoundTypeName, '.');
      String typeName = String.valueOf(typeChars);
      // System.out.println("findType: " + typeName);
      ClassFile classFile = classFiles.get(typeName);
      if (classFile != null) {
        try {
          byte[] bytes = classFile.getBytes();
          char[] loc = classFile.fileName();
          ClassFileReader cfr = new ClassFileReader(bytes, loc);
          return new NameEnvironmentAnswer(cfr, null);
        } catch (ClassFormatException e) {
          throw new RuntimeException("Unexpectedly unable to parse class file",
              e);
View Full Code Here

      this.sourceName = qualifiedName.replace('$', '.');
    } else {
      this.sourceName = getPackagePrefix(packageName)
          + String.valueOf(binding.qualifiedSourceName());
    }
    ClassFile classFile = getClassFile(typeDeclaration, binaryName);
    this.bytes = classFile.getBytes();
    this.location = String.valueOf(classFile.fileName());
  }
View Full Code Here

        // Already created.
        return;
      }
      CompiledClass enclosingClass = null;
      if (classFile.enclosingClassFile != null) {
        ClassFile enclosingClassFile = classFile.enclosingClassFile;
        createCompiledClass(enclosingClassFile, results);
        enclosingClass = results.get(enclosingClassFile);
        assert enclosingClass != null;
      }
      String internalName = CharOperation.charToString(classFile.fileName());
View Full Code Here

        // Already created.
        return;
      }
      CompiledClass enclosingClass = null;
      if (classFile.enclosingClassFile != null) {
        ClassFile enclosingClassFile = classFile.enclosingClassFile;
        createCompiledClass(enclosingClassFile, results);
        enclosingClass = results.get(enclosingClassFile);
        assert enclosingClass != null;
      }
      String internalName = CharOperation.charToString(classFile.fileName());
View Full Code Here

                                            problem.getMessage());
                            }
                        } else {
                            ClassFile[] classFiles = result.getClassFiles();
                            for (int i = 0; i < classFiles.length; i++) {
                                ClassFile classFile = classFiles[i];
                                char[][] compoundName =
                                    classFile.getCompoundName();
                                String className = "";
                                String sep = "";
                                for (int j = 0;
                                     j < compoundName.length; j++) {
                                    className += sep;
                                    className += new String(compoundName[j]);
                                    sep = ".";
                                }
                                byte[] bytes = classFile.getBytes();
                                String outFile = destDir + "/" +
                                    className.replace('.', '/') + ".class";
                                FileOutputStream fout =
                                    new FileOutputStream(outFile);
                                BufferedOutputStream bos =
View Full Code Here

                    }
                }
                if ( !pResult.hasErrors() ) {
                    final ClassFile[] clazzFiles = pResult.getClassFiles();
                    for ( int i = 0; i < clazzFiles.length; i++ ) {
                        final ClassFile clazzFile = clazzFiles[i];
                        final char[][] compoundName = clazzFile.getCompoundName();
                        final StringBuffer clazzName = new StringBuffer();
                        for ( int j = 0; j < compoundName.length; j++ ) {
                            if ( j != 0 ) {
                                clazzName.append( '.' );
                            }
                            clazzName.append( compoundName[j] );
                        }
                        pStore.write( clazzName.toString().replace( '.',
                                                                    '/' ) + ".class",
                                      clazzFile.getBytes() );
                    }
                }
            }
        };
View Full Code Here

                    }
                }
                if (problemList.isEmpty()) {
                    ClassFile[] classFiles = result.getClassFiles();
                    for (int i = 0; i < classFiles.length; i++) {
                        ClassFile classFile = classFiles[i];
                        char[][] compoundName = classFile.getCompoundName();
                        String className = "";
                        String sep = "";
                        for (int j = 0; j < compoundName.length; j++) {
                            className += sep;
                            className += new String(compoundName[j]);
                            sep = ".";
                        }
                        byte[] bytes = classFile.getBytes();
                        String outFile = outputDir + "/"
                                + className.replace('.', '/') + ".class";
                        FileOutputStream fout = null;
                        BufferedOutputStream bos = null;
                        try {
View Full Code Here

                    }
                }
                // Something has been compiled
                ClassFile[] clazzFiles = result.getClassFiles();
                for (int i = 0; i < clazzFiles.length; i++) {
                    final ClassFile clazzFile = clazzFiles[i];
                    final char[][] compoundName = clazzFile.getCompoundName();
                    final StringBuffer clazzName = new StringBuffer();
                    for (int j = 0; j < compoundName.length; j++) {
                        if (j != 0) {
                            clazzName.append('.');
                        }
                        clazzName.append(compoundName[j]);
                    }

                    if (Logger.isTraceEnabled()) {
                        Logger.trace("Compiled %s", clazzName);
                    }

                    applicationClasses.getApplicationClass(clazzName.toString()).compiled(clazzFile.getBytes());
                }
            }
        };

        /**
 
View Full Code Here

public boolean acceptClassFiles(ClassFile[] classFiles, char[] codeSnippetClassName) {
  int length = classFiles.length;
  byte[][] classFileBytes = new byte[length][];
  String[][] compoundNames = new String[length][];
  for (int i = 0; i < length; i++) {
    ClassFile classFile = classFiles[i];
    classFileBytes[i] = classFile.getBytes();
    char[][] classFileCompundName = classFile.getCompoundName();
    int length2 = classFileCompundName.length;
    String[] compoundName = new String[length2];
    for (int j = 0; j < length2; j++){
      compoundName[j] = new String(classFileCompundName[j]);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ClassFile

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.