Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMH and Swing causes CompletionFailure

Tags:

java

jmh

Just tried to switch on JMH into swing's project with the following addition to main 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>

and Alexey's plugin:

        <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>

And got Maven's compiler plugin error:

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

Used 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)

Does anyone have any idea what was going wrong? As far as I know this bug has been already fixed.

In which directions should I dig in?

like image 541
Vladimir Kishlaly Avatar asked Nov 19 '25 13:11

Vladimir Kishlaly


1 Answers

Thanks, I believe this is an 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 in JMH, and recover from failures like this. The fix is available with self-built 1.6-SNAPSHOT now, and will probably be the part of the next patch release (1.5.1).

like image 146
Aleksey Shipilev Avatar answered Nov 22 '25 03:11

Aleksey Shipilev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!