Package org.eclipse.jdt.internal.compiler.classfmt

Examples of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader


                }
            }

            private NameEnvironmentAnswer createNameEnvironmentAnswer(final String pClazzName, final byte[] clazzBytes) throws ClassFormatException {               
                final char[] fileName = pClazzName.toCharArray();
                final ClassFileReader classFileReader = new ClassFileReader(clazzBytes, fileName, true);
                return new NameEnvironmentAnswer(classFileReader, null);
            }

            private boolean isSourceAvailable(final String pClazzName, final ResourceReader pReader) {
                // FIXME: this should not be tied to the extension
View Full Code Here


                                baos.write(buf, 0, count);
                            }
                            baos.flush();
                            classBytes = baos.toByteArray();
                            char[] fileName = className.toCharArray();
                            ClassFileReader classFileReader =
                                new ClassFileReader(classBytes, fileName,
                                                    true);
                            return
                                new NameEnvironmentAnswer(classFileReader, null);
                        }
                    } catch (IOException exc) {
View Full Code Here

  }

  NameEnvironmentAnswer getNameEnvironmentAnswer() {
    if (nameEnvironmentAnswer == null) {
      try {
        ClassFileReader cfr = new ClassFileReader(getBytes(),
            unit.getDisplayLocation().toCharArray(), true);
        nameEnvironmentAnswer = new NameEnvironmentAnswer(cfr, null);
      } catch (ClassFormatException e) {
        throw new RuntimeException("Unexpectedly unable to parse class file", e);
      }
View Full Code Here

      try {
        URL resource = getClassLoader().getResource(binaryName + ".class");
        if (resource != null) {
          InputStream openStream = resource.openStream();
          try {
            ClassFileReader cfr = ClassFileReader.read(openStream,
                resource.toExternalForm(), true);
            return new NameEnvironmentAnswer(cfr, null);
          } finally {
            Utility.close(openStream);
          }
View Full Code Here

           * insensitive so we need to use Class.forName to effectively verify
           * the case.
           */
          if (isBinaryType(classLoader, className)) {
            byte[] classBytes = Util.readURLAsBytes(resourceURL);
            ClassFileReader cfr;
            try {
              cfr = new ClassFileReader(classBytes, null);
              return new NameEnvironmentAnswer(cfr, null);
            } catch (ClassFormatException e) {
              // Ignored.
            }
          }
View Full Code Here

                                baos.write(buf, 0, count);
                            }
                            baos.flush();
                            classBytes = baos.toByteArray();
                            char[] fileName = className.toCharArray();
                            ClassFileReader classFileReader =
                                new ClassFileReader(classBytes, fileName,
                                                    true);
                            return
                                new NameEnvironmentAnswer(classFileReader);
                        }
                    } catch (IOException exc) {
View Full Code Here

    ClassFile[] classFiles = this.installedVars.classFiles;
    for (int i = 0; i < classFiles.length; i++) {
      ClassFile classFile = classFiles[i];
      IBinaryType binary = null;
      try {
        binary = new ClassFileReader(classFile.getBytes(), null);
      } catch (ClassFormatException e) {
        e.printStackTrace(); // Should never happen since we compiled this type
      }
      engine.lookupEnvironment.cacheBinaryType(binary, null /*no access restriction*/);
    }
 
View Full Code Here

          // find the type declaration that corresponds to the original source type
          typeDeclaration = new ASTNodeFinder(parsedUnit).findType(context);
        }
      } else { // binary type
        ClassFile classFile = (ClassFile) context.getClassFile();
        ClassFileReader reader = (ClassFileReader) classFile.getBinaryTypeInfo((IFile) classFile.resource(), false/*don't fully initialize so as to keep constant pool (used below)*/);
        CompilationResult result = new CompilationResult(reader.getFileName(), 1, 1, this.compilerOptions.maxProblemsPerUnit);
        parsedUnit = new CompilationUnitDeclaration(this.parser.problemReporter(), result, 0);
        HashSetOfCharArrayArray typeNames = new HashSetOfCharArrayArray();

        BinaryTypeConverter converter = new BinaryTypeConverter(this.parser.problemReporter(), result, typeNames);
        typeDeclaration = converter.buildTypeDeclaration(context, parsedUnit);
View Full Code Here

  Argument[] arguments = method.arguments;
  int argCount = arguments == null ? 0 : arguments.length;
  if (type.isBinary()) {
    // don't cache the methods of the binary type
    // fall thru if its a constructor with a synthetic argument... find it the slower way
    ClassFileReader reader = classFileReader(type);
    if (reader != null) {
      // build arguments names
      boolean firstIsSynthetic = false;
      if (reader.isMember() && method.isConstructor() && !Flags.isStatic(reader.getModifiers())) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=48261
        firstIsSynthetic = true;
        argCount++;
      }
      char[][] argumentTypeNames = new char[argCount][];
      for (int i = 0; i < argCount; i++) {
View Full Code Here

}
/*
* Create binary method handle
*/
IMethod createBinaryMethodHandle(IType type, char[] methodSelector, char[][] argumentTypeNames) {
  ClassFileReader reader = MatchLocator.classFileReader(type);
  if (reader != null) {
    IBinaryMethod[] methods = reader.getMethods();
    if (methods != null) {
      int argCount = argumentTypeNames == null ? 0 : argumentTypeNames.length;
      nextMethod : for (int i = 0, methodsLength = methods.length; i < methodsLength; i++) {
        IBinaryMethod binaryMethod = methods[i];
        char[] selector = binaryMethod.isConstructor() ? type.getElementName().toCharArray() : binaryMethod.getSelector();
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader

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.