Permalink
Browse files

Fixes 939: Error with setInternalState and JDK12 [ci maven-central-re…

…lease]

Fixes 939: Error with setInternalState and JDK12 "java.lang.NoSuchFieldException: modifiers" (#955)


Signed-off-by: Enrico Olivelli - Diennea <enrico.olivelli@diennea.com>
  • Loading branch information...
eolivelli authored and thekingnothing committed Nov 17, 2018
1 parent a1bb65f commit 314dae8bddce2f1e686e8968c0ec856dfa222ec5
@@ -58,7 +58,16 @@ public void run(RunNotifier notifier) {
try {
super.run(notifier);
} finally {
Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{});
try {
Whitebox.setInternalState(description, "fAnnotations", new Annotation[]{});
} catch (RuntimeException err) {
if (err.getCause() instanceof java.lang.NoSuchFieldException
&& err.getCause().getMessage().equals("modifiers")) {
// on JDK12 you cannot change 'modifiers'
} else {
throw err;
}
}
}
}
}

0 comments on commit 314dae8

Please sign in to comment.