Skip to content

Improve ExceptionUtil.sneakyThrow declaration - #1077

Merged
leonard84 merged 1 commit into
spockframework:masterfrom
Vampire:sneaky-throw-improvement
Feb 28, 2020
Merged

leonard84 merged 1 commit into
spockframework:masterfrom
Vampire:sneaky-throw-improvement

Conversation

@Vampire

@Vampire Vampire commented Jan 15, 2020 •

Copy link
Copy Markdown
Member

There is no need to separate sneakyThrow and doSneakyThrow, it can be done
in one declaration.

I also added a return type so it can be used in methods or lambdas that need a return value.


This change is Reviewable

@codecov

codecov Bot commented Jan 15, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #1077 into master will increase coverage by 0.11%.
The diff coverage is 6.25%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1077      +/-   ##
============================================
+ Coverage     74.12%   74.24%   +0.11%     
- Complexity     3472     3474       +2     
============================================
  Files           385      385              
  Lines         10678    10661      -17     
  Branches       1309     1308       -1     
============================================
  Hits           7915     7915              
+ Misses         2302     2285      -17     
  Partials        461      461
Impacted Files Coverage Δ Complexity Δ
...java/org/spockframework/runtime/ErrorSpecNode.java 75% <0%> (+15%) 1 <0> (ø) ⬇️
...framework/mock/runtime/ByteBuddyMethodInvoker.java 50% <0%> (+5.55%) 2 <0> (ø) ⬇️
.../org/spockframework/runtime/GroovyRuntimeUtil.java 70.23% <0%> (+6.1%) 41 <0> (ø) ⬇️
...ckframework/spring/mock/DelegatingInterceptor.java 55.26% <0%> (+2.76%) 6 <0> (ø) ⬇️
...framework/mock/runtime/CglibRealMethodInvoker.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...n/java/org/spockframework/util/ReflectionUtil.java 80.17% <0%> (+1.35%) 66 <0> (ø) ⬇️
...in/java/org/spockframework/util/ExceptionUtil.java 75% <100%> (+10.71%) 6 <1> (ø) ⬇️

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 628cfb5...f7ae2be. Read the comment docs.

szpak
szpak previously approved these changes Jan 15, 2020
@szpak

szpak commented Jan 15, 2020

Copy link
Copy Markdown
Member

It's a breaking change, so it would be good to remember about that in the migration notes.

@Vampire

Vampire commented Jan 15, 2020

Copy link
Copy Markdown
Member Author

Is it? Is this expected to be used by client code?
Client code is expected to be written in Groovy and in Groovy there is no checked vs. unchecked exception differentiation, but all exceptions are unchecked, so I'd not expect anything breaking here.

@szpak

szpak commented Jan 15, 2020

Copy link
Copy Markdown
Member

Good point with Groovy as a base language for writing tests with Spock. The Exceptions util is more commonly used in user tests, but it is a separate class.

@leonard84

Copy link
Copy Markdown
Member

Hm, I'm not quite sure, it could be used in extensions and unfortunately we there is no real consistent separation between internal and public api.

@Vampire

Vampire commented Jan 16, 2020

Copy link
Copy Markdown
Member Author

Well, at least it is compile-time compatible, it is just not binary compatible due to the change of the return type iirc.

@Vampire
Vampire force-pushed the sneaky-throw-improvement branch from b48a3d6 to f7ae2be Compare February 27, 2020 10:48
@leonard84
leonard84 merged commit 4796084 into spockframework:master Feb 28, 2020
@Vampire
Vampire deleted the sneaky-throw-improvement branch February 28, 2020 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants