Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anonymous type can be replaced with lambda + formatting along the way #520

Closed
wants to merge 1 commit into from

Conversation

@ham1
Copy link
Contributor

@ham1 ham1 commented Oct 3, 2019

As discussed in #514

@codecov-io
Copy link

@codecov-io codecov-io commented Oct 3, 2019

Codecov Report

Merging #520 into master will increase coverage by <.01%.
The diff coverage is 25.96%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #520      +/-   ##
============================================
+ Coverage     55.97%   55.97%   +<.01%     
- Complexity     9953     9961       +8     
============================================
  Files          1018     1018              
  Lines         62744    62741       -3     
  Branches       7062     7059       -3     
============================================
- Hits          35118    35117       -1     
+ Misses        25161    25160       -1     
+ Partials       2465     2464       -1
Impacted Files Coverage Δ Complexity Δ
...che/jmeter/protocol/java/sampler/JUnitSampler.java 18.97% <0%> (+0.14%) 32 <0> (ø) ⬇️
...che/jmeter/gui/tree/JMeterTreeTransferHandler.java 6.92% <0%> (ø) 2 <0> (ø) ⬇️
...rg/apache/jmeter/visualizers/MailerVisualizer.java 78.77% <0%> (ø) 10 <0> (ø) ⬇️
...main/java/org/apache/jmeter/visualizers/Graph.java 15.55% <0%> (ø) 3 <0> (ø) ⬇️
...ache/jmeter/protocol/http/sampler/HTTPHC4Impl.java 66.66% <100%> (-0.05%) 98 <2> (+2)
.../apache/jmeter/visualizers/PropertyControlGui.java 82.43% <100%> (ø) 13 <1> (+1) ⬆️
...rc/main/java/org/apache/jmeter/swing/HtmlPane.java 30.76% <11.11%> (-2.57%) 2 <0> (ø)
...che/jmeter/visualizers/gui/AbstractVisualizer.java 62.66% <18.18%> (ø) 12 <0> (ø) ⬇️
...he/jmeter/visualizers/RespTimeGraphVisualizer.java 50.95% <3.22%> (ø) 18 <0> (ø) ⬇️
...main/java/org/apache/jorphan/gui/MenuScroller.java 30.53% <33.33%> (ø) 8 <0> (ø) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35f9d4d...cd88775. Read the comment docs.

@ham1 ham1 force-pushed the Anonymous-type-replaced-with-lambda branch from 4cde2c8 to e52661f Oct 3, 2019
@ham1 ham1 force-pushed the Anonymous-type-replaced-with-lambda branch from e52661f to cd88775 Oct 3, 2019
@asfgit asfgit closed this in 95a99d9 Oct 3, 2019
String m2 = (String) o2.getKey();
return m1.compareTo(m2);
}
al.sort((o1, o2) -> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this can be further simplified by using Comparator.comparing(Map.Entry::getKey)?

Copy link
Contributor

@FSchumacher FSchumacher Oct 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't work out of the box for me, as the Map isn't typed strong enough.

al.sort(Comparator.comparing(o -> (String) o.getKey()));

could be good, though.

Copy link
Contributor Author

@ham1 ham1 Oct 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem to compile, I think they need to be cast to Strings first.

@ham1 ham1 deleted the Anonymous-type-replaced-with-lambda branch Oct 3, 2019
asfgit pushed a commit that referenced this issue Oct 3, 2019
Incorporate note from pascalschumacher.
Relates to #520 on github
@vlsi
Copy link
Collaborator

@vlsi vlsi commented Oct 4, 2019

This causes the following exception when right-clicking on the "test plan":

2019-10-04 11:01:42,612 ERROR o.a.j.JMeter: Uncaught exception:
java.lang.ClassFormatError: Illegal field name "org.apache.jorphan.gui.MenuScroller$this" in class org/apache/jorphan/gui/MenuScroller$MenuScrollTimer
        at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_152]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_152]
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_152]
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[?:1.8.0_152]
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[?:1.8.0_152]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[?:1.8.0_152]
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[?:1.8.0_152]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_152]
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[?:1.8.0_152]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_152]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_152]
        at org.apache.jorphan.gui.MenuScroller$MenuScrollItem.<init>(MenuScroller.java:640) ~[jorphan.jar:5.2.0-SNAPSHOT]
        at org.apache.jorphan.gui.MenuScroller.<init>(MenuScroller.java:364) ~[jorphan.jar:5.2.0-SNAPSHOT]
        at org.apache.jorphan.gui.MenuScroller.<init>(MenuScroller.java:329) ~[jorphan.jar:5.2.0-SNAPSHOT]
        at org.apache.jorphan.gui.MenuScroller.<init>(MenuScroller.java:286) ~[jorphan.jar:5.2.0-SNAPSHOT]
        at org.apache.jorphan.gui.MenuScroller.setScrollerFor(MenuScroller.java:140) ~[jorphan.jar:5.2.0-SNAPSHOT]
        at org.apache.jorphan.gui.GuiUtils.makeScrollableMenu(GuiUtils.java:176) ~[jorphan.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.gui.util.MenuFactory.makeMenu(MenuFactory.java:442) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.gui.util.MenuFactory.makeMenu(MenuFactory.java:420) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.control.gui.TestPlanGui.createPopupMenu(TestPlanGui.java:92) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.gui.tree.JMeterTreeNode.createPopupMenu(JMeterTreeNode.java:185) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.gui.action.EditCommand.doAction(EditCommand.java:46) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:70) ~[ApacheJMeter_core.jar:5.2.0-SNAPSHOT]
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) ~[?:1.8.0_152]
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) ~[?:1.8.0_152]
        at java.awt.EventQueue.access$500(EventQueue.java:97) ~[?:1.8.0_152]
        at java.awt.EventQueue$3.run(EventQueue.java:709) ~[?:1.8.0_152]
        at java.awt.EventQueue$3.run(EventQueue.java:703) ~[?:1.8.0_152]
        at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_152]
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) ~[?:1.8.0_152]
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) ~[?:1.8.0_152]

@vlsi
Copy link
Collaborator

@vlsi vlsi commented Oct 4, 2019

That means we don't have a UI test that would build a basic test plan via the context menu :-/

@pmouawad
Copy link
Contributor

@pmouawad pmouawad commented Oct 4, 2019

That means we don't have a UI test that would build a basic test plan via the context menu :-/

What is strange is not it didn't compile in my Eclipse, I faced the issue this morning using current master code in my work, so I don't understand how it does using gradle, or is there a missing clean (which I don't think is the case)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants