Bug 1517 : Field inner class variable with generic parameter fails compile
Last modified: 2010-03-17 12:47




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
heuermh
Assigned To:
MrFeinberg

Attachment Type Created Size Actions

Description:   Opened: 2010-03-16 12:45
version:

processing-0180

error:

Syntax error, insert ";" to complete ClassBodyDeclarations

source:

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Comparator;

Comparator<String> comparator = new Comparator<String>()
{
public int compare(final String value0, final String value1)
{
return value0.compareTo(value1);
}
};

void setup()
{
List<String> list = new ArrayList<String>();
list.add("foo");
list.add("bar");
list.add("baz");

Collections.sort(list, comparator);
}

This works ok:

import java.util.ArrayList;
import java.util.List;
import java.util.Collections;
import java.util.Comparator;

Comparator comparator = new Comparator()
{
public int compare(final Object value0, final Object value1)
{
return ((Comparable) value0).compareTo(value1);
}
};

void setup()
{
List<String> list = new ArrayList<String>();
list.add("foo");
list.add("bar");
list.add("baz");

Collections.sort(list, comparator);
}
Additional Comment #1 From MrFeinberg 2010-03-16 12:56
Fixed.