[patch] Prevent NoSuchMethodError when compiling in IntelliJ IDEA
Evgeny Mandrikov
mandrikov at gmail.com
Tue Oct 20 09:25:56 UTC 2015
Pff, looks like ML removes attachments sometimes. Inlined version:
diff -r 9b3dc57e8d41
jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java
---
a/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java
Mon Oct 19 16:31:14 2015 +0300
+++
b/jmh-core/src/main/java/org/openjdk/jmh/generators/core/BenchmarkGenerator.java
Tue Oct 20 10:24:29 2015 +0200
@@ -134,12 +134,14 @@
Set<BenchmarkListEntry> entries = new
HashSet<BenchmarkListEntry>();
// Try to read the benchmark entries from previous generator
sessions.
+ Multimap<String, BenchmarkListEntry>
previousEntriesByUserClassQName = new HashMultimap<String,
BenchmarkListEntry>();
try {
Reader reader =
destination.getResource(BenchmarkList.BENCHMARK_LIST.substring(1));
Collection<String> existingLines =
FileUtils.readAllLines(reader);
for (String line : existingLines) {
BenchmarkListEntry br = new BenchmarkListEntry(line);
entries.add(br);
+
previousEntriesByUserClassQName.put(br.getUserClassQName(), br);
}
} catch (IOException e) {
// Expected in most cases, move on.
@@ -147,7 +149,7 @@
destination.printWarning("Unable to read the existing
benchmark list, because of UnsupportedOperationException. Run on JDK 7 or
higher.");
}
- // Generate new benchmark entries, potentially overwriting the
previous lines
+ // Generate new benchmark entries, potentially overwriting all
the previous lines belonging to the classes of the newly generated entries
for (BenchmarkInfo info : benchmarkInfos) {
try {
MethodGroup group = info.methodGroup;
@@ -177,9 +179,10 @@
group.getTimeout()
);
- if (entries.contains(br)) {
- destination.printNote("Benchmark entry " + br
+ " already exists, overwriting");
- entries.remove(br);
+ if
(previousEntriesByUserClassQName.keys().contains(info.userClassQName)) {
+ destination.printNote("Benchmark entries for "
+ info.userClassQName + " already exist, overwriting");
+
entries.removeAll(previousEntriesByUserClassQName.get(info.userClassQName));
+
previousEntriesByUserClassQName.remove(info.userClassQName);
}
entries.add(br);
On Tue, Oct 20, 2015 at 11:19 AM, Evgeny Mandrikov <mandrikov at gmail.com>
wrote:
> CLA has been signed and sent. Updated patch is in attachment. However it
> lacks test, because I don't see how such scenario can be easily tested
> using current infrastructure of tests for generator. I thought about mocked
> ClassInfo, but maybe you have a better idea?
>
--
Best regards,
Evgeny Mandrikov aka Godin <http://godin.net.ru>
http://twitter.com/_godin_
More information about the jmh-dev
mailing list