刚刚尝试将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已经被修复。
我应该向哪个方向挖掘?
最佳答案
谢谢,我相信这是another javac
的错误,它会在JMH遍历当前编译会话中可用的类时显示。虽然适当的修复程序属于JDK,但我们可以在JMH中使用work this bug around,并从这种故障中恢复。该修补程序现在可用于自建1.6-SNAPSHOT
,并且可能是下一个修补程序版本(1.5.1
)的一部分。
关于java - JMH和Swing导致CompletionFailure,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/28165605/