View | Details | Raw Unified | Return to bug 71460 | Differences between
and this patch

Collapse All | Expand All

(-)Util.java (-23 / +4 lines)
Lines 436-470 Link Here
436
		return false;
436
		return false;
437
	}			
437
	}			
438
	/**
438
	/**
439
	 * Returns true iff str.toLowerCase().endsWith(".java")
439
	 * Returns true if name ends with one of the known java like extesnion
440
	 * implementation is not creating extra strings.
441
	 */
440
	 */
442
	public final static boolean isJavaFileName(char[] name) {
441
	public final static boolean isJavaFileName(char[] name) {
443
		int nameLength = name == null ? 0 : name.length;
442
		return org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(name);
444
		int suffixLength = SUFFIX_JAVA.length;
445
		if (nameLength < suffixLength) return false;
446
447
		for (int i = 0, offset = nameLength - suffixLength; i < suffixLength; i++) {
448
			char c = name[offset + i];
449
			if (c != SUFFIX_java[i] && c != SUFFIX_JAVA[i]) return false;
450
		}
451
		return true;		
452
	}
443
	}
453
	/**
444
	/**
454
	 * Returns true iff str.toLowerCase().endsWith(".java")
445
	 * Returns true if name ends with one of the known java like extesnion
455
	 * implementation is not creating extra strings.
456
	 */
446
	 */
457
	public final static boolean isJavaFileName(String name) {
447
	public final static boolean isJavaFileName(String name) {
458
		int nameLength = name == null ? 0 : name.length();
448
		return org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(name);
459
		int suffixLength = SUFFIX_JAVA.length;
460
		if (nameLength < suffixLength) return false;
461
462
		for (int i = 0; i < suffixLength; i++) {
463
			char c = name.charAt(nameLength - i - 1);
464
			int suffixIndex = suffixLength - i - 1;
465
			if (c != SUFFIX_java[suffixIndex] && c != SUFFIX_JAVA[suffixIndex]) return false;
466
		}
467
		return true;		
468
	}
449
	}
469
	/**
450
	/**
470
	 * Creates a NLS catalog for the given locale.
451
	 * Creates a NLS catalog for the given locale.

Return to bug 71460