You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry guys but I have another problem using spoon-core-5.2.0-20160629.235159-96.jar. The problem was not here using spoon-core-5.2.0-20160626.235126-95.jar.
This time I can reproduce the problem using this test case:
@Test
public void testSpoon() {
final spoon.Launcher launcher = new spoon.Launcher();
launcher.addInputResource("src/test/resources/java/widgetsIdentification/LambdaOnFieldWidgetsEqualCond.java");
launcher.getEnvironment().setNoClasspath(true);
launcher.getEnvironment().setComplianceLevel(8);
launcher.buildModel();
launcher.getModel().getElements(new TypeFilter<CtExecutable<?>>(CtExecutable.class) {
@Override
public boolean matches(CtExecutable<?> exec) {
final List<CtParameterReference<?>> guiParams = exec.getParameters().stream().map(param -> param.getReference()).collect(Collectors.toList());
if(guiParams.size()!=1) return false;
final CtParameterReference<?> param = guiParams.get(0);
exec.getBody().getElements(new TypeFilter<CtParameterReference<?>>(CtParameterReference.class) {
@Override
public boolean matches(CtParameterReference<?> p) {
assertEquals(p, param);
return super.matches(p);
}
});
return super.matches(exec);
}
});
}
The tested code is:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
class Foo {
final JButton b = new JButton();
final JButton a = new JButton();
public Foo() {
b.addActionListener(e -> {
if(e.getSource()==a) {
System.out.println(((JButton) e.getSource()).getName()); // Command 1
}
});
}
}
Sorry guys but I have another problem using spoon-core-5.2.0-20160629.235159-96.jar. The problem was not here using spoon-core-5.2.0-20160626.235126-95.jar.
This time I can reproduce the problem using this test case:
The tested code is:
The problem seems to come from:
in the EqualsVisitor class.
Maybe a problem when cloning lambda references?
The test passes using spoon-core-5.2.0-20160626.235126-95 but not using spoon-core-5.2.0-20160629.235159-96.jar.
The text was updated successfully, but these errors were encountered: