Community
Participate
Working Groups
Hi, I'd like to have access to declarations of referenced types in methods. Consequently after reading the docs, I wrote next piece of code: final SearchEngine searchEngine = new SearchEngine(); final RequiredTypesRequestor searchRequestor = new RequiredTypesRequestor( ... ); try { searchEngine.searchDeclarationsOfReferencedTypes( method, searchRequestor, monitor ); } catch ( JavaModelException except ) { // logging } Unfortunately I receive the exception below when the method is a binary method encapsulated into a jar [but it also occurs with any other java element packaged into that jar]. Jar with which I carefully attached a source code. java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(Unknown Source) at java.lang.String.substring(Unknown Source) at org.eclipse.jdt.internal.core.util.HandleFactory.createOpenable(HandleFactory.java:134) at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1159) at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchDeclarations(BasicSearchEngine.java:1108) at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchDeclarationsOfReferencedTypes(BasicSearchEngine.java:1161) at org.eclipse.jdt.core.search.SearchEngine.searchDeclarationsOfReferencedTypes(SearchEngine.java:896) ... I work with Eclipse 3.2RC7. Thanks in advance for your help.
Could you please provide a test case? Thanks.
I've already got test case from Emmanuel about this issue and asked him to open a bug... Thanks Olivier
Created attachment 45160 [details] Jar file to reproduce the problem Any of searchDeclarationsOf* method performed on this jar file would throw a JavaModelException...
Created attachment 45161 [details] Proposed patch Tests added on JavaSearchBugsTests use previous attached Jar file put in /JavaSearchBugs/lib folder...
Philippe, I think this is obviously a candidate for 3.2.1, isn't it?
+1 for 3.2.1
Released for 3.2.1 in TARGET_321 branch
Released for 3.3 M1 in HEAD
Verified for 3.3 M1 using build I20060807-0010
Verified for 3.2.1 using build M20060908-1655.