/** * Compute the children of this package fragment. Children of jar package fragments * can only be IClassFile (representing .class files). */ private IJavaElement[] computeChildren(ArrayList namesWithoutExtension) { int size = namesWithoutExtension.size(); if (size == 0) return NO_ELEMENTS; IJavaElement[] children = new IJavaElement[size]; for (int i = 0; i < size; i++) { String nameWithoutExtension = (String) namesWithoutExtension.get(i); children[i] = new ClassFile(this, nameWithoutExtension); } return children; } /**
/** * Compute the children of this package fragment. Children of jar package fragments * can only be IClassFile (representing .class files). */ private IJavaElement[] computeChildren(ArrayList namesWithoutExtension) { int size = namesWithoutExtension.size(); if (size == 0) return NO_ELEMENTS; IJavaElement[] children = new IJavaElement[size]; for (int i = 0; i < size; i++) { String nameWithoutExtension = (String) namesWithoutExtension.get(i); children[i] = new ClassFile(this, nameWithoutExtension); } return children; } /**
/** * Compute the children of this package fragment. Children of jar package fragments * can only be IClassFile (representing .class files). */ private IJavaElement[] computeChildren(ArrayList namesWithoutExtension) { int size = namesWithoutExtension.size(); if (size == 0) return NO_ELEMENTS; IJavaElement[] children = new IJavaElement[size]; for (int i = 0; i < size; i++) { String nameWithoutExtension = (String) namesWithoutExtension.get(i); children[i] = new ClassFile(this, nameWithoutExtension); } return children; } /**
/** * Compute the children of this package fragment. Children of jar package fragments * can only be IClassFile (representing .class files). */ private IJavaElement[] computeChildren(ArrayList namesWithoutExtension) { int size = namesWithoutExtension.size(); if (size == 0) return NO_ELEMENTS; IJavaElement[] children = new IJavaElement[size]; for (int i = 0; i < size; i++) { String nameWithoutExtension = (String) namesWithoutExtension.get(i); children[i] = new ClassFile(this, nameWithoutExtension); } return children; } /**
/** * Compute the children of this package fragment. Children of jar package fragments * can only be IClassFile (representing .class files). */ private IJavaElement[] computeChildren(ArrayList namesWithoutExtension) { int size = namesWithoutExtension.size(); if (size == 0) return NO_ELEMENTS; IJavaElement[] children = new IJavaElement[size]; for (int i = 0; i < size; i++) { String nameWithoutExtension = (String) namesWithoutExtension.get(i); if (TypeConstants.MODULE_INFO_NAME_STRING.equals(nameWithoutExtension)) children[i] = new ModularClassFile(this); else children[i] = new ClassFile(this, nameWithoutExtension); } return children; } /**
/** * Compute the children of this package fragment. Children of jar package fragments * can only be IClassFile (representing .class files). */ private IJavaElement[] computeChildren(ArrayList namesWithoutExtension) { int size = namesWithoutExtension.size(); if (size == 0) return NO_ELEMENTS; IJavaElement[] children = new IJavaElement[size]; for (int i = 0; i < size; i++) { String nameWithoutExtension = (String) namesWithoutExtension.get(i); if (TypeConstants.MODULE_INFO_NAME_STRING.equals(nameWithoutExtension)) children[i] = new ModularClassFile(this); else children[i] = new ClassFile(this, nameWithoutExtension); } return children; } /**
/** * @see IPackageFragment#getClassFile(String) * @exception IllegalArgumentException if the name does not end with ".class" */ public IClassFile getClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName)); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary int length = classFileName.length() - 6; char[] nameWithoutExtension = new char[length]; classFileName.getChars(0, length, nameWithoutExtension, 0); return new ClassFile(this, new String(nameWithoutExtension)); } /**
/** * @see IPackageFragment#getClassFile(String) * @exception IllegalArgumentException if the name does not end with ".class" */ public IClassFile getClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName)); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary int length = classFileName.length() - 6; char[] nameWithoutExtension = new char[length]; classFileName.getChars(0, length, nameWithoutExtension, 0); return new ClassFile(this, new String(nameWithoutExtension)); } /**
/** * @see IPackageFragment#getClassFile(String) * @exception IllegalArgumentException if the name does not end with ".class" */ public IClassFile getClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName)); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary int length = classFileName.length() - 6; char[] nameWithoutExtension = new char[length]; classFileName.getChars(0, length, nameWithoutExtension, 0); return new ClassFile(this, new String(nameWithoutExtension)); } /**
/** * @see IPackageFragment#getClassFile(String) * @exception IllegalArgumentException if the name does not end with ".class" */ public IClassFile getClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName)); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary int length = classFileName.length() - 6; char[] nameWithoutExtension = new char[length]; classFileName.getChars(0, length, nameWithoutExtension, 0); return new ClassFile(this, new String(nameWithoutExtension)); } /**
/** * @see IPackageFragment#getOrdinaryClassFile(String) * @exception IllegalArgumentException if the name does not end with ".class" or if the name is "module-info.class". */ @Override public IOrdinaryClassFile getOrdinaryClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName)); } if (TypeConstants.MODULE_INFO_CLASS_NAME_STRING.equals(classFileName)) { throw new IllegalArgumentException(Messages.element_moduleInfoNotSupported); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary int length = classFileName.length() - 6; char[] nameWithoutExtension = new char[length]; classFileName.getChars(0, length, nameWithoutExtension, 0); return new ClassFile(this, new String(nameWithoutExtension)); } /**
/** * @see IPackageFragment#getOrdinaryClassFile(String) * @exception IllegalArgumentException if the name does not end with ".class" or if the name is "module-info.class". */ @Override public IOrdinaryClassFile getOrdinaryClassFile(String classFileName) { if (!org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(classFileName)) { throw new IllegalArgumentException(Messages.bind(Messages.element_invalidClassFileName, classFileName)); } if (TypeConstants.MODULE_INFO_CLASS_NAME_STRING.equals(classFileName)) { throw new IllegalArgumentException(Messages.element_moduleInfoNotSupported); } // don't hold on the .class file extension to save memory // also make sure to not use substring as the resulting String may hold on the underlying char[] which might be much bigger than necessary int length = classFileName.length() - 6; char[] nameWithoutExtension = new char[length]; classFileName.getChars(0, length, nameWithoutExtension, 0); return new ClassFile(this, new String(nameWithoutExtension)); } /**
/** * Returns the type with the given <code>typeName</code>. Returns inner classes * as well. */ protected IType getType(String typeName) { if (typeName.length() == 0) { IJavaElement classFile = this.binaryType.getParent(); String classFileName = classFile.getElementName(); StringBuffer newClassFileName = new StringBuffer(); int lastDollar = classFileName.lastIndexOf('$'); for (int i = 0; i <= lastDollar; i++) newClassFileName.append(classFileName.charAt(i)); newClassFileName.append(Integer.toString(this.anonymousCounter)); PackageFragment pkg = (PackageFragment) classFile.getParent(); return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName); } else if (this.binaryType.getElementName().equals(typeName)) return this.binaryType; else return this.binaryType.getType(typeName); }
/** * Returns the type with the given <code>typeName</code>. Returns inner classes * as well. */ protected IType getType(String typeName) { if (typeName.length() == 0) { IJavaElement classFile = this.binaryType.getParent(); String classFileName = classFile.getElementName(); StringBuffer newClassFileName = new StringBuffer(); int lastDollar = classFileName.lastIndexOf('$'); for (int i = 0; i <= lastDollar; i++) newClassFileName.append(classFileName.charAt(i)); newClassFileName.append(Integer.toString(this.anonymousCounter)); PackageFragment pkg = (PackageFragment) classFile.getParent(); return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName); } else if (this.binaryType.getElementName().equals(typeName)) return this.binaryType; else return ((this.typeDepth <= 1) ? this.binaryType : this.types[this.typeDepth - 1]).getType(typeName); }
/** * Returns the type with the given <code>typeName</code>. Returns inner classes * as well. */ protected IType getType(String typeName) { if (typeName.length() == 0) { IJavaElement classFile = this.binaryType.getParent(); String classFileName = classFile.getElementName(); StringBuffer newClassFileName = new StringBuffer(); int lastDollar = classFileName.lastIndexOf('$'); for (int i = 0; i <= lastDollar; i++) newClassFileName.append(classFileName.charAt(i)); newClassFileName.append(Integer.toString(this.anonymousCounter)); PackageFragment pkg = (PackageFragment) classFile.getParent(); return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName); } else if (this.binaryType.getElementName().equals(typeName)) return this.binaryType; else return this.binaryType.getType(typeName); }
/** * Returns the type with the given <code>typeName</code>. Returns inner classes * as well. */ protected IType getType(String typeName) { if (typeName.length() == 0) { IJavaElement classFile = this.binaryType.getParent(); String classFileName = classFile.getElementName(); StringBuffer newClassFileName = new StringBuffer(); int lastDollar = classFileName.lastIndexOf('$'); for (int i = 0; i <= lastDollar; i++) newClassFileName.append(classFileName.charAt(i)); newClassFileName.append(Integer.toString(this.anonymousCounter)); PackageFragment pkg = (PackageFragment) classFile.getParent(); return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName); } else if (this.binaryType.getElementName().equals(typeName)) return this.binaryType; else return this.binaryType.getType(typeName); }
/** * Returns the type with the given <code>typeName</code>. Returns inner classes * as well. */ protected IType getType(String typeName) { if (!(this.binaryTypeOrModule instanceof IType)) return null; IType type = (IType) this.binaryTypeOrModule; if (typeName.length() == 0) { IJavaElement classFile = type.getParent(); String classFileName = classFile.getElementName(); StringBuffer newClassFileName = new StringBuffer(); int lastDollar = classFileName.lastIndexOf('$'); for (int i = 0; i <= lastDollar; i++) newClassFileName.append(classFileName.charAt(i)); newClassFileName.append(Integer.toString(this.anonymousCounter)); PackageFragment pkg = (PackageFragment) classFile.getParent(); return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName); } else if (type.getElementName().equals(typeName)) return type; else return ((this.typeDepth <= 1) ? type : this.types[this.typeDepth - 1]).getType(typeName); }
/** * Returns the type with the given <code>typeName</code>. Returns inner classes * as well. */ protected IType getType(String typeName) { if (!(this.binaryTypeOrModule instanceof IType)) return null; IType type = (IType) this.binaryTypeOrModule; if (typeName.length() == 0) { IJavaElement classFile = type.getParent(); String classFileName = classFile.getElementName(); StringBuffer newClassFileName = new StringBuffer(); int lastDollar = classFileName.lastIndexOf('$'); for (int i = 0; i <= lastDollar; i++) newClassFileName.append(classFileName.charAt(i)); newClassFileName.append(Integer.toString(this.anonymousCounter)); PackageFragment pkg = (PackageFragment) classFile.getParent(); return new BinaryType(new ClassFile(pkg, newClassFileName.toString()), typeName); } else if (type.getElementName().equals(typeName)) return type; else return ((this.typeDepth <= 1) ? type : this.types[this.typeDepth - 1]).getType(typeName); }
ClassFile classFile = new ClassFile((PackageFragment) pkg, name); if (classFile.existsUsingJarTypeCache()) { IType type = classFile.getType();
ClassFile classFile = new ClassFile((PackageFragment) pkg, name); if (classFile.existsUsingJarTypeCache()) { IType type = classFile.getType();