javaandroidaide-ide

The '>' operator can not be applied to instances of type 'int' and 'int'


I am getting the error in the title when I try and compile the below code as part of an app in AIDE. The code below is from Apache WordUtils (I don't want to import a whole library for a single thing), but I also get the error in other code. It used to work fine, but I then updated AIDE, and it stopped working. It has no suggestions in the "Fix" option (not even "Delete"), and seems to happens with all my for loops. I get the error with both < and >, but not ==.

I know there is already a similar question here, but it did not have any accepted answers, and the suggested solutions did not work for me.

I have tried refreshing the build, removing the spaces, and defining variables outside the loops. However, none of those have worked. I have also tried reinstalling AIDE, and reverting to an older version, but the code will not work.

Problematic code:

public static String capitalize(String str, char[] delimiters) {
    int delimLen = (delimiters == null ? -1 : delimiters.length);
    if (str == null || str.length() == 0 || delimLen == 0) {
        return str;
    }
    int strLen = str.length();
    StringBuffer buffer = new StringBuffer(strLen);
    boolean capitalizeNext = true;
    for (int i = 0; i < strLen; i++) {
        char ch = str.charAt(i);

        if (isDelimiter(ch, delimiters)) {
            buffer.append(Character.toLowerCase(ch));
            capitalizeNext = true;
        } else if (capitalizeNext) {
            buffer.append(Character.toTitleCase(ch));
            capitalizeNext = false;
        } else {
            buffer.append(ch);
        }
    }
    return buffer.toString();
}
private static boolean isDelimiter(char ch, char[] delimiters) {
    if (delimiters == null) {
        return Character.isWhitespace(ch);
    }
    for (int i = 0, isize = delimiters.length; i < isize; i++) {
        if (ch == delimiters[i]) {
            return true;
        }
    }
    return false;
}

Solution

  • I eventually figured it out. What I did was uninstall AIDE, delete the entire "/sdcard/.aide" directory, and delete the "build" folder in the project, along with a .gitignore file that was there for some reason. It seems like I needed to do all of them at once, because none worked on their own.