View | Details | Raw Unified | Return to bug 260840
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/InternalNamingConventions.java (-8 / +42 lines)
Lines 625-634 Link Here
625
							tempName[length+1] = 'S';
625
							tempName[length+1] = 'S';
626
						}
626
						}
627
					} else if(tempName[length-1] == 'Y') {
627
					} else if(tempName[length-1] == 'Y') {
628
						System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length);
628
						boolean precededByAVowel = false;
629
						tempName[length-1] = 'I';
629
						if(tempName.length > 1) {
630
						tempName[length] = 'E';
630
							switch (tempName[length-2]) {
631
						tempName[length+1] = 'S';
631
								case 'A':
632
								case 'E':
633
								case 'I':
634
								case 'O':
635
								case 'U':
636
									precededByAVowel = true;
637
									break;
638
							}
639
						}
640
						if (precededByAVowel) {
641
							System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length);
642
							tempName[length] = 'S';
643
						} else {
644
							System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length);
645
							tempName[length-1] = 'I';
646
							tempName[length] = 'E';
647
							tempName[length+1] = 'S';
648
						}
632
					} else {
649
					} else {
633
						System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length);
650
						System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length);
634
						tempName[length] = 'S';
651
						tempName[length] = 'S';
Lines 641-650 Link Here
641
							tempName[length+1] = 's';
658
							tempName[length+1] = 's';
642
						}
659
						}
643
					} else if(tempName[length-1] == 'y') {
660
					} else if(tempName[length-1] == 'y') {
644
						System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length);
661
						boolean precededByAVowel = false;
645
						tempName[length-1] = 'i';
662
						if(tempName.length > 1) {
646
						tempName[length] = 'e';
663
							switch (tempName[length-2]) {
647
						tempName[length+1] = 's';
664
								case 'a':
665
								case 'e':
666
								case 'i':
667
								case 'o':
668
								case 'u':
669
									precededByAVowel = true;
670
									break;
671
							}
672
						}
673
						if (precededByAVowel) {
674
							System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length);
675
							tempName[length] = 's';
676
						} else {
677
							System.arraycopy(tempName, 0, tempName = new char[length + 2], 0, length);
678
							tempName[length-1] = 'i';
679
							tempName[length] = 'e';
680
							tempName[length+1] = 's';
681
						}
648
					} else {
682
					} else {
649
						System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length);
683
						System.arraycopy(tempName, 0, tempName = new char[length + 1], 0, length);
650
						tempName[length] = 's';
684
						tempName[length] = 's';
(-)src/org/eclipse/jdt/core/tests/model/NamingConventionTests.java (+34 lines)
Lines 860-865 Link Here
860
		"INT", //$NON-NLS-1$
860
		"INT", //$NON-NLS-1$
861
		toString(suggestions));
861
		toString(suggestions));
862
}
862
}
863
/*
864
 * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=260840
865
 */
866
public void testSuggestFieldName041() {
867
	String[] suggestions = NamingConventions.suggestVariableNames(
868
			NamingConventions.VK_INSTANCE_FIELD,
869
			NamingConventions.BK_TYPE_NAME,
870
			"Key", //$NON-NLS-1$
871
			this.project,
872
			1,
873
			new String[]{},
874
			true);
875
	
876
	assumeEquals(
877
		"keys", //$NON-NLS-1$
878
		toString(suggestions));
879
}
880
/*
881
 * bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=260840
882
 */
883
public void testSuggestFieldName042() {
884
	String[] suggestions = NamingConventions.suggestVariableNames(
885
			NamingConventions.VK_STATIC_FINAL_FIELD,
886
			NamingConventions.BK_TYPE_NAME,
887
			"Key", //$NON-NLS-1$
888
			this.project,
889
			1,
890
			new String[]{},
891
			true);
892
	
893
	assumeEquals(
894
		"KEYS", //$NON-NLS-1$
895
		toString(suggestions));
896
}
863
/** @deprecated */
897
/** @deprecated */
864
public void testRemovePrefixAndSuffixForFieldName001() {
898
public void testRemovePrefixAndSuffixForFieldName001() {
865
	Hashtable options = JavaCore.getOptions();
899
	Hashtable options = JavaCore.getOptions();

Return to bug 260840