JMH 和 Swing 导致 CompletionFailure

JMH and Swing causes CompletionFailure

刚刚尝试将 JMH 切换到 swing 的项目中,并在主 POM 中添加以下内容:

    <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-core</artifactId>
        <version>1.5</version>
    </dependency>
    <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-generator-annprocess</artifactId>
        <version>1.5</version>
        <scope>provided</scope>
    </dependency>

和 Alexey 的插件:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <finalName>${artifactId}-with-benchmark</finalName>
                        <transformers>
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                <mainClass>org.openjdk.jmh.Main</mainClass>
                            </transformer>
                        </transformers>
                        <filters>
                            <filter>
                                <!--
                                    Shading signed JARs will fail without this.
                                    
                                -->
                                <artifact>*:*</artifact>
                                <excludes>
                                    <exclude>META-INF/*.SF</exclude>
                                    <exclude>META-INF/*.DSA</exclude>
                                    <exclude>META-INF/*.RSA</exclude>
                                </excludes>
                            </filter>
                        </filters>
                    </configuration>
                </execution>
            </executions>
        </plugin>

并得到 Maven 的编译器插件错误:

Annotation generator had thrown the exception. com.sun.tools.javac.code.Symbol$CompletionFailure: class file for sun.java2d.pipe.hw.ExtendedBufferCapabilities not found

二手 Java:

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

有谁知道出了什么问题吗? 据我所知this bug已经修复了。

应该往哪个方向挖掘?

谢谢,我相信这是 JMH 中的一个 another javac bug, that manifests when JMH walks the classes available in current compilation session. While the proper fix belongs in the JDK, we can work this bug around,并从这样的失败中恢复过来。该修复程序现在可用于自建 1.6-SNAPSHOT,并且可能会成为下一个补丁版本 (1.5.1) 的一部分。