org.eclipse.jdt.internal.core.util.Util.newClassFileReader()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(10.4k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中org.eclipse.jdt.internal.core.util.Util.newClassFileReader()方法的一些代码示例,展示了Util.newClassFileReader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.newClassFileReader()方法的具体详情如下:
包路径:org.eclipse.jdt.internal.core.util.Util
类名称:Util
方法名:newClassFileReader

Util.newClassFileReader介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

/**
 * 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();
    }
    return null;
  } catch (java.io.IOException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  } catch (CoreException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  }
  this.infoToHandle.put(info, handle);
  return info;
}
  /**

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * 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();
    }
    return null;
  } catch (java.io.IOException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  } catch (CoreException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  }
  this.infoToHandle.put(info, handle);
  return info;
}
  /**

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

/**
 * 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();
    }
    return null;
  } catch (java.io.IOException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  } catch (CoreException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  }
  this.infoToHandle.put(info, handle);
  return info;
}
  /**

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

/**
 * 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();
    }
    return null;
  } catch (java.io.IOException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  } catch (CoreException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  }
  this.infoToHandle.put(info, handle);
  return info;
}
  /**

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * 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();
    }
    return null;
  } catch (java.io.IOException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  } catch (CoreException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  }
  this.infoToHandle.put(info, handle);
  return info;
}
  /**

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * 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();
    }
    return null;
  } catch (java.io.IOException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  } catch (CoreException e) {
    if (TypeHierarchy.DEBUG) {
      e.printStackTrace();
    }
    return null;
  }
  this.infoToHandle.put(info, handle);
  return info;
}
  /**

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) {
  if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case

  ClassFileReader reader = null;
  try {
    reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName)));
  } catch (CoreException e) {
    return null;
  } catch (ClassFormatException e) {
    return null;
  } catch (IOException e) {
    return null;
  }
  if (reader != null) {
    if (this.accessRuleSet == null)
      return new NameEnvironmentAnswer(reader, null);
    String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length);
    return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray()));
  }
  return null;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) {
  if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case

  ClassFileReader reader = null;
  try {
    reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName)));
  } catch (CoreException e) {
    return null;
  } catch (ClassFormatException e) {
    return null;
  } catch (IOException e) {
    return null;
  }
  if (reader != null) {
    if (this.accessRuleSet == null)
      return new NameEnvironmentAnswer(reader, null);
    String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length);
    return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray()));
  }
  return null;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) {
  if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case

  ClassFileReader reader = null;
  try {
    reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName)));
  } catch (CoreException e) {
    return null;
  } catch (ClassFormatException e) {
    return null;
  } catch (IOException e) {
    return null;
  }
  if (reader != null) {
    if (this.accessRuleSet == null)
      return new NameEnvironmentAnswer(reader, null);
    String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length);
    return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray()));
  }
  return null;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

public NameEnvironmentAnswer findClass(String binaryFileName, String qualifiedPackageName, String qualifiedBinaryFileName) {
  if (!doesFileExist(binaryFileName, qualifiedPackageName, qualifiedBinaryFileName)) return null; // most common case

  ClassFileReader reader = null;
  try {
    reader = Util.newClassFileReader(this.binaryFolder.getFile(new Path(qualifiedBinaryFileName)));
  } catch (CoreException e) {
    return null;
  } catch (ClassFormatException e) {
    return null;
  } catch (IOException e) {
    return null;
  }
  if (reader != null) {
    String fileNameWithoutExtension = qualifiedBinaryFileName.substring(0, qualifiedBinaryFileName.length() - SuffixConstants.SUFFIX_CLASS.length);
    if (this.externalAnnotationPath != null) {
      try {
        this.annotationZipFile = reader.setExternalAnnotationProvider(this.externalAnnotationPath, fileNameWithoutExtension, this.annotationZipFile, null);
      } catch (IOException e) {
        // don't let error on annotations fail class reading
      }
    }
    if (this.accessRuleSet == null)
      return new NameEnvironmentAnswer(reader, null);
    return new NameEnvironmentAnswer(reader, this.accessRuleSet.getViolatedRestriction(fileNameWithoutExtension.toCharArray()));
  }
  return null;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

IModule initializeModule() {
  IResource[] members = null;
  try {
    members = this.binaryFolder.members();
    if (members != null) {
      for (int i = 0, l = members.length; i < l; i++) {
        IResource m = members[i];
        String name = m.getName();
        // Note: Look only inside the default package.
        if (m.getType() == IResource.FILE && org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(name)) {
          if (name.equalsIgnoreCase(IModule.MODULE_INFO_CLASS)) {
            try {
              ClassFileReader cfr = Util.newClassFileReader(m);
              return cfr.getModuleDeclaration();
            } catch (ClassFormatException | IOException e) {
              // TODO Java 9 Auto-generated catch block
              e.printStackTrace();
            }
          }
        }
      }
    }
  } catch (CoreException e1) {
    e1.printStackTrace();
  }
  return null;
}
String[] directoryList(String qualifiedPackageName) {

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

IModule initializeModule() {
  IResource[] members = null;
  try {
    members = this.binaryFolder.members();
    if (members != null) {
      for (int i = 0, l = members.length; i < l; i++) {
        IResource m = members[i];
        String name = m.getName();
        // Note: Look only inside the default package.
        if (m.getType() == IResource.FILE && org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(name)) {
          if (name.equalsIgnoreCase(IModule.MODULE_INFO_CLASS)) {
            try {
              ClassFileReader cfr = Util.newClassFileReader(m);
              return cfr.getModuleDeclaration();
            } catch (ClassFormatException | IOException e) {
              // TODO Java 9 Auto-generated catch block
              e.printStackTrace();
            }
          }
        }
      }
    }
  } catch (CoreException e1) {
    e1.printStackTrace();
  }
  return null;
}
String[] directoryList(String qualifiedPackageName) {

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

try {
  if (!root.isArchive())
    return Util.newClassFileReader(((JavaElement) type).resource());

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

try {
  if (!root.isArchive())
    return Util.newClassFileReader(((JavaElement) type).resource());

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

try {
  if (!root.isArchive())
    return Util.newClassFileReader(((JavaElement) type).resource());

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

try {
  if (!root.isArchive())
    return Util.newClassFileReader(((JavaElement) type).resource());

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

try {
  if (!root.isArchive())
    return Util.newClassFileReader(((JavaElement) type).resource());

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

try {
  if (!root.isArchive())
    return Util.newClassFileReader(((JavaElement) type).resource());

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

info = Util.newClassFileReader(resource);

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

info = Util.newClassFileReader(resource);

相关文章

Util类方法