Community
Participate
Working Groups
I have the following code snippet: public void foo() { for(MatGroup.Ctrl<?,?> glmat: ...) { glmat.getView().setTempAppearance() ; } } MatGroup is defined as follows: public class MatGroup { public static class Model extends Figure.Model {...} public static class View<T extends Model> { public void setTempAppearance() {...} } public static class Ctrl<T extends Model,U extends View<T>> {...} } I get the following error when I run: Exception in thread "AWT-EventQueue-0" java.lang.VerifyError: (class: org/liberatis/sphaera/editor/PointSet$Ctrl, method: foo signature: ()V) Incompatible object argument for function call at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) at java.lang.Class.getConstructor0(Class.java:2640) at java.lang.Class.getConstructor(Class.java:1629) at org.liberatis.sphaera.mvc.ControllerInstantiatorImpl.<init>(ControllerInstantiatorImpl.java:92) If I change the snippet slightly to: public void foo() { for(MatGroup.Ctrl<?,?> glmat: ...) { GLMatGroup view = glmat.getView() ; view.setTempAppearance() ; } } It will work okay. It should be noted that M4 could not even compile this snippet of code correctly, so it seems like there is perhaps some sort of systemtic overlook of this area of generics and needs more tests.
I meant to say............... If I change the snippet slightly to: public void foo() { for(MatGroup.Ctrl<?,?> glmat: ...) { GLMatGroup.View<?,?> view = glmat.getView() ; view.setTempAppearance() ; } }
I really really really meant to say............... If I change the snippet slightly to: public void foo() { for(MatGroup.Ctrl<?,?> glmat: ...) { MatGroup.View<?,?> view = glmat.getView() ; view.setTempAppearance() ; } }
Cannot reproduce in M5. Tried the following and it worked fine: import java.io.PrintStream; import java.util.List; public class X { public static void main(String argv[]) { System.out.println("SUCCESS"); } public void foo(List<MatGroup.Ctrl<?,?>> list) { for(MatGroup.Ctrl<?,?> glmat: list) { glmat.getView().setTempAppearance() ; } } } class MatGroup { static class Model {} static class View<T extends Model> { public void setTempAppearance() {} } static class Ctrl<T extends Model,U extends View<T>> { View getView() { return null; } } } Please provide exact steps to reproduce, then reopen
Reopen once steps are available
I regret that I do not have the time to get a small test case. However.......... The very fact that I got that stack trace absolutely shows that there is a bug in eclipse. that error should never ever ever occur. I was really hoping someone could actually analyze the error and see how it *could* happen. I urge you to take a second glance and not dismiss the bug simply for lack of a test case. It is 100% a bug and a bug of the very worst kind (generating bad byte code).
Closing REMIND doesn't mean there is no bug, it simply mean that we request the reporter more information. This defect is interesting, however the steps are inaccurate, and do not reproduce. We have quite a few other defects which can be solved today, and thus closing REMIND helps to focus on bugs for which we can take immediate actions. You seem to be able to reproduce it, and you need to communicate better steps for this defect to be addressed (again not saying we have no bug)
Created attachment 18733 [details] IController.java
Created attachment 18734 [details] IView.java
Created attachment 18735 [details] MatGroup.java
Created attachment 18736 [details] foobar.java
Compile the 4 attached java files with 3.1M5a and you get: Exception in thread "main" java.lang.VerifyError: (class: foobar, method: main signature: ([Ljava/lang/String;)V) Incompatible object argument for function call cheers
You get the error when you run, not when you compile. sorry.
Reproduced. Thanks for the testcase.
#getView() invocation is missing trailing generic cast to View. This is due to optimization for unbound/super wildcards. Fixed. Added GenericTypeTest#test560
Verified in I20050330-0500