Bug 80083 - VerifyError on String-Operator += when using generics
Summary: VerifyError on String-Operator += when using generics
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-03 04:12 EST by Ingo R. Homann CLA
Modified: 2004-12-14 22:56 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo R. Homann CLA 2004-12-03 04:12:36 EST
The Bug occurs in the following code:

import java.util.ArrayList;

public class Bug
{

  public static void main(String[] args)
  {
    ArrayList<String> l = new ArrayList<String>();
    l.add("x");
    String s = "";
    s += l.get(0); // X
  }

}

It compiles correctly, but will not by loaded in the RuntimeEnvironment 
(VerifyError).

Replacing line "X" with "s=s+l.get(0);" will solve it.

The bug is sometimes hard to find, because the compiler does not show it, and 
it is legal code (I think).
Comment 1 Philipe Mulet CLA 2004-12-09 18:11:14 EST
Implicit conversion were computed independantly from #computeConversion which
also   ensures generic casts are inserted.
Added regression test: GenericTypeTest#test434.
Fixed
Comment 2 Olivier Thomann CLA 2004-12-14 22:56:46 EST
Verified in 200412140800