JMH和Swing导致CompletionFailure

时间:2015-01-27 07:52:53

标签: java jmh

只是尝试将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.
                                    http://stackoverflow.com/questions/999489/invalid-signature-file-when-attempting-to-run-a-jar
                                -->
                                <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已经修复。

我应该在哪个方向挖掘?

1 个答案:

答案 0 :(得分:2)

谢谢,我相信这是一个another javac错误,在JMH遍历当前编译会话中可用的类时会显示。虽然正确的修复属于JDK,但我们可以在JMH中work this bug around,并从这样的失败中恢复。该修补程序现在可以使用自建1.6-SNAPSHOT,并且可能是下一个修补程序版本(1.5.1)的一部分。