Bug 342757 - ArrayIndexOutOfBoundsException in MethodInfoWithParameterAnnotations.getParameterAnnotations when generating method info for an inner class constructor with annotated parameter
Summary: ArrayIndexOutOfBoundsException in MethodInfoWithParameterAnnotations.getParam...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 343947 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-04-13 15:47 EDT by Slava Kabanovich CLA
Modified: 2011-06-21 12:06 EDT (History)
4 users (show)

See Also:


Attachments
ArrayIndexOutOfBoundsException (8.05 KB, application/octet-stream)
2011-04-13 15:50 EDT, Slava Kabanovich CLA
no flags Details
Proposed fix + regression test (11.08 KB, patch)
2011-04-13 21:40 EDT, Olivier Thomann CLA
no flags Details | Diff
Proposed fix + regression test (56.56 KB, patch)
2011-04-14 10:57 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Slava Kabanovich CLA 2011-04-13 15:47:34 EDT
Build Identifier: I20110310-1119

If a class file in jar is an inner Java type with constructor that has annotated parameters, ArrayIndexOutOfBoundsException is thrown when IType is accessed, for instance when user tries to open that element of jar in Class File Editor.

Reproducible: Always

Steps to Reproduce:
1. Create a Java project with one java source
package test;

public class A {	
	class B {
		public B(@Deprecated String s) {
		}
	}
}
.
2. Build that project and export it into a.jar file.
3. Create another Java project and add a.jar file as an external jar.
4. Expand Referenced Libraries -> a.jar -> test -> A.class and try to open it in Class File Editor.
5. Error logged with ArrayIndexOutOfBoundsException
Comment 1 Slava Kabanovich CLA 2011-04-13 15:50:36 EDT
Created attachment 193190 [details]
ArrayIndexOutOfBoundsException
Comment 2 Olivier Thomann CLA 2011-04-13 21:40:22 EDT
Created attachment 193211 [details]
Proposed fix + regression test
Comment 3 Olivier Thomann CLA 2011-04-14 09:39:30 EDT
This patch is not good as it uses the Signature class inside compiler code.
Will try to find another way to get the parameter count.
Comment 4 Olivier Thomann CLA 2011-04-14 10:57:58 EDT
Created attachment 193263 [details]
Proposed fix + regression test

I moved the signature scanning code in the Util class of the compiler. I left one method inside the model Util class as it is used inside the jdt.debug code.
Comment 5 Olivier Thomann CLA 2011-04-14 13:23:34 EDT
Released for 3.7M7.
Comment 6 Jay Arthanareeswaran CLA 2011-04-26 08:43:21 EDT
Verified for 3.7M7 using build I20110421-1800
Comment 7 Olivier Thomann CLA 2011-06-21 12:06:15 EDT
*** Bug 343947 has been marked as a duplicate of this bug. ***