Package org.eclipse.jdt.internal.compiler.env

Examples of org.eclipse.jdt.internal.compiler.env.IBinaryType


        case SOURCE :
          CompilationUnit unit = new CompilationUnit(null, _fileName, null /* encoding */);
          _filer.addNewUnit(unit);
          break;
        case CLASS :
          IBinaryType binaryType = null;
          try {
            binaryType = ClassFileReader.read(_fileName);
          } catch (ClassFormatException e) {
            // ignore
          } catch (IOException e) {
            // ignore
          }
          if (binaryType != null) {
            char[] name = binaryType.getName();
            ReferenceBinding type = this._filer._env._compiler.lookupEnvironment.getType(CharOperation.splitOn('/', name));
            if (type != null && type.isValidBinding() && type.isBinaryBinding()) {
              _filer.addNewClassFile(type);
            }
          }
View Full Code Here


        this.context,
        getMapper().startPosOffset,
        getMapper().startPosOffset + this.codeSnippet.length - 1);
    ((CodeSnippetParser) compiler.parser).lineSeparatorLength = this.context.lineSeparator.length();
    // Initialize the compiler's lookup environment with the already compiled super classes
    IBinaryType binary = this.context.getRootCodeSnippetBinary();
    if (binary != null) {
      compiler.lookupEnvironment.cacheBinaryType(binary, null /*no access restriction*/);
    }
    VariablesInfo installedVars = this.context.installedVars;
    if (installedVars != null) {
View Full Code Here

          }
        }
      } else {
        // cache binary type binding
        ClassFile classFile = (ClassFile)openable;
        IBinaryType binaryType = (IBinaryType) JavaModelManager.getJavaModelManager().getInfo(classFile.getType());
        if (binaryType == null) {
          // create binary type from file
          if (classFile.getPackageFragmentRoot().isArchive()) {
            binaryType = this.builder.createInfoFromClassFileInJar(classFile);
          } else {
View Full Code Here

  this.cuToHandle.put(unit, handle);
  return unit;
}
protected IBinaryType createInfoFromClassFile(Openable classFile, IResource file) {
  String documentPath = classFile.getPath().toString();
  IBinaryType binaryType = (IBinaryType)this.binariesFromIndexMatches.get(documentPath);
  if (binaryType != null) {
    this.infoToHandle.put(binaryType, classFile);
    return binaryType;
  } else {
    return super.createInfoFromClassFile(classFile, file);
View Full Code Here

  IPackageFragmentRoot root = classFile.getPackageFragmentRoot();
  IPath path = root.getPath();
  // take the OS path for external jars, and the forward slash path for internal jars
  String rootPath = path.getDevice() == null ? path.toString() : path.toOSString();
  String documentPath = rootPath + IJavaSearchScope.JAR_FILE_ENTRY_SEPARATOR + filePath;
  IBinaryType binaryType = (IBinaryType)this.binariesFromIndexMatches.get(documentPath);
  if (binaryType != null) {
    this.infoToHandle.put(binaryType, classFile);
    return binaryType;
  } else {
    return super.createInfoFromClassFileInJar(classFile);
View Full Code Here

  /**
* Creates the type info from the given class file on disk and
* adds it to the given list of infos.
*/
protected IBinaryType createInfoFromClassFile(Openable handle, IResource file) {
  IBinaryType info = null;
  try {
    info = Util.newClassFileReader(file);
  } catch (org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
View Full Code Here

* Create a type info from the given class file in a jar and adds it to the given list of infos.
*/
protected IBinaryType createInfoFromClassFileInJar(Openable classFile) {
  PackageFragment pkg = (PackageFragment) classFile.getParent();
  String classFilePath = Util.concatWith(pkg.names, classFile.getElementName(), '/');
  IBinaryType info = null;
  java.util.zip.ZipFile zipFile = null;
  try {
    zipFile = ((JarPackageFragmentRoot)pkg.getParent()).getJar();
    info = org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.read(
      zipFile,
View Full Code Here

*
* @see Openable
* @see Signature
*/
protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
  IBinaryType typeInfo = getBinaryTypeInfo((IFile) underlyingResource);
  if (typeInfo == null) {
    // The structure of a class file is unknown if a class file format errors occurred
    //during the creation of the diet class file representative of this ClassFile.
    info.setChildren(new IJavaElement[] {});
    return false;
View Full Code Here

}
public IBinaryType getBinaryTypeInfo(IFile file, boolean fullyInitialize) throws JavaModelException {
  JavaElement pkg = (JavaElement) getParent();
  if (pkg instanceof JarPackageFragment) {
    try {
      IBinaryType info = getJarBinaryTypeInfo((PackageFragment) pkg, fullyInitialize);
      if (info == null) {
        throw newNotPresentException();
      }
      return info;
    } catch (ClassFormatException cfe) {
View Full Code Here

  // Check the cache for the top-level type first
  IType outerMostEnclosingType = getOuterMostEnclosingType();
  IBuffer buffer = getBufferManager().getBuffer(outerMostEnclosingType.getClassFile());
  if (buffer == null) {
    SourceMapper mapper = getSourceMapper();
    IBinaryType typeInfo = info instanceof IBinaryType ? (IBinaryType) info : null;
    if (mapper != null) {
      buffer = mapSource(mapper, typeInfo, outerMostEnclosingType.getClassFile());
    }
  }
  return buffer;
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.env.IBinaryType

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.