private static ModifierTree getFirstBadlyOrdered(ModifiersTree modifiersTree) { ListIterator<ModifierTree> modifiersIterator = modifiersTree.listIterator(); skipAnnotations(modifiersIterator); Modifier[] modifiers = Modifier.values(); int modifierIndex = 0; while (modifiersIterator.hasNext()){ ModifierTree modifier = modifiersIterator.next(); if (modifier.is(Kind.ANNOTATION)) { break; } ModifierKeywordTree mkt = (ModifierKeywordTree) modifier; for (; modifierIndex < modifiers.length && !mkt.modifier().equals(modifiers[modifierIndex]); modifierIndex++) { // We're just interested in the final value of modifierIndex } if (modifierIndex == modifiers.length) { return modifier; } } return testOnlyAnnotationsAreLeft(modifiersIterator); }
private static ModifierTree getFirstBadlyOrdered(ModifiersTree modifiersTree) { int modifierIndex = -1; Modifier[] modifiers = Modifier.values(); for (ModifierTree modifier : modifiersTree) { if (modifier.is(Kind.ANNOTATION)) { if (modifierIndex >= 0) { return modifier; } } else { if (modifierIndex < 0) { modifierIndex = 0; } ModifierKeywordTree mkt = (ModifierKeywordTree) modifier; for (; modifierIndex < modifiers.length && !mkt.modifier().equals(modifiers[modifierIndex]); modifierIndex++) { // We're just interested in the final value of modifierIndex } if (modifierIndex == modifiers.length) { return modifier; } } } return null; } }
private static ModifierTree getFirstBadlyOrdered(ModifiersTree modifiersTree) { ListIterator<ModifierTree> modifiersIterator = modifiersTree.listIterator(); skipAnnotations(modifiersIterator); Modifier[] modifiers = Modifier.values(); int modifierIndex = 0; while (modifiersIterator.hasNext()){ ModifierTree modifier = modifiersIterator.next(); if (modifier.is(Kind.ANNOTATION)) { break; } ModifierKeywordTree mkt = (ModifierKeywordTree) modifier; for (; modifierIndex < modifiers.length && !mkt.modifier().equals(modifiers[modifierIndex]); modifierIndex++) { // We're just interested in the final value of modifierIndex } if (modifierIndex == modifiers.length) { return modifier; } } return testOnlyAnnotationsAreLeft(modifiersIterator); }