Summary: | [1.5] VerifyError - incompatible argument to function | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Stefan Matthias Aust <sma> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.0 | ||
Target Milestone: | 3.1 M1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Stefan Matthias Aust
2004-07-14 15:12:23 EDT
Cannot reproduce. I tried the following testcase inferred from given information, please advise for reproducing it. Also, can you reproduce the issue with latest HEAD contents ? import java.util.*; public class X { public static void main(String[] args) { YYY y = new YYY(); System.out.println( new StringBuilder("triggering getRightsobject() for cid=") .append(y.getCID()) .append(", roid=") .append(y.getROIDs().get(0)) .toString()); System.out.println( new StringBuilder("got:\n") .append(y.toXML()) .toString()); } } class YYY extends AAA { } class AAA { String getCID() { return "[cid]"; } List<String> getROIDs() { ArrayList<String> als = new ArrayList<String>(1); als.add("[roid]"); return als; } String toXML() { return "[xml]"; } } Philippe, your code works for me but I managed to modify and further simplify the example and reproduce the problem: java.lang.VerifyError: (class: A, method: main signature: ([Ljava/lang/String;)V) Incompatible argument to function Here's the faulty code: import java.util.*; public class A { public static void main(String[] args) { A a = new A(); System.out.println("-" + a.a() + "-" + a.b().get(0) + "-" + a.a() + "-"); } String a() { return ""; } List<String> b() { ArrayList<String> als = new ArrayList<String>(1); als.add(a()); return als; } } Using latest CVS and 5.0 b57. If I remove the "get(0)" the code works. If I remove the "<String>" from b's signature, the code works. If you decompile the class file 32: aload_1 33: invokevirtual #41; //Method b:()Ljava/util/List; 36: iconst_0 37: invokeinterface #47, 2; //InterfaceMethod java/util/List.get:(I)Ljava/lang/Object; 42: invokevirtual #37; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; you should notice that List#get() returns a Object but the StringBuilder#append() method expects a string. Either a cast is missing or a different append() method must be chosen. Hope this helps to fix the bug :) String concatenation was indeed missing generic cast generation. Added regression test: GenericTypeTest#test254. Fixed |