The SDK is telling me that class Level has an error (via an error icon on the class tab), but I can find no other error icon on the side where it is usually located.

When I try to run, I get an ExceptionInInitializerError where I create a new instance of Level. This error also came up when I copy/pasting abstract methods into subclasses, and went away after I comment then uncommented the relevant code.

class Level
package levels;

import Tiles.BasicWall;
import Tiles.Crate;
import Tiles.Goal;
import Tiles.Pit;
import Tiles.Tile;
import Tiles.Turret;
import Tiles.Walkway;
import com.jme3.asset.AssetManager;
import com.jme3.input.InputManager;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector3f;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import main.Coordinate;
import main.Rules;
import player.Player;

 * @author codex
public class Level {
	AssetManager asset;
	InputManager input;
	String title, grid;
	private ArrayList<ArrayList<Character>> data = new ArrayList<>();	
	Coordinate start;
	boolean complete = false;
	public static final char START = 'P', NONE = ' ';
	public static final char TURRET_UP = '^', TURRET_DOWN = 'v',
							TURRET_LEFT = '<', TURRET_RIGHT = '>';
	public static final char ATTACHEMENT_MARKER = 'A';
	private final ArrayList<Tile> attachements = new ArrayList<>();
	Player plr;
	static final Map<Character, Function<Coordinate, Tile>> tileBindings;
	static {
		tileBindings = new HashMap<>();
		// add bindings here
		tileBindings.put('#', BasicWall ::new);
		tileBindings.put('-', Walkway   ::new);
		tileBindings.put('=', Crate     ::new);
		tileBindings.put('@', Goal      ::new);
		tileBindings.put('U', Pit		::new);
	public Level(AssetManager asset, InputManager input, String title, String grid) {
		this.asset = asset;
		this.input = input;
		this.title = title;
		this.grid = grid;
		data = LevelReader.gridToList(this.grid, '+');
	public void resetPlayer(AssetManager manager) {
		plr = new Player();
	public void setPlayerLocation(Vector3f loc) {
	public ArrayList<Tile> read() {
		ArrayList<Tile> tiles = new ArrayList<>();
		for (int i = 0; i < data.size(); i++) {
			for (int j = 0; j < data.get(i).size(); j++) {
				char c = data.get(i).get(j);
				Coordinate coord = new Coordinate(j, i);
				switch (c) {
					case NONE: break;
					case ATTACHEMENT_MARKER: break;
					case START:
						plr.setLocation(new Vector3f(coord.getX()*Rules.UNIT, 0, coord.getY()*Rules.UNIT));
						tiles.add(new Walkway(coord));
					case TURRET_UP:
						tiles.add(new Turret(coord, new Vector2f(0, -1)));
						tiles.add(new Walkway(coord));
					case TURRET_DOWN:
						tiles.add(new Turret(coord, new Vector2f(0, 1)));
						tiles.add(new Walkway(coord));
					case TURRET_LEFT:
						tiles.add(new Turret(coord, new Vector2f(-1, 0)));
						tiles.add(new Walkway(coord));
					case TURRET_RIGHT:
						tiles.add(new Turret(coord, new Vector2f(1, 0)));
						tiles.add(new Walkway(coord));
					default: tiles.add(readCharacter(c, coord));
		for (Tile i : attachements) tiles.add(i);
		return tiles;
	private Tile readCharacter(char c, Coordinate coord) {
		Function<Coordinate, Tile> s = tileBindings.get(c);
		if (s == null) throw new IllegalArgumentException("oops! u failed with "+c);
		return s.apply(coord);
	public void attach(Tile t) {
	public void setComplete(boolean c) {
		complete = c;
	public String getTitle() {
		return title;
	public Coordinate getStart() {
		return start;
	public boolean isComplete() {
		return complete;
	public Player getPlayer() {
		return plr;
	public ArrayList<ArrayList<Character>> getGridData() {
		return data;
Exception details

The error occurs in class World1 (subclass of World), where a new instance of Level was created.

	at levels.worlds.World1.initLevels(World1.java:31)
	at levels.worlds.World.<init>(World.java:48)
	at levels.worlds.World1.<init>(World1.java:26)
	at levels.GameData.<init>(GameData.java:25)
	at main.Main.loadData(Main.java:165)
	at main.Main.simpleInitApp(Main.java:58)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
	at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: java.util.Map.put
	at levels.Level.<clinit>(Level.java:57)
	... 10 more

Unfortunately, I added a lot of code since the last successful run, so it is more difficult to trace exactly.

Any help is appreciated :slightly_smiling_face:

May be Check this method again …

Can you send the rest ? The error causes a util class Map of a HashMap to misbehave…

Follow this, it may be the key…

tileBindings.put('@', Goal ::new);
The “put” in this is not highlighted red like the other “put”-s.
Delete that line, and it runs fine. Why just that “put”?

1 Like

Its uncompilable though ! But how, is not that ASCII ?

I wasn’t having trouble with it before (even though it wasn’t red).

1 Like

Can you build a jar ? & run it ?

1 Like

Attempted building and got this:

/home/codex/java/prj/ReboundPuzzle/src/levels/Level.java:58: error: incompatible types: invalid constructor reference
		tileBindings.put('@', Goal      ::new);
    constructor Goal in class Goal cannot be applied to given types
      required: Coordinate,Level
      found: Coordinate
      reason: actual and formal argument lists differ in length
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
/home/gary/java/prj/ReboundPuzzle/nbproject/build-impl.xml:918: The following error occurred while executing this line:
/home/gary/java/prj/ReboundPuzzle/nbproject/build-impl.xml:268: Compile failed; see the compiler error output for details.

Looks like an constructor argument was dropped.

1 Like

Do your checks & let us know when you solve it