Skip to content

Commit

Permalink
Update to JDK 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed May 26, 2023
1 parent 34f6b89 commit e49b9ea
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 186 deletions.
9 changes: 2 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputTimestamp>1</project.build.outputTimestamp>
<java.release>8</java.release>
<lombok.version>1.18.20</lombok.version>
<logback.version>1.2.9</logback.version>
<slf4j.version>1.7.25</slf4j.version>
Expand Down Expand Up @@ -190,7 +189,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${java.release}</release>
<release>11</release>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -237,12 +236,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.5.0</version>
<configuration>
<!-- Fix Javadoc on Java 11+ - JDK-8212233 -->
<source>8</source>
<!-- Fix Javadoc search feature to work without modules - https://stackoverflow.com/a/52603413 -->
<additionalJOption>--no-module-directories</additionalJOption>
<!-- Javadoc the delombok sources -->
<sourcepath>${project.build.directory}/delombok</sourcepath>
</configuration>
Expand Down
24 changes: 0 additions & 24 deletions runelite-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -342,34 +342,10 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile-java11</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>11</release>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
</compileSourceRoots>
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/11</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<excludes>
<exclude>**/.clang-format</exclude>
</excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
Expand All @@ -43,6 +44,7 @@
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.desktop.QuitStrategy;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
Expand Down Expand Up @@ -360,7 +362,8 @@ public void init() throws Exception
{
// Change the default quit strategy to CLOSE_ALL_WINDOWS so that ctrl+q
// triggers the listener below instead of exiting.
MacOSQuitStrategy.setup();
Desktop.getDesktop()
.setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS);
}
frame.addWindowListener(new WindowAdapter()
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@
*/
package net.runelite.client.util;

import java.awt.Component;
import javax.swing.Popup;
import javax.swing.PopupFactory;

/**
* Dummy popup factory for Java 8
* Popup factory for Java 11 which forces heavyweight popups. Lightweight popups do not render correctly
* over AWT canvases on OSX.
*/
class MacOSPopupFactory extends PopupFactory
{
}
@Override
protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException
{
return super.getPopup(owner, contents, x, y, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Map;
Expand All @@ -55,10 +54,6 @@ public static MethodHandles.Lookup privateLookupIn(Class<?> clazz)
{
try
{
// Java 9+ has privateLookupIn method on MethodHandles, but since we are shipping and using Java 8
// we need to access it via reflection. This is preferred way because it's Java 9+ public api and is
// likely to not change
final Method privateLookupIn = MethodHandles.class.getMethod("privateLookupIn", Class.class, MethodHandles.Lookup.class);
MethodHandles.Lookup caller;
if (clazz.getClassLoader() instanceof PrivateLookupableClassLoader)
{
Expand All @@ -68,30 +63,12 @@ public static MethodHandles.Lookup privateLookupIn(Class<?> clazz)
{
caller = MethodHandles.lookup();
}
return (MethodHandles.Lookup) privateLookupIn.invoke(null, clazz, caller);
return MethodHandles.privateLookupIn(clazz, caller);
}
catch (InvocationTargetException | IllegalAccessException e)
catch (IllegalAccessException e)
{
throw new RuntimeException(e);
}
catch (NoSuchMethodException e)
{
try
{
// In Java 8 we first do standard lookupIn class
final MethodHandles.Lookup lookupIn = MethodHandles.lookup().in(clazz);

// and then we mark it as trusted for private lookup via reflection on private field
final Field modes = MethodHandles.Lookup.class.getDeclaredField("allowedModes");
modes.setAccessible(true);
modes.setInt(lookupIn, -1); // -1 == TRUSTED
return lookupIn;
}
catch (ReflectiveOperationException ex)
{
throw new RuntimeException(ex); // NOPMD: PreserveStackTrace: ignore e
}
}
}

public interface PrivateLookupableClassLoader
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit e49b9ea

Please sign in to comment.