mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Make the module dependency on java.logging optional
Currently, FlatLaf has the following module dependencies: $ jdeps --list-deps --multi-release 9 flatlaf-1.0.jar java.base java.desktop java.logging This commit makes the java.logging dependency optional and hides logging behind a facade that falls back to printing to stderr if the java.logging module is not available. To test, create a reduced JRE with a command like jdk-15/bin/jlink.exe --module-path jdk-15/jmods --add-modules java.desktop --add-modules java.instrument --output jre-15-desktop-only (adding java.instrument, so the FlatLafDemo main class can be started from IntelliJ IDEA)
This commit is contained in:
@@ -17,25 +17,21 @@
|
||||
package com.formdev.flatlaf.intellijthemes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.IntelliJTheme;
|
||||
import com.formdev.flatlaf.LoggingFacade;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
static final Logger LOG = Logger.getLogger( FlatLaf.class.getName() );
|
||||
|
||||
static IntelliJTheme loadTheme( String name ) {
|
||||
try {
|
||||
return new IntelliJTheme( Utils.class.getResourceAsStream(
|
||||
"/com/formdev/flatlaf/intellijthemes/themes/" + name ) );
|
||||
} catch( IOException ex ) {
|
||||
String msg = "FlatLaf: Failed to load IntelliJ theme '" + name + "'";
|
||||
LOG.log( Level.SEVERE, msg, ex );
|
||||
LoggingFacade.logSevere( msg, ex );
|
||||
throw new RuntimeException( msg, ex );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,25 +17,21 @@
|
||||
package com.formdev.flatlaf.intellijthemes.materialthemeuilite;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.IntelliJTheme;
|
||||
import com.formdev.flatlaf.LoggingFacade;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
static final Logger LOG = Logger.getLogger( FlatLaf.class.getName() );
|
||||
|
||||
static IntelliJTheme loadTheme( String name ) {
|
||||
try {
|
||||
return new IntelliJTheme( Utils.class.getResourceAsStream(
|
||||
"/com/formdev/flatlaf/intellijthemes/themes/material-theme-ui-lite/" + name ) );
|
||||
} catch( IOException ex ) {
|
||||
String msg = "FlatLaf: Failed to load IntelliJ theme '" + name + "'";
|
||||
LOG.log( Level.SEVERE, msg, ex );
|
||||
LoggingFacade.logSevere( msg, ex );
|
||||
throw new RuntimeException( msg, ex );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user