gcj/304: Definate assignment with switch

bryce@albatross.co.nz bryce@albatross.co.nz
Wed Aug 9 02:50:00 GMT 2000


>Number:         304
>Category:       gcj
>Synopsis:       Definate assignment with switch
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apbianco
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 09 02:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Bryce McKinlay
>Release:        unknown-1.0
>Organization:
>Environment:
any
>Description:
The following example is illegal because 'r' may not have
been assigned when it is concatenated. gcj does not pick 
up this error.

public class Definate
{
  int id = 2;
  
  void a()
  {
    String r;
    
    switch (id)
      {
        case 99:
	  r = "foo";
	break;
      }
    
    r += "bar";
  }
}
>How-To-Repeat:
Compile the example above.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Java-prs mailing list