Code is always compiled without lambda parameter type
Marcos Antonio
marcos_antonio_ps at hotmail.com
Wed Jan 5 04:42:39 PST 2011
Hello, everybody!
I have this piece of code in a class of mine:
addHierarchyListener(
#{e ->
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0)
{
IJanela janela = UtilsIU.obterJanela(this);
if (janela != null)
{
janela.getRootPane().setDefaultButton(_btnOk);
btnCancelar.addActionListener(#{e -> janela.fechar()});
}
else if (btnCancelar.getActionListeners().length > 0)
{
btnCancelar.removeActionListener(btnCancelar.getActionListeners()[0]);
}
}
}
);
The interesting thing that I noticed is that "ant" always compile the class
that has this fragment of code, even if I don't change it. It's like the
java file is always changed. Now if I make this little change (introducing
the type of the paramenter, HierarchyEvent), the code only compiles once,
after the change, as expected.
addHierarchyListener(
#{HierarchyEvent e ->
if ((e.getChangeFlags() & HierarchyEvent.PARENT_CHANGED) != 0)
{
IJanela janela = UtilsIU.obterJanela(this);
if (janela != null)
{
janela.getRootPane().setDefaultButton(_btnOk);
btnCancelar.addActionListener(#{e -> janela.fechar()});
}
else if (btnCancelar.getActionListeners().length > 0)
{
btnCancelar.removeActionListener(btnCancelar.getActionListeners()[0]);
}
}
}
);
I think this is a problem, but I just don't know where.
Marcos
More information about the lambda-dev
mailing list