@Override public int compare(CompilationUnitDeclaration o1, CompilationUnitDeclaration o2) { String s1 = new String(o1.getFileName()); String s2 = new String(o2.getFileName()); return s1.compareTo(s2); } }
static CompilationUnit getOrCreateCompilationUnit(CompilationUnitDeclaration compilationUnitDeclaration, Factory factory) { CompilationUnit compilationUnitSpoon = factory.CompilationUnit().getOrCreate(new String(compilationUnitDeclaration.getFileName())); if (compilationUnitSpoon.getLineSeparatorPositions() == null) { compilationUnitSpoon.setLineSeparatorPositions(compilationUnitDeclaration.compilationResult.lineSeparatorPositions); } else if (compilationUnitSpoon.getLineSeparatorPositions() != compilationUnitDeclaration.compilationResult.lineSeparatorPositions) { throw new SpoonException("Unexpected CompilationUnit lineSeparatorPositions"); } return compilationUnitSpoon; }
this.reportProgress(Messages.bind(Messages.compilation_processing, new String(unit.getFileName()))); this.parser.getMethodBodies(unit);
private void forEachCompilationUnit(List<CompilationUnitDeclaration> unitList, SpoonProgress.Process process, Consumer<CompilationUnitDeclaration> consumer) { if (getEnvironment().getSpoonProgress() != null) { getEnvironment().getSpoonProgress().start(process); } int i = 0; for (CompilationUnitDeclaration unit : unitList) { if (unit.isModuleInfo() || !unit.isEmpty()) { final String unitPath = new String(unit.getFileName()); if (canProcessCompilationUnit(unitPath)) { consumer.accept(unit); } if (getEnvironment().getSpoonProgress() != null) { getEnvironment().getSpoonProgress().step(process, unitPath, ++i, unitList.size()); } } } if (getEnvironment().getSpoonProgress() != null) { getEnvironment().getSpoonProgress().end(process); } }
@Override public String toString() { return "--- CompilationUnit Scope : " + new String(this.referenceContext.getFileName()); //$NON-NLS-1$ } private ReferenceBinding typeToRecord(TypeBinding type) {
public void publicClassMustMatchFileName(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.PublicClassMustMatchFileName, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void rawMemberTypeCannotBeParameterized(ASTNode location, ReferenceBinding type, TypeBinding[] argumentTypes) {
public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.TypeCollidesWithPackage, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void typeHiding(TypeDeclaration typeDecl, TypeBinding hiddenType) {
public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.TypeCollidesWithPackage, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void typeHiding(TypeDeclaration typeDecl, TypeBinding hiddenType) {
public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.TypeCollidesWithPackage, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void typeHiding(TypeDeclaration typeDecl, TypeBinding hiddenType) {
public void duplicateTypes(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit this.handle( IProblem.DuplicateTypes, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void emptyControlFlowStatement(int sourceStart, int sourceEnd) {
public void publicClassMustMatchFileName(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.PublicClassMustMatchFileName, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void rawMemberTypeCannotBeParameterized(ASTNode location, ReferenceBinding type, TypeBinding[] argumentTypes) {
public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.TypeCollidesWithPackage, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void typeHiding(TypeDeclaration typeDecl, TypeBinding hiddenType) {
public void publicClassMustMatchFileName(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.PublicClassMustMatchFileName, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void rawMemberTypeCannotBeParameterized(ASTNode location, ReferenceBinding type, TypeBinding[] argumentTypes) {
public void publicClassMustMatchFileName(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.PublicClassMustMatchFileName, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void rawMemberTypeCannotBeParameterized(ASTNode location, ReferenceBinding type, TypeBinding[] argumentTypes) {
public void typeCollidesWithPackage(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.TypeCollidesWithPackage, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void typeHiding(TypeDeclaration typeDecl, TypeBinding hiddenType) {
public void publicClassMustMatchFileName(CompilationUnitDeclaration compUnitDecl, TypeDeclaration typeDecl) { this.referenceContext = typeDecl; // report the problem against the type not the entire compilation unit String[] arguments = new String[] {new String(compUnitDecl.getFileName()), new String(typeDecl.name)}; this.handle( IProblem.PublicClassMustMatchFileName, arguments, arguments, typeDecl.sourceStart, typeDecl.sourceEnd, compUnitDecl.compilationResult); } public void rawMemberTypeCannotBeParameterized(ASTNode location, ReferenceBinding type, TypeBinding[] argumentTypes) {
@Override public String getElementName() { if (m_fileName == null) { char[] array = m_astNode.getFileName(); int i = Math.max(CharOperation.lastIndexOf('/', array), CharOperation.lastIndexOf('\\', array)); m_fileName = i >= 0 ? new String(array, i + 1, array.length - i - 1) : new String(array); } return m_fileName; }
public SourceTypeBinding(char[][] compoundName, PackageBinding fPackage, ClassScope scope) { this.compoundName = compoundName; this.fPackage = fPackage; this.fileName = scope.referenceCompilationUnit().getFileName(); this.modifiers = scope.referenceContext.modifiers; this.sourceName = scope.referenceContext.name; this.scope = scope; // expect the fields & methods to be initialized correctly later this.fields = Binding.UNINITIALIZED_FIELDS; this.methods = Binding.UNINITIALIZED_METHODS; computeId(); }
public CudInfo(CompilationUnitDeclaration cud) { fileName = intern(cud.getFileName()); separatorPositions = cud.compilationResult().getLineSeparatorPositions(); scope = cud.scope; } }
jdtCompiler.getEnvironment().getSpoonProgress().step(SpoonProgress.Process.COMMENT, new String(unit.getFileName()), i + 1, result.length);