You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "reckart (via GitHub)" <gi...@apache.org> on 2024/12/20 09:26:00 UTC
[PR] Issue #430: Resolving type system imports through sp is slows things down too much [uima-uimaj]
reckart opened a new pull request, #433:
URL: https://github.com/apache/uima-uimaj/pull/433
**What's in the PR**
- Clean up ClassLoaderUtils a bit
- Added missing since version to deprecation
- Consolidate redundant code inside RelativePathResolver_impl
- Allow UimaBndPlugin to dive into transitive imports and process them as well
- Make transitive import resoving optional
- Added more debug logging
**How to test manually**
* See issue description
**Automatic testing**
* [ ] PR adds/updates unit tests
**Documentation**
* [ ] PR adds/updates documentation
**Organizational**
- [ ] PR adds/updates dependencies.
<sub><sup>Only dependencies under [approved licenses](http://www.apache.org/legal/resolved.html#category-a) are allowed. LICENSE and NOTICE files in the respective modules where dependencies have been added as well as in the project root have been updated.</sup></sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@uima.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #430: Resolving type system imports through sp is slows things down too much [uima-uimaj]
Posted by "reckart (via GitHub)" <gi...@apache.org>.
reckart merged PR #433:
URL: https://github.com/apache/uima-uimaj/pull/433
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@uima.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #430: Resolving type system imports through sp is slows things down too much [uima-uimaj]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #433:
URL: https://github.com/apache/uima-uimaj/pull/433#discussion_r2362417338
##########
uima-bnd-plugin/src/main/java/org/apache/uima/tools/bnd/UimaBndPlugin.java:
##########
@@ -132,18 +149,30 @@ private void handleImportByName(Analyzer analyzer, String path, Import imp)
tsdPackage = tsdPackage.substring(0, lastSeparatorPosition);
}
- LOG.debug("Found UIMA type system import by name: {}", tsdPackage);
-
var pack = analyzer.getPackageRef(tsdPackage);
if (!QN.matcher(pack.getFQN()).matches()) {
- analyzer.warning("Type system import does not seem to refer to a package (%s): %s",
- path, pack);
+ analyzer.warning("Import does not seem to refer to a package (%s): %s", path, pack);
}
- if (!analyzer.getReferred().containsKey(pack)) {
+ var alreadyKnownImport = analyzer.getReferred().containsKey(pack);
+ if (!alreadyKnownImport) {
var attrs = new Attrs();
analyzer.getReferred().put(pack, attrs);
}
+
+ LOG.debug("{}Found UIMA import by name: {} {}", repeat(" ", level), tsdPackage, alreadyKnownImport ? "" : "(new)");
+
+ var importedResourcePath = imp.getName().replace('.', '/') + ".xml";
+ var importedResource = analyzer.findResource(importedResourcePath);
+ if (importedResource == null) {
+ analyzer.warning("Imported resource not found on classpath: {}", importedResourcePath);
+ return;
+ }
+
+ if (configuration.transitive(false)) {
+ LOG.debug("");
Review Comment:
Empty debug log statement serves no purpose and should be removed. If this was intended for spacing in log output, consider adding a meaningful message or removing it entirely.
```suggestion
```
##########
uima-bnd-plugin/src/main/java/org/apache/uima/tools/bnd/UimaBndPlugin.java:
##########
@@ -132,18 +149,30 @@ private void handleImportByName(Analyzer analyzer, String path, Import imp)
tsdPackage = tsdPackage.substring(0, lastSeparatorPosition);
}
- LOG.debug("Found UIMA type system import by name: {}", tsdPackage);
-
var pack = analyzer.getPackageRef(tsdPackage);
if (!QN.matcher(pack.getFQN()).matches()) {
- analyzer.warning("Type system import does not seem to refer to a package (%s): %s",
- path, pack);
+ analyzer.warning("Import does not seem to refer to a package (%s): %s", path, pack);
}
- if (!analyzer.getReferred().containsKey(pack)) {
+ var alreadyKnownImport = analyzer.getReferred().containsKey(pack);
+ if (!alreadyKnownImport) {
var attrs = new Attrs();
analyzer.getReferred().put(pack, attrs);
}
+
+ LOG.debug("{}Found UIMA import by name: {} {}", repeat(" ", level), tsdPackage, alreadyKnownImport ? "" : "(new)");
+
+ var importedResourcePath = imp.getName().replace('.', '/') + ".xml";
+ var importedResource = analyzer.findResource(importedResourcePath);
+ if (importedResource == null) {
+ analyzer.warning("Imported resource not found on classpath: {}", importedResourcePath);
+ return;
+ }
+
+ if (configuration.transitive(false)) {
Review Comment:
Potential null pointer exception if configuration is null. The configuration field should be checked for null before calling methods on it, or initialized with a default value in the constructor.
```suggestion
if (configuration != null ? configuration.transitive(false) : false) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@uima.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org