Community
Participate
Working Groups
calling JdtTypeProvider.findTypeByName with a URI such as java:/Objects/okInteger#okInteger causes java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1937) at org.eclipse.xtext.common.types.access.impl.IndexedJvmTypeAccess.resolveJavaObject(IndexedJvmTypeAccess.java:98) at org.eclipse.xtext.common.types.access.impl.IndexedJvmTypeAccess.getIndexedJvmType(IndexedJvmTypeAccess.java:59) at org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.findTypeByName(JdtTypeProvider.java:85)
The fix should be synchronous to org.eclipse.xtext.common.types.access.impl.AbstractClassMirror... however, AbstractClassMirror seems to assume that the JvmType is always in resource.getContents().get(0). This isn't true for JvmTypes created by a JvmModelInferrer. There, resource.getContents().get(0) is the "original" models and JvmTYpes are at resource.getContents().get(n) with n in [1..n]
The latest code in the repository already has an explicit check for this exception. Furthermore, as it turn out, the original cause for this exception was bogus contents of the xtext index so that org.eclipse.xtext.common.types.access.impl.IndexedJvmTypeAccess.resolveJavaObject(JvmType, String) was called this the wrong JvmType. I'm closing this one as invalid until other evidence shows up.