[ 
https://issues.apache.org/jira/browse/LUCENE-10260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17448786#comment-17448786
 ] 

Dawid Weiss commented on LUCENE-10260:
--------------------------------------

I think we should get rid of the LucenePackage.get returning Package because 
Package.getImplementationVersion is explicitly not supported for modules. 
Instead, LucenePackage should return itself and have some metadata-access 
methods like getVersion(). I checked and this works for modules, including 
automatic modules - module.getDescriptor().rawVersion():

{code}
+    var module = LucenePackage.class.getModule();
+    if (module.isNamed()) {
+      System.out.println("Named: " + module.isNamed());
+      System.out.println("Name: " + module.getName());
+      System.out.println("Version: " + 
module.getDescriptor().rawVersion().orElse("unknown"));
+
+      try {
+        System.out.println("Manifest: " + 
module.getResourceAsStream("/META-INF/MANIFEST.MF"));
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
+    }
{code}

The manifest can also be read and parsed, if you wanted to keep this 
information single-source.

> Luke's about window no longer shows version number
> --------------------------------------------------
>
>                 Key: LUCENE-10260
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10260
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: luke
>    Affects Versions: 9.0
>            Reporter: Uwe Schindler
>            Priority: Major
>
> This seems to be caused by the module change. It looks like the modularized 
> (automodule) no longer can get the Implementation verison using class 
> LuceneVersion (in root package).
>  
> We should fix this in case of respin, otherwise it is cosmetical only.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to