替换不推荐使用的代码(sun.awt.Win32GraphicsDevice)

时间:2018-10-14 18:59:47

标签: java maven awt sun

因此,基本上,我遇到了一些基于sun.awt包的不推荐使用的源代码。

try {
    boolean bool = false;
    try {
        Field field = sun.awt.Win32GraphicsDevice.class.getDeclaredField("valid");
        field.setAccessible(true);
        boolean bool_6_ = ((Boolean) field.get(this.aGraphicsDevice5666)).booleanValue();
        if (bool_6_) {
            field.set(this.aGraphicsDevice5666, Boolean.FALSE);
            bool = true;
        }
    } catch (Throwable throwable) {
        /* empty */
    }

我在DocJar上进行了搜索,发现该软件包来自OpenJDK 7,为此,我从HomeBrew获得了该软件包,并从OpenJDK 7和8重新编译了该软件包。

我使用了Maven的JMH软件包,仍然一无所获。

这是我的pom.xml

<modelVersion>4.0.0</modelVersion>

<groupId>com</groupId>
<artifactId>Client</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
  <src.dir>src</src.dir>
</properties>

<build>
    <sourceDirectory>${src.dir}</sourceDirectory>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
                <source>1.8</source> 
                <target>1.8</target>
            </configuration>
        </plugin>
    </plugins>
</build>


<dependencies>
    <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-core</artifactId>
        <version>1.21</version>
    </dependency>
    <dependency>
        <groupId>org.openjdk.jmh</groupId>
        <artifactId>jmh-generator-annprocess</artifactId>
        <version>1.21</version>
    </dependency>
    <dependency>
        <groupId>org.openjdk.jol</groupId>
        <artifactId>jol-core</artifactId>
        <version>0.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.levigo/gwt-awt -->
    <dependency>
        <groupId>com.levigo</groupId>
        <artifactId>gwt-awt</artifactId>
        <version>0.0.1</version>
    </dependency>
</dependencies>

0 个答案:

没有答案