Community
Participate
Working Groups
Urgent! I have a class that makes this call. The object in question is a method object that I got from the Java Code model. the method has the following signature: "private int[][][][][] MethodName(int[][])" It works as expected under Eclipse 2.1. Under 3.X it throws an exception. The watch/inspect features of the code snippet fail also. I am assuming this is not a version incompatibility because it is not highlighted as such by the IDE. Thanks a lot!!
The other method that could have helped me: getSignature() also causes an exception. The only method from org.eclipse.jdt.core.IMethod that has worked so far is getNumberOfParameters()
Could you please provide a complete test case? Or steps to reproduce.
Ok these is the sequence of steps: get Workspace get Project members get Compilation Unit get Methods get individual org.eclipse.jdt.core.IMethod then call getNumberOfParameters() -> Success 2.x and 3.x getReturnType() -> Success 2.x only getSignature() -> Success 2.x only
Any news on this?
Could not reproduce. Here is my test case: public class X { private int[][][][][] MethodName(int[][] tab) { return null; } } I could get the type then the IMethod and retrieve its signature and return type. Signature is: ([[I)[[[[[I Return type is: [[[[[I So please provide a test case.
Olivier: How did you get the IMethod? Did you follow the same steps? Obviously the problem is not on the target method. The problem most likely is on the sequence of steps that provide the IMethod. These are the steps that reproduced the problem. The app being developed is a plugin with an action that extends the Java perspective. 1) get the Workspace. 2) Workspace->getRoot 3) Root->members (PROJECT flag) 4) Process members until it matches the java source file which needs processing. 5) createCompilationU((IFile)member) 6) CompilationUnit->getTypes() 7) IType[X]-> getMethods() 8) IMethod->getReturnType() -> Succeeds in 2.X fails in 3.X There is nothing in the Docs or the IDE highlights that inidicates a change of behavior from 2.x to 3.X on this particular API. HTH
Why are you saying that the problem is not the target method? If you get the IMethod and the call getReturnType() fails, this is where the problem is. Could you please provide the stack trace and a reproducable test case? Thanks.
Olivier: I assumed that tartget method is: public class X { private int[][][][][] MethodName(int[][] tab) { return null; } } This method does not belong to jdt in any shape or form. So using eclipse 2.X or 3.X does not affect the target method. It does NOT belong to Eclipse. I provided you the sequence of steps (as you required at the beginning of the thread) twice, the first time not as specific as the second time. I am going to repeat the second sequence: The app being developed is a plugin with an action that extends the Java perspective. Firing the action will set in motion the following: 1) get the Workspace. 2) Workspace->getRoot 3) Root->members (PROJECT flag) 4) Process members until it matches the java source file which needs processing. 5) createCompilationUnitFrom((IFile)member) 6) CompilationUnit->getTypes() 7) IType[X]-> getMethods() 8) IMethod[Y]->getReturnType() -> Succeeds in 2.X fails in 3.X
Could you please attach your exported plugin? I will give it a try. I saw your steps. If I ask more details, it means that I wasn't able to reproduce the failure using your steps. So could you please provide your plugin (with source attached if possible) and I will try it? My comment 5 shows that it is not that obvious to reproduce the failure.
Obviously, if I have not provided the source code, it's because I can't. I saw your comment 5 and I wanted to confirm that the steps were followed. Any suggestions that I can use from here to clarify the situation?
At least give us the stack trace. For there, I can try to see what is going on. From your steps, I don't understand what is happening in step 8. If you cannot provide source code, can you provide the plugin as a binary plugin?
Reopen when you can provide either the stack trace or the binary plugin.
Olivier: Sorry, giving the binaries is a no go but this is the stack trace: java.lang.IllegalArgumentException at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:1665) at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:1691) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:1629) at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:1691) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:1629) at org.eclipse.jdt.core.Signature.toCharArray(Signature.java:1601) at org.eclipse.jdt.core.Signature.toString(Signature.java:1952) at org.eclipse.jdt.internal.core.SourceMethod.toStringName(SourceMethod.java:298) at org.eclipse.jdt.internal.core.SourceMethod.toStringInfo(SourceMethod.java:275) at org.eclipse.jdt.internal.core.JavaElement.toStringWithAncestors(JavaElement.java:637) at org.eclipse.jdt.internal.core.JavaModelStatus.getMessage(JavaModelStatus.java:194) at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:37) at org.eclipse.jdt.core.JavaModelException.<init>(JavaModelException.java:70) at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:561) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:583) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:309) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:295) at org.eclipse.jdt.internal.core.SourceMethod.getReturnType(SourceMethod.java:166) at JOSE'S Method2(IdePluginAction.java) <- this makes the getReturnType() call at JOSE'S Method1(IdePluginAction.java) at JOSE'S run(IdePluginAction.java) <- required by the Action Extension Point at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:276) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:206) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:915) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:866) at org.eclipse.jface.action.ActionContributionItem$8.handleEvent(ActionContributionItem.java:824) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2772) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2431) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688)
What build are you using?
Olivier: I am using 200409161125. Thanks a lot!
Could you please try to reproduce with a newer build? I cannot retrieve your build anymore. It is pretty old and lots of fixes have been provided in this area. You can try to reproduce with I20041208-1200. Thanks.
Olivier: Tried this build. Same results. Maybe even worse: stack trace is not generated.
Then it is really bad, because I cannot do anything. I cannot retrieve the first build you used. Why is it a problem to get the binary plugin? I won't reverse-engineer it. I simply want to reproduce the issue. I could put breakpoints and debug it, but right now I cannot even get a reproducable test case. Did you look into the .metadata folder? Don't you have a .log file in it?
Closing as REMIND. Reopen when you can provide more details or information to continue the investigation.
Olivier: I manage to get a stack trace with the new code base: java.lang.IllegalArgumentException at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2447) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2357) at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2491) at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2465) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2407) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2357) at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2491) at org.eclipse.jdt.core.Signature.appendArrayTypeSignature(Signature.java:2465) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2407) at org.eclipse.jdt.core.Signature.appendTypeSignature(Signature.java:2357) at org.eclipse.jdt.core.Signature.toCharArray(Signature.java:2336) at org.eclipse.jdt.core.Signature.toString(Signature.java:2755) at org.eclipse.jdt.internal.core.SourceMethod.toStringName(SourceMethod.java:333) at org.eclipse.jdt.internal.core.SourceMethod.toStringName(SourceMethod.java:314) at org.eclipse.jdt.internal.core.SourceMethod.toStringInfo(SourceMethod.java:299) at org.eclipse.jdt.internal.core.JavaElement.toStringWithAncestors(JavaElement.java:612) at org.eclipse.jdt.internal.core.JavaModelStatus.getMessage(JavaModelStatus.java:194) at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:42) at org.eclipse.jdt.core.JavaModelException.<init>(JavaModelException.java:70) at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:527) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:558) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:291) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:277) at org.eclipse.jdt.internal.core.SourceMethod.getReturnType(SourceMethod.java:190) at JOSE'S Method 2(IdePluginAction.java)<- this makes the getReturnType() call at JOSE'S Method 1(IdePluginAction.java) at JOSE'S run(IdePluginAction.java) <- Plugin API requirement. at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:243) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:221) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:460) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:814) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1578) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1549) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:281) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:710) at org.eclipse.core.launcher.Main.main(Main.java:694) In addtion the code base that I originally used is at: http://www.mirror.ac.uk/mirror/download.eclipse.org/eclipse/downloads/drops/R-3.0.1-200409161125/ Binaries and source. Sorry for the inconvenience but I am not allowed to get the binaries out of the door.
Jérôme, this seems to be a case where a Java element is missing and we try to build the exception's message. During the creation of the message, an illegalArgumentException occurs. It is unclear how we got into that state, but we might want to protect the code from failing when the exception is thrown.
Jérôme, As a summary, so you do not have to read the whole thread: *) This problem does NOT happen with 2.X. *) The other method that I could have used as a workaround: getSignature() causes an exception too. It could be that these two methods (getSignature() and getReturnType()) rely on the same java element. The odd thing is that getNumberOfParameters() succeeds on the same IMethod. Could it be that the problem is not the java element per se but its handling of strings? (getNumberOfParameters() returns integers) Hope this helps.
Changed toStringName(StringBuffer, int) in SourceMethod and BinaryMethod to catch the IllegalArgumentException. Added regression test ExistenceTests#testMethodWithInvalidParameter(). jcornado (sorry I'm not sure about your name), please try 3.1 M4 (to be out at the end of the week). getReturnType() should now throw a JavaModelExeception indicating that the method doesn't exist with a more explicit message. From there, please enter a new bug if you consider that the method should exist.
Note that with the fix in, the following passes: createJavaProject("P"); createFile( "P/X.java", "public class X {\n" + " private int[][][][][] MethodName(int[][] tab) {\n" + " return null;\n" + " }\n" + "}" ); IMethod method = getCompilationUnit("P/X.java").getType("X").getMethods()[0]; assertEquals("[[[[[I", method.getReturnType());
Verified for 3.1 M4 using build I200412142000. (ExistenceTests#testMethodWithInvalidParameter() "correctly" fails with 3.1 M3, which means that IAE is now well managed).
Ok guys, is build M3 going to be out today? (I am in Austin, TX for time zone purposes) or next week?
Jérôme: If this is of any help (maybe for future reference): This bug never showed in my Win XP SP2 or RH 9.0 running 2.X. But this week I decided to upgrade the Linux box to Fedora Core 2.0 and managed to reproduce the problem with 2.X too. The same stack trace. José
I am going to try M4 with Windows XP. I just tried M4 running in a Fedora Core 2 box and it still fails. The IMethod object is valid because when I call "getNumberOfParameters" it correctly returns 1. So the underlying object exists and it is properly initialized (not a lazy-initialization problem for the IMethod) I can NOT provide the binaries. I will post the stack trace or close the bug depending on the results from the Win XP SP2 workstation.
Jérôme, The problem occurs also with an officially supported platform (Win XP SP2) I think the problem lies with the way strings are handled. If we look at the following: *) The *.java file compiles successfully. *) getNumberOfParameters succeeds. So at least the method signature has been parsed inside the JDT in some form. *) getReturnType() and getSignature() both return strings. José STACK TRACE: Java Model Exception: Java Model Status [TakeAndReturnMultiIntArray(*** invalid signature: [[int) [in HelloCompaKcto [in [Working copy] HelloCompaKcto.java [in com.efeKctive.demo [in src [in HelloCompaKcto]]]]] does not exist] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:527) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:558) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:291) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:277) at org.eclipse.jdt.internal.core.SourceMethod.getReturnType(SourceMethod.java:190) at JOSE's method 2(IdePluginAction.java) at JOSE's method 1(IdePluginAction.java) at JOSE's run(IdePluginAction.java) ---> Required API at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:244) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:220) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:460) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:710) at org.eclipse.core.launcher.Main.main(Main.java:694) Java Model Exception: Java Model Status [TakeAndReturnMultiIntArray(*** invalid signature: [[int) [in HelloCompaKcto [in [Working copy] HelloCompaKcto.java [in com.efeKctive.demo [in src [in HelloCompaKcto]]]]] does not exist] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:527) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:558) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:291) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:277) at org.eclipse.jdt.internal.core.SourceMethod.getReturnType(SourceMethod.java:190) at JOSE's method 2(IdePluginAction.java) at JOSE's method 1(IdePluginAction.java) at JOSE's run(IdePluginAction.java) ---> Required API at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:244) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:220) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:460) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:710) at org.eclipse.core.launcher.Main.main(Main.java:694) Java Model Exception: Java Model Status [TakeAndReturnMultiIntArray(*** invalid signature: [[int) [in HelloCompaKcto [in [Working copy] HelloCompaKcto.java [in com.efeKctive.demo [in src [in HelloCompaKcto]]]]] does not exist] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:527) at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:558) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:291) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:277) at org.eclipse.jdt.internal.core.SourceMethod.getSignature(SourceMethod.java:197) at JOSE's method 2(IdePluginAction.java) at JOSE's method 1(IdePluginAction.java) at JOSE's run(IdePluginAction.java) ---> Required API at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:244) at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:220) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:555) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:505) at org.eclipse.jface.action.ActionContributionItem$7.handleEvent(ActionContributionItem.java:460) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2803) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2448) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1569) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1540) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:285) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:220) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:710) at org.eclipse.core.launcher.Main.main(Main.java:694)
Jose, how did you obtain the IMethod ? Did you use IType#getMethod(String, String[]) ?
I called IMethod[] getMethods() then worked with each individual method. It happens immediately with the first IMethod of the array.
The "IMethod[] getMethods()" refers to the return type and method name. The complete signature should be: IMethod[] IType.getMethods()
Sorry but I cannot reproduce the problem. I created a compilation unit with the following contents: public class X { private int[][][][][] foo(int[][]) { } } then got the IMethods using IType#getMethods(). When I ask for the return type of the first (and only) method, I get "[[[[[I" as expected. What is the content of the "HelloCompaKcto.java" compilation unit ?
Jérôme: These are the contents of the CU. It is a JFrame with several TabbedPanes that hold most of the AWT and Swing widgets. Plus two methods that take annd return [[i ans [[[[[i Do you know where the problem comes from? File contents: package com.efeKctive.demo; public class SampleCompaKcto extends javax.swing.JFrame { java.lang.String InvocationResult = ""; java.lang.String InvocationResult1 = ""; public SampleCompaKcto() { initComponents(); } private int[][][][][] TakeAndReturnMultiIntArray(int[][][][][] test){ return test; } private int[][] TakeAndReturnTwoIntArray(int[][] test){ return test; } private void jTabbedPane1_StateChanged(javax.swing.event.ChangeEvent evt) { } private void button1_MouseClicked(java.awt.event.MouseEvent evt) { this.InvocationResult = "AWT Button Clicked"; } private void checkbox1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = "AWT Checkbox Checked"; } private void choice1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = evt.getItem().toString(); } private void scrollbar1_AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) { this.InvocationResult = "" + evt.getValue(); } private void list1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = list1_.getSelectedItem(); } private void textField1_KeyTyped(java.awt.event.KeyEvent evt) { this.InvocationResult = textField1_.getText(); } private void textField1_TextValueChanged(java.awt.event.TextEvent evt) { this.InvocationResult = textField1_.getText(); } private void jButton1_MouseClicked(java.awt.event.MouseEvent evt) { this.InvocationResult = "Swing Button Clicked"; } private void jToggleButton1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = java.lang.Boolean.toString(jToggleButton1_.isSelected()); this.InvocationResult1 = java.lang.Boolean.toString(jToggleButton2_.isSelected()); } private void jToggleButton2_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = java.lang.Boolean.toString(jToggleButton1_.isSelected()); this.InvocationResult1 = java.lang.Boolean.toString(jToggleButton2_.isSelected()); } private void jCheckBox1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = java.lang.Boolean.toString(jCheckBox1_.isSelected()); this.InvocationResult1 = java.lang.Boolean.toString(jCheckBox2_.isSelected()); } private void jCheckBox2_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = java.lang.Boolean.toString(jCheckBox1_.isSelected()); this.InvocationResult1 = java.lang.Boolean.toString(jCheckBox2_.isSelected()); } private void jRadioButton1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = java.lang.Boolean.toString(jRadioButton1_.isSelected()); this.InvocationResult1 = java.lang.Boolean.toString(jRadioButton2_.isSelected()); } private void jRadioButton2_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = java.lang.Boolean.toString(jRadioButton1_.isSelected()); this.InvocationResult1 = java.lang.Boolean.toString(jRadioButton2_.isSelected()); } private void jComboBox1_ItemStateChanged(java.awt.event.ItemEvent evt) { this.InvocationResult = evt.getItem().toString(); } private void jTextField1_KeyReleased(java.awt.event.KeyEvent evt) { this.InvocationResult = jTextField1_.getText(); } private void jPasswordField1_KeyReleased(java.awt.event.KeyEvent evt) { this.InvocationResult = java.lang.String.valueOf(jPasswordField1_.getPassword()); } private void jSpinner1_StateChanged(javax.swing.event.ChangeEvent evt) { this.InvocationResult = jSpinner1_.getValue().toString(); } private void jList1_ValueChanged(javax.swing.event.ListSelectionEvent evt){ jTextPane1_.setText(jList1_.getSelectedValue().toString()); this.InvocationResult = jList1_.getSelectedValue().toString(); } private void jTree1_TreeWillExpand(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException { this.InvocationResult = evt.getPath().toString(); } private void jTree1_TreeExpanded(javax.swing.event.TreeExpansionEvent evt) { this.InvocationResult = evt.getPath().toString(); } private void jTree1_TreeWillCollapse(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException { this.InvocationResult = evt.getPath().toString(); } private void jTree1_TreeCollapsed(javax.swing.event.TreeExpansionEvent evt) { this.InvocationResult = evt.getPath().toString(); } private void jTree1_ValueChanged(javax.swing.event.TreeSelectionEvent evt) { this.InvocationResult = evt.getPath().toString(); } /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) { System.exit(0); } public static void main(String args[]) { SampleCompaKcto T = new SampleCompaKcto(); T.show(); } private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; buttonGroup1 = new javax.swing.ButtonGroup(); buttonGroup2 = new javax.swing.ButtonGroup(); buttonGroup3 = new javax.swing.ButtonGroup(); jTabbedPane1_ = new javax.swing.JTabbedPane(); jPanel1_ = new javax.swing.JPanel(); button1_ = new java.awt.Button(); textField1_ = new java.awt.TextField(30); checkbox1_ = new java.awt.Checkbox(); choice1_ = new java.awt.Choice(); list1_ = new java.awt.List(); scrollbar1_ = new java.awt.Scrollbar(); jPanel2_ = new javax.swing.JPanel(); jButton1_ = new javax.swing.JButton(); jToggleButton1_ = new javax.swing.JToggleButton(); jToggleButton2_ = new javax.swing.JToggleButton(); jCheckBox1_ = new javax.swing.JCheckBox(); jCheckBox2_ = new javax.swing.JCheckBox(); jRadioButton1_ = new javax.swing.JRadioButton(); jRadioButton2_ = new javax.swing.JRadioButton(); jPanel3_ = new javax.swing.JPanel(); jComboBox1_ = new javax.swing.JComboBox(); jTextField1_ = new javax.swing.JTextField(30); jPasswordField1_ = new javax.swing.JPasswordField(30); jSpinner1_ = new javax.swing.JSpinner(); jPanel4_ = new javax.swing.JPanel(); jSplitPane1_ = new javax.swing.JSplitPane(); jTextPane1_ = new javax.swing.JTextPane(); jScrollPane1_ = new javax.swing.JScrollPane(); jList1_ = new javax.swing.JList(); jSplitPane2_ = new javax.swing.JSplitPane(); jTextPane2_ = new javax.swing.JTextPane(); jScrollPane2_ = new javax.swing.JScrollPane(); jTree1_ = new javax.swing.JTree(); getContentPane().setLayout(new java.awt.GridBagLayout()); setName("frame1_"); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); jTabbedPane1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jTabbedPane1_.setMinimumSize(new java.awt.Dimension(600, 300)); jTabbedPane1_.setPreferredSize(new java.awt.Dimension(600, 300)); jTabbedPane1_.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jTabbedPane1_StateChanged(evt); } }); jPanel1_.setLayout(new java.awt.GridBagLayout()); jPanel1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jPanel1_.setMinimumSize(new java.awt.Dimension(600, 300)); jPanel1_.setPreferredSize(new java.awt.Dimension(600, 300)); button1_.setLabel("AWT Button"); button1_.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { button1_MouseClicked(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 8, 8); jPanel1_.add(button1_, gridBagConstraints); textField1_.setBackground(java.awt.Color.white); textField1_.setForeground(java.awt.Color.black); textField1_.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { textField1_KeyTyped(evt); } }); textField1_.addTextListener(new java.awt.event.TextListener() { public void textValueChanged(java.awt.event.TextEvent evt) { textField1_TextValueChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 8, 0); jPanel1_.add(textField1_, gridBagConstraints); checkbox1_.setBackground(java.awt.Color.lightGray); checkbox1_.setLabel("AWT Checkbox"); checkbox1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { checkbox1_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); jPanel1_.add(checkbox1_, gridBagConstraints); choice1_.add("Item One"); choice1_.add("Item Two"); choice1_.add("Item Three"); choice1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { choice1_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8); jPanel1_.add(choice1_, gridBagConstraints); list1_.add("Item One"); list1_.add("Item Two"); list1_.add("Item Three"); list1_.add("Item Four"); list1_.add("Item Five"); list1_.add("Item Six"); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 7; gridBagConstraints.gridy = 2; jPanel1_.add(list1_, gridBagConstraints); list1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { list1_ItemStateChanged(evt); } }); scrollbar1_.addAdjustmentListener(new java.awt.event.AdjustmentListener() { public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) { scrollbar1_AdjustmentValueChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8); jPanel1_.add(scrollbar1_, gridBagConstraints); jTabbedPane1_.addTab("AWT Widgets", jPanel1_); jPanel2_.setLayout(new java.awt.GridBagLayout()); jPanel2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jButton1_.setText("jButton1"); jButton1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jButton1_.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jButton1_MouseClicked(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; gridBagConstraints.insets = new java.awt.Insets(0, 16, 16, 16); jPanel2_.add(jButton1_, gridBagConstraints); jToggleButton1_.setText("jToggleButton1"); buttonGroup2.add(jToggleButton1_); jToggleButton1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jToggleButton1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton1_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 4, 8); jPanel2_.add(jToggleButton1_, gridBagConstraints); jToggleButton2_.setText("jToggleButton2"); buttonGroup2.add(jToggleButton2_); jToggleButton2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jToggleButton2_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jToggleButton2_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 0, 0, 8); jPanel2_.add(jToggleButton2_, gridBagConstraints); jCheckBox1_.setText("jCheckBox1"); buttonGroup1.add(jCheckBox1_); jCheckBox1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jCheckBox1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jCheckBox1_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 4, 4, 4); jPanel2_.add(jCheckBox1_, gridBagConstraints); jCheckBox2_.setText("jCheckBox2"); buttonGroup1.add(jCheckBox2_); jCheckBox2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jCheckBox2_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jCheckBox2_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4); jPanel2_.add(jCheckBox2_, gridBagConstraints); jRadioButton1_.setText("jRadioButton1"); buttonGroup3.add(jRadioButton1_); jRadioButton1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jRadioButton1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jRadioButton1_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 8, 4, 0); jPanel2_.add(jRadioButton1_, gridBagConstraints); jRadioButton2_.setText("jRadioButton2"); buttonGroup3.add(jRadioButton2_); jRadioButton2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jRadioButton2_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jRadioButton2_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 3; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(4, 8, 0, 0); jPanel2_.add(jRadioButton2_, gridBagConstraints); jTabbedPane1_.addTab("Swing Buttons", jPanel2_); jPanel3_.setLayout(new java.awt.GridBagLayout()); jComboBox1_.addItem("Item One"); jComboBox1_.addItem("Item Two"); jComboBox1_.addItem("Item Three"); jComboBox1_.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); jComboBox1_.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBox1_ItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 16, 8); jPanel3_.add(jComboBox1_, gridBagConstraints); jTextField1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jTextField1_.setMinimumSize(new java.awt.Dimension(100, 19)); jTextField1_.setPreferredSize(new java.awt.Dimension(100, 19)); jTextField1_.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { jTextField1_KeyReleased(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 4; gridBagConstraints.insets = new java.awt.Insets(0, 4, 16, 4); jPanel3_.add(jTextField1_, gridBagConstraints); jPasswordField1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jPasswordField1_.setMinimumSize(new java.awt.Dimension(100, 19)); jPasswordField1_.setPreferredSize(new java.awt.Dimension(100, 19)); jPasswordField1_.addKeyListener(new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { jPasswordField1_KeyReleased(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 6; gridBagConstraints.gridy = 4; gridBagConstraints.insets = new java.awt.Insets(0, 4, 16, 4); jPanel3_.add(jPasswordField1_, gridBagConstraints); jSpinner1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jSpinner1_.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jSpinner1_StateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 9; gridBagConstraints.gridy = 4; gridBagConstraints.insets = new java.awt.Insets(0, 4, 16, 4); jPanel3_.add(jSpinner1_, gridBagConstraints); jTabbedPane1_.addTab("Swing Boxes and Fields", jPanel3_); jPanel4_.setLayout(new java.awt.GridBagLayout()); jSplitPane1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jSplitPane1_.setDividerLocation(97); jSplitPane1_.setDividerSize(5); jSplitPane1_.setMinimumSize(new java.awt.Dimension(200, 100)); jSplitPane1_.setPreferredSize(new java.awt.Dimension(200, 100)); jTextPane1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jTextPane1_.setPreferredSize(new java.awt.Dimension(75, 75)); jSplitPane1_.setRightComponent(jTextPane1_); jScrollPane1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jScrollPane1_.setAutoscrolls(true); java.lang.String[] Temp = { "Item One" , "Item Two" , "Item Three" ,"Item Four" ,"Item Five" ,"Item Six" }; jList1_.setListData(Temp); jList1_.addListSelectionListener(new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { jList1_ValueChanged(evt); } }); jScrollPane1_.setViewportView(jList1_); jSplitPane1_.setLeftComponent(jScrollPane1_); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 8); jPanel4_.add(jSplitPane1_, gridBagConstraints); jSplitPane2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jSplitPane2_.setDividerLocation(150); jSplitPane2_.setDividerSize(5); jSplitPane2_.setMinimumSize(new java.awt.Dimension(300, 250)); jTextPane2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jSplitPane2_.setRightComponent(jTextPane2_); jScrollPane2_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jTree1_.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.RAISED)); jTree1_.addTreeExpansionListener(new javax.swing.event.TreeExpansionListener() { public void treeCollapsed(javax.swing.event.TreeExpansionEvent evt) { jTree1_TreeCollapsed(evt); } public void treeExpanded(javax.swing.event.TreeExpansionEvent evt) { jTree1_TreeExpanded(evt); } }); jTree1_.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { public void valueChanged(javax.swing.event.TreeSelectionEvent evt) { jTree1_ValueChanged(evt); } }); jTree1_.addTreeWillExpandListener(new javax.swing.event.TreeWillExpandListener() { public void treeWillCollapse(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException { jTree1_TreeWillCollapse(evt); } public void treeWillExpand(javax.swing.event.TreeExpansionEvent evt)throws javax.swing.tree.ExpandVetoException { jTree1_TreeWillExpand(evt); } }); jTree1_.collapseRow(0); jScrollPane2_.setViewportView(jTree1_); jSplitPane2_.setLeftComponent(jScrollPane2_); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.insets = new java.awt.Insets(0, 8, 0, 0); jPanel4_.add(jSplitPane2_, gridBagConstraints); jTabbedPane1_.addTab("Swing Complex Widgets", jPanel4_); getContentPane().add(jTabbedPane1_, new java.awt.GridBagConstraints()); pack(); } // Variables declaration - do not modify private java.awt.Button button1_; private javax.swing.ButtonGroup buttonGroup1; private javax.swing.ButtonGroup buttonGroup2; private javax.swing.ButtonGroup buttonGroup3; private java.awt.Checkbox checkbox1_; private java.awt.Choice choice1_; private javax.swing.JButton jButton1_; private javax.swing.JCheckBox jCheckBox1_; private javax.swing.JCheckBox jCheckBox2_; private javax.swing.JComboBox jComboBox1_; private javax.swing.JList jList1_; private javax.swing.JPanel jPanel1_; private javax.swing.JPanel jPanel2_; private javax.swing.JPanel jPanel3_; private javax.swing.JPanel jPanel4_; private javax.swing.JPasswordField jPasswordField1_; private javax.swing.JRadioButton jRadioButton1_; private javax.swing.JRadioButton jRadioButton2_; private javax.swing.JScrollPane jScrollPane1_; private javax.swing.JScrollPane jScrollPane2_; private javax.swing.JSpinner jSpinner1_; private javax.swing.JSplitPane jSplitPane1_; private javax.swing.JSplitPane jSplitPane2_; private javax.swing.JTabbedPane jTabbedPane1_; private javax.swing.JTextField jTextField1_; private javax.swing.JTextPane jTextPane1_; private javax.swing.JTextPane jTextPane2_; private javax.swing.JToggleButton jToggleButton1_; private javax.swing.JToggleButton jToggleButton2_; private javax.swing.JTree jTree1_; private java.awt.List list1_; private java.awt.Scrollbar scrollbar1_; private java.awt.TextField textField1_; // End of variables declaration }
Even with your example, I still cannot reproduce the problem. So I don't know what's going on. Is the compilation unit consistent ? i.e. you can test this using method.getCompilationUnit().isConsistent(). If it is consistent, can you call IType.getSource() and see if the source is okay.
The question I have: Can the CU be inconsistent and at the same time successfully compile?
Yes since the Java builder doesn't use the Java model
I followed you steps. Everything works as expected EXCEPT the following: 1) method.getCompilationUnit().isConsistent() -> returns TRUE. Expected. 2) Extra step for assurance: method.getDeclaringType().toString() -> shows: TakeAndReturnMultiIntArray(*** invalid signature: [[int) (not open) 3) method.getDeclaringType().getSource() -> returns the source as expected. The *.class files are there: 25 of them There is a WARNING that the class does not declare "static final serialVersionUID field of type long" It would be a stretch that the code model is affected by this since the IDE shows a successful build for the project. But one never knows. Thanks a lot! José
If you debug your plugin, can you inspect the IMethod and confirm that the field SourceMethod#fParameterTypes contains "[[[[[int" (note that it should really be "[[[[[I") ? Can you put a breakpoint in the constructor of SourceMethod and see why the argument 'parameterTypes' is "[[[[[int" ?
Jérôme: We may be getting closer. I inspected method and the fParameterTypes array is of length 1 (which is expected) but contains: fParameterTypes[0] = "[[int" This should be the root of the inconsistencies. José
OK, then we need to find out why the fParameterTypes field has this value.Can you put a breakpoint in the constructor of SourceMethod and see why the argument 'parameterTypes' is {"[[int"} ? In particular I'm interested in the call stack, and if the method SourceElementParser#notifySourceElementRequestor(AbstractMethodDeclaration) is on the call stack, what is the value of the local variable 'methodDeclaration' ?
I am not sure if these are the correct steps, but this is what I did: 1) Break point on getMethods(). 2) Step-into repeatedly until JavaElement#getChildrenOfType. 3) Step-over IJavaElement[] children = getChildren(); 4) Verified that that SourceMethod->fParameterTypes[0] == "[[[[[I". 5) Highlighted getChildrenOfType and generated Call Hierarchy: did not see the mentioned method (notifySourceElementRequestor) 6) Highlighted getChildren() inside JavaElement#getChildrenOfType and generated Call Hierarchy: did not see the mentioned method (notifySourceElementRequestor) Is this the correct sequence of steps?
Now I'm confused. You're saying in step 4 that the fParameterType fiels is as expected. Are you sure that it is the same method that you're using later on ? What I was suggesting was to put a breakpoint in the constructor SourceMethod(String, String[]) and look at the stack in the Debug view. But you want to look at the stack only when the argument parameterTypes is {"[[int"}.
I tried the same logic that is causing the problem. Since I am using getMethods() instead of the individually generated methods, I wanted to be sure that the method was at least created correctly. I will modify the code and make the call you suggested.
I think found the steps: My plugin does these two calls: getParameterTypes() -> at this point fParameterTypes[0] == "[[[[[I" After this particular fParameterTypes[0] CHANGES to "[[I". Then getReturnType() -> Causes exception. I tried this outside my code in the Display view. To summarize: getMethods() Returns the IMethod "mehtodA" in a consistent state. methodA.getCompilationUnit().isConsistent() returns true. fParameterTypes[0] == "[[[[[I" before calling getParameterTypes() getReturnType() returns "[[[[[I" methodA.getParameterTypes() is called then fParameterTypes[0] == "[[I" getReturnType() causes an exception
This is the call stack at that particular point: Thread [main] (Suspended) MyPlugIn.Method2(IMethod) line: 437 MyPlugIn.Method1(IMethod) line: 307 MyPlugIn.run(IAction) line: 144 WWinPluginAction(PluginAction).runWithEvent(Event) line: 244 WWinPluginAction.runWithEvent(Event) line: 220 PluginActionCoolBarContributionItem(ActionContributionItem).handleWidgetSelection(Event, boolean) line: 555 ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 505 ActionContributionItem$7.handleEvent(Event) line: 460 EventTable.sendEvent(Event) line: 82 ToolItem(Widget).sendEvent(Event) line: 833 Display.runDeferredEvents() line: 2803 Display.readAndDispatch() line: 2448 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 1569 Workbench.runUI() line: 1540 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 285 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 144 IDEApplication.run(Object) line: 102 PlatformActivator$1.run(Object) line: 220 EclipseStarter.run(Object) line: 273 EclipseStarter.run(String[], Runnable) line: 129 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object[]) line: 324 Main.basicRun(String[]) line: 185 Main.run(String[]) line: 710 Main.main(String[]) line: 694 It is what the Debug view had in the only thread icon that was expandable. It does not seem very useful to you, I think. José
The code of getParameterTypes() is just: return fParameterTypes; So this cannot change fParameterTypes. You need to find who is changing this field.
I think what I will do is to cache/parse as much as I need just after I call getMethods(), I know that the info is in a good state there. This would be a work-around to get me going. The behavior of my plugin and eclipse 2.1.3 is consistent across several flavors of linux and Windows XP. The JDT and the code model apis did not change from 2.1.3 to 3.X (as far as I know) This assures me that there is something else lurking over here. It's time to cut our "loses" and get going. I really appreciate your great help and patience. If I have time I will comeback to the original code and try to figure out why. I will close the bug as invalid and *maybe* open it if it makes sense to do so Thanks a lot!!