Skip to content

Warning message when using -AresolveReflection #430

@GoogleCodeExporter

Description

@GoogleCodeExporter
Here's a small example:

class Test {

    boolean test(@Nullable String str) {
        if (str == null) {
            return false;
        }
        int index = str.indexOf(' ');
        String className = index == -1 ? str : str.substring(0, index);
        return className.equals("X");
    }
}

Generates this warning message:

Test.java:10: warning: [method.evaluation.exception] Failed to evaluate method 
public java.lang.String java.lang.String.substring(int,int) because it threw an 
exception: java.lang.StringIndexOutOfBoundsException: String index out of 
range: -1. Treating result as @UnknownVal
        String className = index == -1 ? str : str.substring(0, index);
                                                            ^

It seems harmless as far I can tell so far.

Original issue reported on code.google.com by trask.st...@gmail.com on 19 Apr 2015 at 7:22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions