Community
Participate
Working Groups
There seems to be a problem with nested parameterized types, like Map<String, Set<String>>, being used in a foreach loop. I've written two versions of a simple method, which should have (nearly) identical behavior. Version 1 (Works): private static void printMap(TreeMap<String, TreeSet<String>> map) { for (String key : map.keySet()) { System.out.print(key + ":"); TreeSet<String> vals = map.get(key); for (String val : vals) System.out.print(" " + val); System.out.println(); } } Version 2 (Does NOT work): private static void printMap(TreeMap<String, TreeSet<String>> map) { for (String key : map.keySet()) { System.out.print(key + ":"); TreeSet<String> vals = map.get(key); for (String val : map.get(key)) System.out.print(" " + val); System.out.println(); } } Version 2 should produce the same output as version 1, but does not. Both of them compile with no error messages, but when running the program with version 2, an error window with the following message is created: "Could not find the main class. Program will exit." Also the console view displays the following text: "java.lang.VerifyError: (class: org/malloys/akm/horstmann/prereq/ImportReporter, method: printMap signature: (Ljava/util/TreeMap;)V) Incompatible object argument for function call Exception in thread 'main'".
I am investigating. I believe this is a duplicate of bug 72560. I will double-check.
Ohhhhh, you're right. I saw that bug when looking for duplicates, but I didn't quite understand what he was saying at the time. Yes, I'm sure you're right that it's a duplicate. Sorry to bother you *smile*.
*** This bug has been marked as a duplicate of 72560 ***
(In reply to comment #0) > There seems to be a problem with nested parameterized types, like Map<String, > Set<String>>, being used in a foreach loop. I've written two versions of a > simple method, which should have (nearly) identical behavior. > Version 1 (Works): > private static void printMap(TreeMap<String, TreeSet<String>> map) > { > for (String key : map.keySet()) > { > System.out.print(key + ":"); > TreeSet<String> vals = map.get(key); > for (String val : vals) > System.out.print(" " + val); > > System.out.println(); > } > } > Version 2 (Does NOT work): > private static void printMap(TreeMap<String, TreeSet<String>> map) > { > for (String key : map.keySet()) > { > System.out.print(key + ":"); > TreeSet<String> vals = map.get(key); > for (String val : map.get(key)) > System.out.print(" " + val); > > System.out.println(); > } > } > Version 2 should produce the same output as version 1, but does not. Both of > them compile with no error messages, but when running the program with version > 2, an error window with the following message is created: "Could not find the > main class. Program will exit." Also the console view displays the following > text: "java.lang.VerifyError: (class: > org/malloys/akm/horstmann/prereq/ImportReporter, method: printMap signature: > (Ljava/util/TreeMap;)V) Incompatible object argument for function call > Exception in thread 'main'". I have the same issue, however, no for loop. You are probably correct about the nested types in function call. I have the issue with JBuilder 6. My error mssg is as follows: java.lang.VerifyError: (class: wcurve/wcurve14, method: slotUpdateControls signature: (Lorg/kde/qt/QWidget;)V) Incompatible object argument for function call Exception in thread "main" --- My function call is as follows: pQAction.connect((QObject)pWorkspace, pQAction.SIGNAL("windowActivated(QWidget)"), (QObject)((Object)this), pQAction.SLOT("slotUpdateControls(QWidget)")); --- My function signature is as follows: void slotUpdateControls(QWidget w){ Funny that there was no error for the windowActivated nested call. Any ideas....?? Steve PS. I changed the type in the call to QOBject and got the same error but with ref to (Lorg/kde/qt/QObject)
Could you please open a new bug report for this issue? Specify your build ID and give us a test case that reproduces the problem. Thanks.