Skip to content

Commit

Permalink
class.getModule is new in Java9
Browse files Browse the repository at this point in the history
Signed-off-by: Ceki Gulcu <[email protected]>
  • Loading branch information
ceki committed Aug 10, 2024
1 parent 3ff0087 commit 8ae0efc
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions slf4j-api/src/main/java/org/slf4j/helpers/Slf4jEnvUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@

package org.slf4j.helpers;

import java.lang.module.ModuleDescriptor;
import java.util.Optional;

/**
* Various utility methods
*
Expand All @@ -42,9 +39,9 @@ public class Slf4jEnvUtil {
* @since 2.0.14
*/
static public String slf4jVersion() {
String moduleVersion = slf4jVersionByModule();
if(moduleVersion != null)
return moduleVersion;
// String moduleVersion = slf4jVersionByModule();
// if(moduleVersion != null)
// return moduleVersion;

Package pkg = Slf4jEnvUtil.class.getPackage();
if(pkg == null) {
Expand All @@ -61,16 +58,16 @@ static public String slf4jVersion() {
* @return current version or null if missing version data
* @since 2.0.14
*/
static private String slf4jVersionByModule() {
Module module = Slf4jEnvUtil.class.getModule();
if (module == null)
return null;

ModuleDescriptor md = module.getDescriptor();
if (md == null)
return null;
Optional<String> opt = md.rawVersion();
return opt.orElse(null);
}
// static private String slf4jVersionByModule() {
// Module module = Slf4jEnvUtil.class.getModule();
// if (module == null)
// return null;
//
// ModuleDescriptor md = module.getDescriptor();
// if (md == null)
// return null;
// Optional<String> opt = md.rawVersion();
// return opt.orElse(null);
// }

}

0 comments on commit 8ae0efc

Please sign in to comment.