13
0
geforkt von Mirrors/Paper

Fix javac workaround in ItemStackTest

By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2013-08-06 20:09:42 -05:00
Ursprung cb196c424a
Commit a5280f8caa

Datei anzeigen

@ -316,20 +316,17 @@ public class ItemStackTest extends AbstractTestingBase {
static final Material[] COMPOUND_MATERIALS; static final Material[] COMPOUND_MATERIALS;
static final int NAME_PARAMETER = 2; static final int NAME_PARAMETER = 2;
static { static {
COMPOUND_MATERIALS = new Object() { // Workaround for JDK5
Material[] value() {
final ItemFactory factory = CraftItemFactory.instance(); final ItemFactory factory = CraftItemFactory.instance();
final Map<Class<? extends ItemMeta>, Material> possibleMaterials = new HashMap<Class<? extends ItemMeta>, Material>(); final Map<Class<? extends ItemMeta>, Material> possibleMaterials = new HashMap<Class<? extends ItemMeta>, Material>();
ItemMeta meta;
for (final Material material : Material.values()) { for (final Material material : Material.values()) {
final ItemMeta meta = factory.getItemMeta(material); meta = factory.getItemMeta(material);
if (meta == null || possibleMaterials.containsKey(meta.getClass())) if (meta == null || possibleMaterials.containsKey(meta.getClass()))
continue; continue;
possibleMaterials.put(meta.getClass(), material); possibleMaterials.put(meta.getClass(), material);
} }
return possibleMaterials.values().toArray(new Material[possibleMaterials.size()]); COMPOUND_MATERIALS = possibleMaterials.values().toArray(new Material[possibleMaterials.size()]);
}
}.value();
} }
@Parameter(0) public StackProvider provider; @Parameter(0) public StackProvider provider;