Code is always compiled without lambda parameter type
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Jan 5 04:51:08 PST 2011
Thanks for the report, I will look into that.
Maurizio
On 05/01/11 12:42, Marcos Antonio wrote:
> 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