[
https://issues.apache.org/jira/browse/XMLBEANS-567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17540105#comment-17540105
]
Peter Keller commented on XMLBEANS-567:
---------------------------------------
OK - I decided to get my hands dirty, and take a closer look at the code. In my
hands, the following patch makes xmlbeans-ie-tryout2 work:
{code:java}
diff --git
a/src/main/java/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
b/src/main/java/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
index 8c7a2056..2a0511c6 100755
--- a/src/main/java/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
+++ b/src/main/java/org/apache/xmlbeans/impl/config/InterfaceExtensionImpl.java
@@ -324,7 +324,7 @@ public class InterfaceExtensionImpl implements
InterfaceExtension {
_signature = null;
_name = method.getName().asString();
- _return = replaceInner(method.getTypeAsString());
+ _return = replaceInner(method.getType().resolve().describe());
_params = method.getParameters().stream().map(p ->
p.getType().resolve().describe()).
map(MethodSignatureImpl::replaceInner).toArray(String[]::new);{code}
The relevant generated code looks like this:
{noformat}
public class CustomerImpl extends
org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements
com.example.easypo.Customer {
private static final long serialVersionUID = 1L;
public CustomerImpl(org.apache.xmlbeans.SchemaType sType) {
super(sType);
}
/**
* Implementation method for interface mypackage.CustomerFooHandler
*/
public java.util.List<java.lang.String> getFoos() {
return mypackage.CustomerFooHandler.getFoos(this);
}
/**
* Implementation method for interface mypackage.CustomerFooHandler
*/
public java.lang.String getFoo() {
return mypackage.CustomerFooHandler.getFoo(this);
}
{noformat}
I have never worked with JavaParser before, and I have no idea how general this
patch is, but maybe this will help.
> Problems with XMLBeans Extension Interfaces Feature
> ---------------------------------------------------
>
> Key: XMLBEANS-567
> URL: https://issues.apache.org/jira/browse/XMLBEANS-567
> Project: XMLBeans
> Issue Type: Task
> Affects Versions: Version 5.0.0
> Reporter: Dmitry Lastochkin
> Priority: Major
> Attachments: xmlbeans-ie-tryout.tar, xmlbeans-ie-tryout2.tar
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Hello! In our project we are using [XMLBeans Extension Interfaces
> Feature|https://cwiki.apache.org/confluence/display/XMLBEANS/ExtensionInterfacesFeature].
> When we compile the TypeSystem (using {{SchemaTypeSystemCompiler.compile}}),
> we add the jar with our extension classes to classpath parameter. In XMLBeans
> 2.4 it works perfectly. But when we updated to XMLBeans 5.0.0, we encountered
> the following error during an extensions validation:
> {code}
> Interface 'SomeInterface' not found."
> {code}
> As far as I understand, this is because
> {{org.apache.xmlbeans.impl.config.Parser}} does not search classes in
> classpath (only in files).
> When we added the sources of the extension interface to the parameters,
> TypeSystem compiled successfuly. But then we ran into another problem. When
> XMLBeans generates java files from XSD, it uses simple class names (instead
> of fully qualified names as it was in XMLBeans 2.4.0) for the classes that
> are used in methods of the extension interface (like parameters types or
> return types). And therefore the geneted files cannot be compiled if the
> extension classes are in a different package.
> Are those changes (ingorning classpath when searching for extenstions and
> using simple names for extenstion classes in code generation instead of fully
> qualified names) were made intentionally? Such limitations are hard to work
> around, making an upgrade from older XMLBeans version very complicated.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]